Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Front end document upload #14

Merged
merged 5 commits into from
Jan 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ app.use(
directives: {
'default-src': [
"'self'", // eslint-disable-line
new URL(config.get('frontend.oidc.authority')).origin
new URL(config.get('frontend.oidc.authority')).origin,
new URL(config.get('frontend.coms.apiPath')).origin
]
}
}
Expand Down
32 changes: 16 additions & 16 deletions app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@
"dependencies": {
"@prisma/client": "^5.7.1",
"api-problem": "^9.0.2",
"axios": "^1.6.2",
"axios": "^1.6.5",
"compression": "^1.7.4",
"config": "^3.3.9",
"config": "^3.3.10",
"cors": "^2.8.5",
"date-fns": "^3.0.5",
"date-fns": "^3.2.0",
"express": "^4.18.2",
"express-winston": "^4.2.0",
"helmet": "^7.1.0",
Expand Down
23 changes: 1 addition & 22 deletions app/src/components/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { join } from 'path';

import { getLogger } from './log';

import type { ChefsFormConfig, ChefsFormConfigData, YRN } from '../types';
import type { ChefsFormConfig, ChefsFormConfigData } from '../types';

const log = getLogger(module.filename);

Expand All @@ -22,16 +22,6 @@ export function addDashesToUuid(str: string): string {
} else return str;
}

/**
* @function fromYrn
* Converts a YRN to boolean
* @param {YRN} yrn An arbitrary YRN
* @returns {boolean | null} The converted value
*/
export function fromYrn(yrn: YRN): boolean | null {
return yrn === null ? null : yrn.toUpperCase() === 'Y';
}

/**
* @function getChefsApiKey
* Search for a CHEFS form Api Key
Expand Down Expand Up @@ -168,14 +158,3 @@ export function redactSecrets(data: { [key: string]: unknown }, fields: Array<st
}
return data;
}

/**
* @function toYrn
* Converts a boolean to YRN
* @param {boolean | null} bool An arbitrary boolean
* @returns {YRN} The converted value
*/
export function toYrn(bool: boolean | null): YRN {
if (bool === null) return null;
return bool ? 'Y' : 'N';
}
1 change: 1 addition & 0 deletions app/src/db/models/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export default {
filename: input.filename,
mimeType: input.mimeType,
filesize: Number(input.filesize),
createdAt: input.createdAt?.toISOString(),
submissionId: input.submissionId as string
};
}
Expand Down
7 changes: 6 additions & 1 deletion app/src/services/document.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const service = {
mimeType: string,
filesize: number
) => {
await prisma.document.create({
const response = await prisma.document.create({
data: {
documentId: documentId,
submissionId: submissionId,
Expand All @@ -27,6 +27,8 @@ const service = {
filesize: filesize
}
});

return document.fromPrismaModel(response);
},

/**
Expand All @@ -39,6 +41,9 @@ const service = {
const response = await prisma.document.findMany({
where: {
submissionId: submissionId
},
orderBy: {
createdAt: 'asc'
}
});

Expand Down
4 changes: 2 additions & 2 deletions app/src/services/user.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import jwt from 'jsonwebtoken';
import { Prisma } from '@prisma/client';
import { v4, NIL } from 'uuid';
import { v4 as uuidv4, NIL } from 'uuid';

import prisma from '../db/dataConnection';
import { identity_provider, user } from '../db/models';
Expand Down Expand Up @@ -87,7 +87,7 @@ const service = {
}

const newUser = {
userId: v4(),
userId: uuidv4(),
identityId: data.identityId,
username: data.username,
fullName: data.fullName,
Expand Down
1 change: 0 additions & 1 deletion app/src/types/YRN.ts

This file was deleted.

1 change: 0 additions & 1 deletion app/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ export type { IdentityProvider } from './IdentityProvider';
export type { SubmissionSearchParameters } from './SubmissionSearchParameters';
export type { User } from './User';
export type { UserSearchParameters } from './UserSearchParameters';
export type { YRN } from './YRN';
2 changes: 1 addition & 1 deletion charts/pcns/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: nr-permitconnect-navigator-service
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.0.2
version: 0.0.3
kubeVersion: ">= 1.13.0"
description: PermitConnect Navigator Service
# A chart can be either an 'application' or a 'library' chart.
Expand Down
2 changes: 1 addition & 1 deletion charts/pcns/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# nr-permitconnect-navigator-service

![Version: 0.0.2](https://img.shields.io/badge/Version-0.0.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square)
![Version: 0.0.3](https://img.shields.io/badge/Version-0.0.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square)

PermitConnect Navigator Service

Expand Down
2 changes: 0 additions & 2 deletions charts/pcns/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ spec:
- namespaceSelector:
matchLabels:
network.openshift.io/policy-group: ingress
- podSelector:
matchLabels: {{ include "pcns.selectorLabels" . | nindent 14 }}
ports:
- port: {{ default "8080" .Values.config.configMap.SERVER_PORT | atoi }}
protocol: TCP
Expand Down
Loading