diff --git a/src/modules/barname/barname.controller.ts b/src/modules/barname/barname.controller.ts index fabfa25..3bc673f 100644 --- a/src/modules/barname/barname.controller.ts +++ b/src/modules/barname/barname.controller.ts @@ -1,5 +1,5 @@ import { - Body, Controller, Delete, Get, Param, Post, + Body, Controller, Delete, Get, Param, Post,Patch, Query, UseInterceptors } from "@nestjs/common"; import { ApiHeader, ApiOperation } from "@nestjs/swagger"; @@ -45,7 +45,7 @@ export class BarnameController { } @ApiOperation({ summary: "Update Barname by watcher" }) - @Get(":id/watcher") + @Patch(":id/watcher") update(@Param('id') id: string, @BusinessDec() business: Business, @Body() dto: UpdateBarnameAsWatcherDto, @UserDec("role") role: RoleEnum) { return this.barnameService.updateBarnameAsWatcher(id, dto, business, role); } diff --git a/src/modules/barname/barname.service.ts b/src/modules/barname/barname.service.ts index ad96f32..8b5efb1 100644 --- a/src/modules/barname/barname.service.ts +++ b/src/modules/barname/barname.service.ts @@ -12,7 +12,6 @@ import { BarnameStatus } from "./enums/bill-type.enum"; import { UpdateBarnameAsWatcherDto } from "./dto/update-barname-watcher.dto"; import { RoleEnum } from "../users/enums/role.enum"; import { User } from "../users/entities/user.entity"; -// import { CompaniesService } from "../companies/services/companies.service"; @Injectable() @@ -22,7 +21,6 @@ export class BarnameService { constructor( private readonly em: EntityManager, - // private readonly companiesService: CompaniesService, private readonly barnameRepository: BarnameRepository, ) { } @@ -61,9 +59,9 @@ export class BarnameService { const barname = await this.findOne(id, business.id) - if (exitedAt) { - barname.exitedAt = exitedAt - } + barname.exitedAt = exitedAt + + barname.status = BarnameStatus.COMPLETED if (watcherDescription) { barname.watcherDescription = watcherDescription diff --git a/src/modules/users/entities/user.entity.ts b/src/modules/users/entities/user.entity.ts index 4ebfea9..3fd635d 100644 --- a/src/modules/users/entities/user.entity.ts +++ b/src/modules/users/entities/user.entity.ts @@ -56,8 +56,8 @@ export class User extends BaseEntity { //----------------------------------- - @OneToOne(() => Company, (company) => company.user, { orphanRemoval: true }) - company!: Company & Opt; + @OneToOne(() => Company, (company) => company.user, { orphanRemoval: true, nullable: true }) + company?: Company; //-----------------------------------