Skip to content

Commit

Permalink
pass tsc
Browse files Browse the repository at this point in the history
  • Loading branch information
elvincheng3 committed Oct 3, 2023
1 parent 6bee36e commit 0477174
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 16 deletions.
2 changes: 0 additions & 2 deletions apps/server/src/employees/employees.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ describe('EmployeesController', () => {
single: false,
createdAt: new Date(1672531200),
updatedAt: new Date(1672531200),
signatureFields: [],
departmentId: 'department-id',
department: {
id: 'department-id',
Expand All @@ -114,7 +113,6 @@ describe('EmployeesController', () => {
single: false,
createdAt: new Date(1672531200),
updatedAt: new Date(1672531200),
signatureFields: [],
departmentId: 'department-id',
department: {
id: 'department-id',
Expand Down
33 changes: 30 additions & 3 deletions apps/server/src/employees/employees.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,16 @@ export class EmployeesService {
),
},
include: {
position: { include: { department: true, signatureFields: true } },
position: {
include: {
department: true,
signatureFields: {
include: {
formTemplate: true,
},
},
},
},
},
});
newEmployee.pswdHash = null;
Expand Down Expand Up @@ -59,7 +68,16 @@ export class EmployeesService {
id: id,
},
include: {
position: { include: { department: true, signatureFields: true } },
position: {
include: {
department: true,
signatureFields: {
include: {
formTemplate: true,
},
},
},
},
},
});
return employee;
Expand All @@ -78,7 +96,16 @@ export class EmployeesService {
},
data: updateEmployeeDto,
include: {
position: { include: { department: true, signatureFields: true } },
position: {
include: {
department: true,
signatureFields: {
include: {
formTemplate: true,
},
},
},
},
},
});
return updatedEmployee;
Expand Down
4 changes: 0 additions & 4 deletions apps/server/src/positions/entities/position.entity.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { ApiProperty } from '@nestjs/swagger';
import { Position } from '@prisma/client';
import { Exclude } from 'class-transformer';
import { SignatureFieldEntity } from './../../signature-fields/entities/signature-field.entity';
import { DepartmentEntity } from './../../departments/entities/department.entity';
import { IsOptional } from 'class-validator';

Expand All @@ -23,9 +22,6 @@ export class PositionEntity implements Position {
@ApiProperty()
department: DepartmentEntity;

@ApiProperty()
signatureFields: SignatureFieldEntity[];

@Exclude()
createdAt: Date;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { SignatureField } from '@prisma/client';
import { ApiProperty } from '@nestjs/swagger';
import { Exclude } from 'class-transformer';
import { PositionEntity } from '@server/positions/entities/position.entity';
import { FormTemplateEntity } from '@server/form-templates/entities/form-template.entity';
import { PositionEntity } from '../../positions/entities/position.entity';

export class SignatureFieldEntity implements SignatureField {
@ApiProperty()
Expand All @@ -23,16 +22,17 @@ export class SignatureFieldEntity implements SignatureField {
@Exclude()
signerPositionId: string | null;

@Exclude()
formTemplateId: string;

@ApiProperty()
signerPosition: PositionEntity | null;

@ApiProperty()
formTemplate: FormTemplateEntity;
@Exclude()
formTemplateId: string;

constructor(partial: Partial<SignatureFieldEntity>) {
if (partial.signerPosition) {
partial.signerPosition = new PositionEntity(partial.signerPosition);
}

Object.assign(this, partial);
}
}

0 comments on commit 0477174

Please sign in to comment.