log
This commit is contained in:
parent
4b34fc20b8
commit
1c9cb7ea78
11 changed files with 741 additions and 122 deletions
|
|
@ -20,6 +20,7 @@ import HttpError from "../interfaces/http-error";
|
|||
import { Not } from "typeorm";
|
||||
import { CreatePortfolio, Portfolio } from "../entities/Portfolio";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import { addLogSequence } from "../interfaces/utils";
|
||||
|
||||
@Route("api/v1/development/portfolio")
|
||||
@Tags("Portfolio")
|
||||
|
|
@ -105,7 +106,12 @@ export class PortfolioController extends Controller {
|
|||
_portfolio.createdFullName = request.user.name;
|
||||
_portfolio.lastUpdateUserId = request.user.sub;
|
||||
_portfolio.lastUpdateFullName = request.user.name;
|
||||
await this.portfolioRepository.save(_portfolio);
|
||||
addLogSequence(request, {
|
||||
action: "database",
|
||||
status: "success",
|
||||
description: "Store Portfolio.",
|
||||
});
|
||||
await this.portfolioRepository.save(_portfolio, { data: request });
|
||||
return new HttpSuccess(_portfolio.id);
|
||||
}
|
||||
|
||||
|
|
@ -137,7 +143,12 @@ export class PortfolioController extends Controller {
|
|||
_portfolio.lastUpdateUserId = request.user.sub;
|
||||
_portfolio.lastUpdateFullName = request.user.name;
|
||||
Object.assign(_portfolio, requestBody);
|
||||
await this.portfolioRepository.save(_portfolio);
|
||||
addLogSequence(request, {
|
||||
action: "database",
|
||||
status: "success",
|
||||
description: "Store Portfolio.",
|
||||
});
|
||||
await this.portfolioRepository.save(_portfolio, { data: request });
|
||||
return new HttpSuccess(_portfolio.id);
|
||||
}
|
||||
|
||||
|
|
@ -156,7 +167,12 @@ export class PortfolioController extends Controller {
|
|||
if (!_delPortfolio) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลผลงานนี้");
|
||||
}
|
||||
await this.portfolioRepository.delete(_delPortfolio.id);
|
||||
addLogSequence(request, {
|
||||
action: "database",
|
||||
status: "success",
|
||||
description: "Store Portfolio.",
|
||||
});
|
||||
await this.portfolioRepository.delete(_delPortfolio.id), { data: request };
|
||||
return new HttpSuccess();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue