barname bug
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import {
|
import {
|
||||||
Body, Controller, Delete, Get, Param, Post,
|
Body, Controller, Delete, Get, Param, Post,Patch,
|
||||||
Query, UseInterceptors
|
Query, UseInterceptors
|
||||||
} from "@nestjs/common";
|
} from "@nestjs/common";
|
||||||
import { ApiHeader, ApiOperation } from "@nestjs/swagger";
|
import { ApiHeader, ApiOperation } from "@nestjs/swagger";
|
||||||
@@ -45,7 +45,7 @@ export class BarnameController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation({ summary: "Update Barname by watcher" })
|
@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) {
|
update(@Param('id') id: string, @BusinessDec() business: Business, @Body() dto: UpdateBarnameAsWatcherDto, @UserDec("role") role: RoleEnum) {
|
||||||
return this.barnameService.updateBarnameAsWatcher(id, dto, business, role);
|
return this.barnameService.updateBarnameAsWatcher(id, dto, business, role);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import { BarnameStatus } from "./enums/bill-type.enum";
|
|||||||
import { UpdateBarnameAsWatcherDto } from "./dto/update-barname-watcher.dto";
|
import { UpdateBarnameAsWatcherDto } from "./dto/update-barname-watcher.dto";
|
||||||
import { RoleEnum } from "../users/enums/role.enum";
|
import { RoleEnum } from "../users/enums/role.enum";
|
||||||
import { User } from "../users/entities/user.entity";
|
import { User } from "../users/entities/user.entity";
|
||||||
// import { CompaniesService } from "../companies/services/companies.service";
|
|
||||||
|
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@@ -22,7 +21,6 @@ export class BarnameService {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly em: EntityManager,
|
private readonly em: EntityManager,
|
||||||
// private readonly companiesService: CompaniesService,
|
|
||||||
private readonly barnameRepository: BarnameRepository,
|
private readonly barnameRepository: BarnameRepository,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
@@ -61,9 +59,9 @@ export class BarnameService {
|
|||||||
|
|
||||||
const barname = await this.findOne(id, business.id)
|
const barname = await this.findOne(id, business.id)
|
||||||
|
|
||||||
if (exitedAt) {
|
|
||||||
barname.exitedAt = exitedAt
|
barname.exitedAt = exitedAt
|
||||||
}
|
|
||||||
|
barname.status = BarnameStatus.COMPLETED
|
||||||
|
|
||||||
if (watcherDescription) {
|
if (watcherDescription) {
|
||||||
barname.watcherDescription = watcherDescription
|
barname.watcherDescription = watcherDescription
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ export class User extends BaseEntity {
|
|||||||
|
|
||||||
//-----------------------------------
|
//-----------------------------------
|
||||||
|
|
||||||
@OneToOne(() => Company, (company) => company.user, { orphanRemoval: true })
|
@OneToOne(() => Company, (company) => company.user, { orphanRemoval: true, nullable: true })
|
||||||
company!: Company & Opt;
|
company?: Company;
|
||||||
|
|
||||||
//-----------------------------------
|
//-----------------------------------
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user