Skip to content

Commit

Permalink
add employee field throughout files
Browse files Browse the repository at this point in the history
Co-authored-by: Gayatri Kondabathini <[email protected]>
  • Loading branch information
laurenbrissette and Gayatri-K26 committed Jan 25, 2025
1 parent 306ba59 commit 9d0e4b0
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 1 deletion.
6 changes: 6 additions & 0 deletions apps/server/prisma/seed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ type EmployeeData = {
email: string;
positionId: string;
signatureLink: string;
isAdmin: boolean;
};

// update or insert employee to database based on the employee id
Expand All @@ -65,6 +66,7 @@ async function upsertEmployee(empData: EmployeeData) {
position: {
connect: { id: empData.positionId },
},
isAdmin: empData.isAdmin,
},
});
}
Expand Down Expand Up @@ -387,6 +389,7 @@ async function main() {
email: '[email protected]',
positionId: CHIEF_OF_STAFF_UUID,
signatureLink: DEV_SIGNATURE_LINK,
isAdmin: true,
},
{
id: KAI_ZHENG_UUID,
Expand All @@ -395,6 +398,7 @@ async function main() {
email: '[email protected]',
positionId: CHIEF_FIN_OFFICER_UUID,
signatureLink: DEV_SIGNATURE_LINK,
isAdmin: true,
},
{
id: ANGELA_WEIGL_UUID,
Expand All @@ -403,6 +407,7 @@ async function main() {
email: '[email protected]',
positionId: AGG_DIR_UUID,
signatureLink: DEV_SIGNATURE_LINK,
isAdmin: true,
},
{
id: ANSHUL_SHIRUDE_UUID,
Expand All @@ -411,6 +416,7 @@ async function main() {
email: '[email protected]',
positionId: CHIEF_LEARNING_ENGAGEMENT_UUID,
signatureLink: DEV_SIGNATURE_LINK,
isAdmin: true,
},
];

Expand Down
1 change: 1 addition & 0 deletions apps/server/src/app.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ export class AppController {
password: employeeDto.password,
signatureLink: employeeDto.signatureLink,
positionId: '',
isAdmin: employeeDto.isAdmin,
};

const newEmployee = await this.authService.register(
Expand Down
13 changes: 12 additions & 1 deletion apps/server/src/auth/dto/register-employee.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import { ApiProperty } from '@nestjs/swagger';
import { IsNotEmpty, IsString, MinLength, IsEmail } from 'class-validator';
import {
IsNotEmpty,
IsString,
MinLength,
IsEmail,
IsBoolean,
} from 'class-validator';

export class RegisterEmployeeDto {
@IsString()
Expand Down Expand Up @@ -37,4 +43,9 @@ export class RegisterEmployeeDto {
@IsNotEmpty()
@ApiProperty()
signatureLink: string;

@IsBoolean()
@IsNotEmpty()
@ApiProperty()
isAdmin: boolean;
}
6 changes: 6 additions & 0 deletions apps/server/src/employees/dto/create-employee.dto.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ApiProperty } from '@nestjs/swagger';
import {
IsBoolean,
IsEmail,
IsNotEmpty,
IsString,
Expand Down Expand Up @@ -38,4 +39,9 @@ export class CreateEmployeeDto {
@IsNotEmpty()
@ApiProperty()
signatureLink: string;

@IsBoolean()
@IsNotEmpty()
@ApiProperty()
isAdmin: boolean;
}
1 change: 1 addition & 0 deletions apps/server/src/employees/employees.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class EmployeesService {
createEmployeeDto.password,
await bcrypt.genSalt(),
),
isAdmin: createEmployeeDto.isAdmin,
},
include: {
position: {
Expand Down
1 change: 1 addition & 0 deletions apps/server/src/metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export default async () => {
positionId: { required: true, type: () => String },
email: { required: true, type: () => String },
password: { required: true, type: () => String, minLength: 5 },
isAdmin: { required: true, type: () => Boolean },
},
},
],
Expand Down
1 change: 1 addition & 0 deletions apps/web/src/client/models/CreateEmployeeDto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@ export type CreateEmployeeDto = {
email: string;
password: string;
signatureLink: string;
isAdmin: boolean;
};

0 comments on commit 9d0e4b0

Please sign in to comment.