feat: auto-populate department_id on create + seed default campus with backfill
This commit is contained in:
@@ -27,6 +27,10 @@ export class CreateRoomDto {
|
||||
@IsOptional()
|
||||
@IsNumber()
|
||||
monthlyRate?: number;
|
||||
|
||||
@IsOptional()
|
||||
@IsInt()
|
||||
departmentId?: number;
|
||||
}
|
||||
|
||||
export class UpdateRoomDto {
|
||||
|
||||
@@ -100,7 +100,9 @@ export class RoomsService {
|
||||
}
|
||||
|
||||
async create(dto: CreateRoomDto) {
|
||||
return this.repo.save(this.repo.create(dto));
|
||||
const entity = this.repo.create(dto);
|
||||
if (dto.departmentId) entity.departmentId = dto.departmentId;
|
||||
return this.repo.save(entity);
|
||||
}
|
||||
|
||||
async update(id: number, dto: UpdateRoomDto) {
|
||||
|
||||
Reference in New Issue
Block a user