add permission insignia
This commit is contained in:
parent
317920ad0d
commit
6bc5252d1b
2 changed files with 12 additions and 6 deletions
|
|
@ -23,7 +23,8 @@ import HttpError from "../interfaces/http-error";
|
|||
import { Equal, ILike, In, IsNull, Like, Not, Brackets, Between } from "typeorm";
|
||||
import { InsigniaType, CreateInsigniaType, UpdateInsigniaType } from "../entities/InsigniaType";
|
||||
import { Insignia, CreateInsignias, UpdateInsignias } from "../entities/Insignia";
|
||||
|
||||
import permission from "../interfaces/permission";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
@Route("api/v1/org/insignia/insignia")
|
||||
@Tags("Insignia")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -146,7 +147,8 @@ export class InsigniaController extends Controller {
|
|||
* @param {string} id Id เครื่องราชอิสริยาภรณ์
|
||||
*/
|
||||
@Get("{id}")
|
||||
async GetInsigniaById(@Path() id: string) {
|
||||
async GetInsigniaById(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionGet(request, "SYS_INSIGNIA_RECORD");
|
||||
const insignia = await this.insigniaRepository.findOne({
|
||||
relations: ["insigniaType"],
|
||||
select: [
|
||||
|
|
@ -185,7 +187,8 @@ export class InsigniaController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Get()
|
||||
async GetInsignia() {
|
||||
async GetInsignia(@Request() request: RequestWithUser) {
|
||||
await new permission().PermissionList(request, "SYS_INSIGNIA_RECORD");
|
||||
const insigniaAll = await this.insigniaRepository.find({
|
||||
relations: ["insigniaType"],
|
||||
select: [
|
||||
|
|
|
|||
|
|
@ -23,7 +23,8 @@ import HttpError from "../interfaces/http-error";
|
|||
import { Equal, ILike, In, IsNull, Like, Not, Brackets, Between } from "typeorm";
|
||||
import { InsigniaType, CreateInsigniaType, UpdateInsigniaType } from "../entities/InsigniaType";
|
||||
import { Insignia } from "../entities/Insignia";
|
||||
|
||||
import permission from "../interfaces/permission";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
@Route("api/v1/org/insignia/insignia-type")
|
||||
@Tags("InsigniaType")
|
||||
@Security("bearerAuth")
|
||||
|
|
@ -160,7 +161,8 @@ export class InsigniaTypeController extends Controller {
|
|||
* @param {string} id Id ลำดับชั้นเครื่องราชอิสริยาภรณ์
|
||||
*/
|
||||
@Get("{id}")
|
||||
async GetInsigniaTypeById(@Path() id: string) {
|
||||
async GetInsigniaTypeById(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionGet(request, "SYS_INSIGNIA_RECORD");
|
||||
const insigniaType = await this.insigniaTypeRepository.findOne({
|
||||
relations: ["insignias"],
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "lastUpdateFullName", "isActive"],
|
||||
|
|
@ -182,7 +184,8 @@ export class InsigniaTypeController extends Controller {
|
|||
*
|
||||
*/
|
||||
@Get("")
|
||||
async GetInsigniaType() {
|
||||
async GetInsigniaType(@Request() request: RequestWithUser) {
|
||||
await new permission().PermissionList(request, "SYS_INSIGNIA_RECORD");
|
||||
const insigniaTypeAll = await this.insigniaTypeRepository.find({
|
||||
select: ["id", "name", "createdAt", "lastUpdatedAt", "lastUpdateFullName", "isActive"],
|
||||
order: { name: "ASC" },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue