Skip to content

Commit

Permalink
make description optional
Browse files Browse the repository at this point in the history
  • Loading branch information
laurenbrissette committed Feb 14, 2025
1 parent 2506b19 commit 26f5374
Show file tree
Hide file tree
Showing 14 changed files with 65 additions and 34 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
-- AlterTable
ALTER TABLE "FormInstance" ADD COLUMN "description" TEXT;

-- AlterTable
ALTER TABLE "FormTemplate" ADD COLUMN "description" TEXT;
4 changes: 2 additions & 2 deletions apps/server/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ model FormTemplate {
id String @id @default(uuid()) @db.Uuid
name String @db.VarChar(255)
formDocLink String @db.VarChar(255)
description String @db.VarChar(255) @default("No description")
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
description String? @db.Text()
fieldGroups FieldGroup[]
formInstances FormInstance[]
Expand Down Expand Up @@ -141,11 +141,11 @@ model FormInstance {
id String @id @default(uuid()) @db.Uuid
name String @db.VarChar(255)
formDocLink String @db.VarChar(255)
description String @db.VarChar(255) @default("No description")
completed Boolean @default(false)
markedCompleted Boolean @default(false)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
description String? @db.Text()
completedAt DateTime?
markedCompletedAt DateTime?
Expand Down
4 changes: 2 additions & 2 deletions apps/server/prisma/seed.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export type FormTemplateData = {
name: string;
formDocLink: string;
fieldGroups: FieldGroupData[];
description: string;
description?: string;
};

export type AssignedGroupData = {
Expand All @@ -66,5 +66,5 @@ export type FormInstanceData = {
originatorId: string;
formTemplateId: string;
assignedGroups: AssignedGroupData[];
description: string;
description?: string;
};
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class CreateFormInstanceDto {

@IsString()
@ApiProperty()
description: string;
description: string | null;

@IsArray()
@ArrayMinSize(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ export class FormInstanceBaseEntity implements FormInstance {
@ApiProperty()
name: string;

@ApiProperty()
description: string | null;

@Exclude()
formDocLink: string;

Expand Down Expand Up @@ -51,9 +54,6 @@ export class FormInstanceBaseEntity implements FormInstance {
constructor(partial: Partial<FormInstanceEntity>) {
Object.assign(this, partial);
}

@ApiProperty()
description: string;
}

export class FormInstanceEntity implements FormInstance {
Expand All @@ -64,7 +64,7 @@ export class FormInstanceEntity implements FormInstance {
name: string;

@ApiProperty()
description: string;
description: string | null;

@ApiProperty()
formDocLink: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ export class CreateFormTemplateDto {
formDocLink: string;

@IsString()
@IsNotEmpty()
@ApiProperty()
description: string;
description: string | null;

@IsArray()
@ArrayMinSize(1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class FormTemplateBaseEntity implements FormTemplate {
formDocLink: string;

@ApiProperty()
description: string;
description: string | null;

@Exclude()
createdAt: Date;
Expand Down
11 changes: 11 additions & 0 deletions apps/web/openapi-ts-error-1739504125051.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Error requesting http://localhost:8080/api-json
fetch failed
ResolverError: Error requesting http://localhost:8080/api-json
fetch failed
at Object.sendRequest (/Users/laurenbrissette/Documents/GitHub (laurenbrissette)/mfa-form-automator/node_modules/@hey-api/json-schema-ref-parser/dist/lib/resolvers/url.js:44:15)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Gs (/Users/laurenbrissette/Documents/GitHub (laurenbrissette)/mfa-form-automator/apps/web/node_modules/@hey-api/openapi-ts/dist/index.cjs:12:908)
at async mo (/Users/laurenbrissette/Documents/GitHub (laurenbrissette)/mfa-form-automator/apps/web/node_modules/@hey-api/openapi-ts/dist/index.cjs:14:88219)
at async Promise.all (index 0)
at async Uv (/Users/laurenbrissette/Documents/GitHub (laurenbrissette)/mfa-form-automator/apps/web/node_modules/@hey-api/openapi-ts/dist/index.cjs:1311:4468)
at async start (/Users/laurenbrissette/Documents/GitHub (laurenbrissette)/mfa-form-automator/apps/web/node_modules/@hey-api/openapi-ts/bin/index.cjs:120:21)
11 changes: 11 additions & 0 deletions apps/web/openapi-ts-error-1739504146115.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Error requesting http://localhost:8080/api-json
fetch failed
ResolverError: Error requesting http://localhost:8080/api-json
fetch failed
at Object.sendRequest (/Users/laurenbrissette/Documents/GitHub (laurenbrissette)/mfa-form-automator/node_modules/@hey-api/json-schema-ref-parser/dist/lib/resolvers/url.js:44:15)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Gs (/Users/laurenbrissette/Documents/GitHub (laurenbrissette)/mfa-form-automator/apps/web/node_modules/@hey-api/openapi-ts/dist/index.cjs:12:908)
at async mo (/Users/laurenbrissette/Documents/GitHub (laurenbrissette)/mfa-form-automator/apps/web/node_modules/@hey-api/openapi-ts/dist/index.cjs:14:88219)
at async Promise.all (index 0)
at async Uv (/Users/laurenbrissette/Documents/GitHub (laurenbrissette)/mfa-form-automator/apps/web/node_modules/@hey-api/openapi-ts/dist/index.cjs:1311:4468)
at async start (/Users/laurenbrissette/Documents/GitHub (laurenbrissette)/mfa-form-automator/apps/web/node_modules/@hey-api/openapi-ts/bin/index.cjs:120:21)
11 changes: 11 additions & 0 deletions apps/web/openapi-ts-error-1739504908576.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
Error requesting http://localhost:8080/api-json
fetch failed
ResolverError: Error requesting http://localhost:8080/api-json
fetch failed
at Object.sendRequest (/Users/laurenbrissette/Documents/GitHub (laurenbrissette)/mfa-form-automator/node_modules/@hey-api/json-schema-ref-parser/dist/lib/resolvers/url.js:44:15)
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Gs (/Users/laurenbrissette/Documents/GitHub (laurenbrissette)/mfa-form-automator/apps/web/node_modules/@hey-api/openapi-ts/dist/index.cjs:12:908)
at async mo (/Users/laurenbrissette/Documents/GitHub (laurenbrissette)/mfa-form-automator/apps/web/node_modules/@hey-api/openapi-ts/dist/index.cjs:14:88219)
at async Promise.all (index 0)
at async Uv (/Users/laurenbrissette/Documents/GitHub (laurenbrissette)/mfa-form-automator/apps/web/node_modules/@hey-api/openapi-ts/dist/index.cjs:1311:4468)
at async start (/Users/laurenbrissette/Documents/GitHub (laurenbrissette)/mfa-form-automator/apps/web/node_modules/@hey-api/openapi-ts/bin/index.cjs:120:21)
17 changes: 8 additions & 9 deletions apps/web/src/client/schemas.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@ export const CreateFormTemplateDtoSchema = {
},
description: {
type: 'string',
nullable: true,
},
fieldGroups: {
type: 'array',
Expand Down Expand Up @@ -555,6 +556,7 @@ export const FormTemplateBaseEntitySchema = {
},
description: {
type: 'string',
nullable: true,
},
createdAt: {
format: 'date-time',
Expand All @@ -565,14 +567,7 @@ export const FormTemplateBaseEntitySchema = {
type: 'string',
},
},
required: [
'id',
'name',
'formDocLink',
'description',
'createdAt',
'updatedAt',
],
required: ['id', 'name', 'formDocLink', 'createdAt', 'updatedAt'],
} as const;

export const AssignedGroupEntitySchema = {
Expand Down Expand Up @@ -692,6 +687,7 @@ export const FormInstanceEntitySchema = {
},
description: {
type: 'string',
nullable: true,
},
formDocLink: {
type: 'string',
Expand Down Expand Up @@ -770,6 +766,7 @@ export const FormTemplateEntitySchema = {
},
description: {
type: 'string',
nullable: true,
},
fieldGroups: {
type: 'array',
Expand All @@ -796,7 +793,6 @@ export const FormTemplateEntitySchema = {
'id',
'name',
'formDocLink',
'description',
'fieldGroups',
'formInstances',
'createdAt',
Expand All @@ -815,6 +811,7 @@ export const UpdateFormTemplateDtoSchema = {
},
description: {
type: 'string',
nullable: true,
},
},
} as const;
Expand Down Expand Up @@ -878,6 +875,7 @@ export const CreateFormInstanceDtoSchema = {
},
description: {
type: 'string',
nullable: true,
},
assignedGroups: {
type: 'array',
Expand Down Expand Up @@ -913,6 +911,7 @@ export const UpdateFormInstanceDtoSchema = {
},
description: {
type: 'string',
nullable: true,
},
formDocLink: {
type: 'string',
Expand Down
14 changes: 7 additions & 7 deletions apps/web/src/client/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ export type CreateFieldGroupDto = {
export type CreateFormTemplateDto = {
name: string;
formDocLink: string;
description: string;
description: string | null;
fieldGroups: Array<CreateFieldGroupDto>;
};

Expand Down Expand Up @@ -175,7 +175,7 @@ export type FormTemplateBaseEntity = {
id: string;
name: string;
formDocLink: string;
description: string;
description?: string | null;
createdAt: string;
updatedAt: string;
};
Expand Down Expand Up @@ -205,7 +205,7 @@ export type AssignedGroupEntity = {
export type FormInstanceEntity = {
id: string;
name: string;
description: string;
description: string | null;
formDocLink: string;
completed: boolean;
markedCompleted: boolean;
Expand All @@ -224,7 +224,7 @@ export type FormTemplateEntity = {
id: string;
name: string;
formDocLink: string;
description: string;
description?: string | null;
fieldGroups: Array<FieldGroupBaseEntity>;
formInstances: Array<FormInstanceEntity>;
createdAt: string;
Expand All @@ -234,7 +234,7 @@ export type FormTemplateEntity = {
export type UpdateFormTemplateDto = {
name?: string;
formDocLink?: string;
description?: string;
description?: string | null;
};

export type CreateDepartmentDto = {
Expand All @@ -257,7 +257,7 @@ export type CreateAssignedGroupDto = {

export type CreateFormInstanceDto = {
name: string;
description: string;
description: string | null;
assignedGroups: Array<CreateAssignedGroupDto>;
originatorId: string;
formTemplateId: string;
Expand All @@ -266,7 +266,7 @@ export type CreateFormInstanceDto = {

export type UpdateFormInstanceDto = {
name?: string;
description?: string;
description?: string | null;
formDocLink?: string;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const CreateFormInstanceModal: React.FC<CreateFormInstanceModalProps> = ({
originatorId: user?.id!,
formTemplateId: selectedFormTemplate?.id!,
formDocLink: selectedFormTemplate?.formDocLink!,
description: selectedFormTemplate?.description!,
description: selectedFormTemplate?.description ? selectedFormTemplate?.description : null,
},
})
.then((response) => {
Expand Down

0 comments on commit 26f5374

Please sign in to comment.