refactor: remove unused role
This commit is contained in:
parent
c5600add96
commit
0c80d8fbdb
10 changed files with 11 additions and 62 deletions
|
|
@ -24,15 +24,7 @@ if (!process.env.MINIO_BUCKET) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const MINIO_BUCKET = process.env.MINIO_BUCKET;
|
const MINIO_BUCKET = process.env.MINIO_BUCKET;
|
||||||
const MANAGE_ROLES = [
|
const MANAGE_ROLES = ["system", "head_of_admin", "admin", "branch_manager", "head_of_sale", "sale"];
|
||||||
"system",
|
|
||||||
"head_of_admin",
|
|
||||||
"admin",
|
|
||||||
"branch_admin",
|
|
||||||
"branch_manager",
|
|
||||||
"head_of_sale",
|
|
||||||
"sale",
|
|
||||||
];
|
|
||||||
|
|
||||||
function imageLocation(id: string) {
|
function imageLocation(id: string) {
|
||||||
return `employee/profile-img-${id}`;
|
return `employee/profile-img-${id}`;
|
||||||
|
|
|
||||||
|
|
@ -24,15 +24,7 @@ if (!process.env.MINIO_BUCKET) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const MINIO_BUCKET = process.env.MINIO_BUCKET;
|
const MINIO_BUCKET = process.env.MINIO_BUCKET;
|
||||||
const MANAGE_ROLES = [
|
const MANAGE_ROLES = ["system", "head_of_admin", "admin", "branch_manager", "head_of_sale", "sale"];
|
||||||
"system",
|
|
||||||
"head_of_admin",
|
|
||||||
"admin",
|
|
||||||
"branch_admin",
|
|
||||||
"branch_manager",
|
|
||||||
"head_of_sale",
|
|
||||||
"sale",
|
|
||||||
];
|
|
||||||
|
|
||||||
export type CustomerCreate = {
|
export type CustomerCreate = {
|
||||||
registeredBranchId?: string;
|
registeredBranchId?: string;
|
||||||
|
|
|
||||||
|
|
@ -16,15 +16,7 @@ import prisma from "../db";
|
||||||
import HttpStatus from "../interfaces/http-status";
|
import HttpStatus from "../interfaces/http-status";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
|
|
||||||
const MANAGE_ROLES = [
|
const MANAGE_ROLES = ["system", "head_of_admin", "admin", "branch_manager", "head_of_sale", "sale"];
|
||||||
"system",
|
|
||||||
"head_of_admin",
|
|
||||||
"admin",
|
|
||||||
"branch_admin",
|
|
||||||
"branch_manager",
|
|
||||||
"head_of_sale",
|
|
||||||
"sale",
|
|
||||||
];
|
|
||||||
|
|
||||||
type EmployeeCheckupPayload = {
|
type EmployeeCheckupPayload = {
|
||||||
checkupType?: string | null;
|
checkupType?: string | null;
|
||||||
|
|
|
||||||
|
|
@ -24,15 +24,7 @@ if (!process.env.MINIO_BUCKET) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const MINIO_BUCKET = process.env.MINIO_BUCKET;
|
const MINIO_BUCKET = process.env.MINIO_BUCKET;
|
||||||
const MANAGE_ROLES = [
|
const MANAGE_ROLES = ["system", "head_of_admin", "admin", "branch_manager", "head_of_sale", "sale"];
|
||||||
"system",
|
|
||||||
"head_of_admin",
|
|
||||||
"admin",
|
|
||||||
"branch_admin",
|
|
||||||
"branch_manager",
|
|
||||||
"head_of_sale",
|
|
||||||
"sale",
|
|
||||||
];
|
|
||||||
|
|
||||||
function imageLocation(id: string) {
|
function imageLocation(id: string) {
|
||||||
return `employee/${id}/profile-image`;
|
return `employee/${id}/profile-image`;
|
||||||
|
|
|
||||||
|
|
@ -17,15 +17,7 @@ import HttpError from "../interfaces/http-error";
|
||||||
import HttpStatus from "../interfaces/http-status";
|
import HttpStatus from "../interfaces/http-status";
|
||||||
import { RequestWithUser } from "../interfaces/user";
|
import { RequestWithUser } from "../interfaces/user";
|
||||||
|
|
||||||
const MANAGE_ROLES = [
|
const MANAGE_ROLES = ["system", "head_of_admin", "admin", "branch_manager", "head_of_sale", "sale"];
|
||||||
"system",
|
|
||||||
"head_of_admin",
|
|
||||||
"admin",
|
|
||||||
"branch_admin",
|
|
||||||
"branch_manager",
|
|
||||||
"head_of_sale",
|
|
||||||
"sale",
|
|
||||||
];
|
|
||||||
|
|
||||||
type EmployeeOtherInfoPayload = {
|
type EmployeeOtherInfoPayload = {
|
||||||
citizenId?: string | null;
|
citizenId?: string | null;
|
||||||
|
|
|
||||||
|
|
@ -16,15 +16,7 @@ import prisma from "../db";
|
||||||
import HttpStatus from "../interfaces/http-status";
|
import HttpStatus from "../interfaces/http-status";
|
||||||
import HttpError from "../interfaces/http-error";
|
import HttpError from "../interfaces/http-error";
|
||||||
|
|
||||||
const MANAGE_ROLES = [
|
const MANAGE_ROLES = ["system", "head_of_admin", "admin", "branch_manager", "head_of_sale", "sale"];
|
||||||
"system",
|
|
||||||
"head_of_admin",
|
|
||||||
"admin",
|
|
||||||
"branch_admin",
|
|
||||||
"branch_manager",
|
|
||||||
"head_of_sale",
|
|
||||||
"sale",
|
|
||||||
];
|
|
||||||
|
|
||||||
type EmployeeWorkPayload = {
|
type EmployeeWorkPayload = {
|
||||||
ownerName?: string | null;
|
ownerName?: string | null;
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ const MANAGE_ROLES = [
|
||||||
"system",
|
"system",
|
||||||
"head_of_admin",
|
"head_of_admin",
|
||||||
"admin",
|
"admin",
|
||||||
"branch_admin",
|
|
||||||
"branch_manager",
|
"branch_manager",
|
||||||
"head_of_account",
|
"head_of_account",
|
||||||
"account",
|
"account",
|
||||||
|
|
@ -87,8 +86,8 @@ function imageLocation(id: string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function globalAllow(roles?: string[]) {
|
function globalAllow(roles?: string[]) {
|
||||||
return ["system", "head_of_admin", "admin", "branch_admin", "branch_manager", "head_of_account"].some(
|
return ["system", "head_of_admin", "admin", "branch_manager", "head_of_account"].some((v) =>
|
||||||
(v) => roles?.includes(v),
|
roles?.includes(v),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -161,15 +161,14 @@ const MANAGE_ROLES = [
|
||||||
"system",
|
"system",
|
||||||
"head_of_admin",
|
"head_of_admin",
|
||||||
"admin",
|
"admin",
|
||||||
"branch_admin",
|
|
||||||
"branch_manager",
|
"branch_manager",
|
||||||
"head_of_account",
|
"head_of_account",
|
||||||
"account",
|
"account",
|
||||||
];
|
];
|
||||||
|
|
||||||
function globalAllow(roles?: string[]) {
|
function globalAllow(roles?: string[]) {
|
||||||
return ["system", "head_of_admin", "admin", "branch_admin", "branch_manager", "head_of_account"].some(
|
return ["system", "head_of_admin", "admin", "branch_manager", "head_of_account"].some((v) =>
|
||||||
(v) => roles?.includes(v),
|
roles?.includes(v),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,6 @@ const MANAGE_ROLES = [
|
||||||
"system",
|
"system",
|
||||||
"head_of_admin",
|
"head_of_admin",
|
||||||
"admin",
|
"admin",
|
||||||
"branch_admin",
|
|
||||||
"branch_manager",
|
"branch_manager",
|
||||||
"head_of_account",
|
"head_of_account",
|
||||||
"account",
|
"account",
|
||||||
|
|
|
||||||
|
|
@ -724,7 +724,7 @@ export class UserController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Put("{userId}/image")
|
@Put("{userId}/image")
|
||||||
@Security("keycloak", ["system", "head_of_admin", "admin", "branch_admin", "branch_manager"])
|
@Security("keycloak", ["system", "head_of_admin", "admin", "branch_manager"])
|
||||||
async setUserImageByUserId(@Request() req: RequestWithUser, @Path() userId: string) {
|
async setUserImageByUserId(@Request() req: RequestWithUser, @Path() userId: string) {
|
||||||
const record = await prisma.user.findFirst({
|
const record = await prisma.user.findFirst({
|
||||||
include: {
|
include: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue