fix: prevent line user id and otp exposes
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 4s
This commit is contained in:
parent
b89c68425c
commit
e59db8c5b8
3 changed files with 52 additions and 1 deletions
|
|
@ -34,6 +34,11 @@ const quotationData = (id: string) =>
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
customerBranch: {
|
customerBranch: {
|
||||||
|
omit: {
|
||||||
|
otpCode: true,
|
||||||
|
otpExpires: true,
|
||||||
|
userId: true,
|
||||||
|
},
|
||||||
include: {
|
include: {
|
||||||
customer: true,
|
customer: true,
|
||||||
businessType: true,
|
businessType: true,
|
||||||
|
|
|
||||||
|
|
@ -238,6 +238,11 @@ export class CustomerBranchController extends Controller {
|
||||||
const [result, total] = await prisma.$transaction([
|
const [result, total] = await prisma.$transaction([
|
||||||
prisma.customerBranch.findMany({
|
prisma.customerBranch.findMany({
|
||||||
orderBy: [{ code: "asc" }, { statusOrder: "asc" }, { createdAt: "asc" }],
|
orderBy: [{ code: "asc" }, { statusOrder: "asc" }, { createdAt: "asc" }],
|
||||||
|
omit: {
|
||||||
|
otpCode: true,
|
||||||
|
otpExpires: true,
|
||||||
|
userId: true,
|
||||||
|
},
|
||||||
include: {
|
include: {
|
||||||
customer: includeCustomer,
|
customer: includeCustomer,
|
||||||
province: true,
|
province: true,
|
||||||
|
|
@ -262,6 +267,11 @@ export class CustomerBranchController extends Controller {
|
||||||
@Security("keycloak")
|
@Security("keycloak")
|
||||||
async getById(@Path() branchId: string) {
|
async getById(@Path() branchId: string) {
|
||||||
const record = await prisma.customerBranch.findFirst({
|
const record = await prisma.customerBranch.findFirst({
|
||||||
|
omit: {
|
||||||
|
otpCode: true,
|
||||||
|
otpExpires: true,
|
||||||
|
userId: true,
|
||||||
|
},
|
||||||
include: {
|
include: {
|
||||||
customer: true,
|
customer: true,
|
||||||
province: true,
|
province: true,
|
||||||
|
|
@ -352,6 +362,11 @@ export class CustomerBranchController extends Controller {
|
||||||
include: branchRelationPermInclude(req.user),
|
include: branchRelationPermInclude(req.user),
|
||||||
},
|
},
|
||||||
branch: {
|
branch: {
|
||||||
|
omit: {
|
||||||
|
otpCode: true,
|
||||||
|
otpExpires: true,
|
||||||
|
userId: true,
|
||||||
|
},
|
||||||
take: 1,
|
take: 1,
|
||||||
orderBy: { createdAt: "asc" },
|
orderBy: { createdAt: "asc" },
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -207,6 +207,11 @@ export class CustomerController extends Controller {
|
||||||
district: true,
|
district: true,
|
||||||
subDistrict: true,
|
subDistrict: true,
|
||||||
},
|
},
|
||||||
|
omit: {
|
||||||
|
otpCode: true,
|
||||||
|
otpExpires: true,
|
||||||
|
userId: true,
|
||||||
|
},
|
||||||
orderBy: [{ statusOrder: "asc" }, { createdAt: "asc" }],
|
orderBy: [{ statusOrder: "asc" }, { createdAt: "asc" }],
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
|
|
@ -215,6 +220,11 @@ export class CustomerController extends Controller {
|
||||||
district: true,
|
district: true,
|
||||||
subDistrict: true,
|
subDistrict: true,
|
||||||
},
|
},
|
||||||
|
omit: {
|
||||||
|
otpCode: true,
|
||||||
|
otpExpires: true,
|
||||||
|
userId: true,
|
||||||
|
},
|
||||||
take: 1,
|
take: 1,
|
||||||
orderBy: { createdAt: "asc" },
|
orderBy: { createdAt: "asc" },
|
||||||
},
|
},
|
||||||
|
|
@ -245,6 +255,11 @@ export class CustomerController extends Controller {
|
||||||
district: true,
|
district: true,
|
||||||
subDistrict: true,
|
subDistrict: true,
|
||||||
},
|
},
|
||||||
|
omit: {
|
||||||
|
otpCode: true,
|
||||||
|
otpExpires: true,
|
||||||
|
userId: true,
|
||||||
|
},
|
||||||
orderBy: { createdAt: "asc" },
|
orderBy: { createdAt: "asc" },
|
||||||
},
|
},
|
||||||
createdBy: true,
|
createdBy: true,
|
||||||
|
|
@ -316,6 +331,11 @@ export class CustomerController extends Controller {
|
||||||
district: true,
|
district: true,
|
||||||
subDistrict: true,
|
subDistrict: true,
|
||||||
},
|
},
|
||||||
|
omit: {
|
||||||
|
otpCode: true,
|
||||||
|
otpExpires: true,
|
||||||
|
userId: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
createdBy: true,
|
createdBy: true,
|
||||||
updatedBy: true,
|
updatedBy: true,
|
||||||
|
|
@ -415,6 +435,11 @@ export class CustomerController extends Controller {
|
||||||
district: true,
|
district: true,
|
||||||
subDistrict: true,
|
subDistrict: true,
|
||||||
},
|
},
|
||||||
|
omit: {
|
||||||
|
otpCode: true,
|
||||||
|
otpExpires: true,
|
||||||
|
userId: true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
createdBy: true,
|
createdBy: true,
|
||||||
updatedBy: true,
|
updatedBy: true,
|
||||||
|
|
@ -453,7 +478,13 @@ export class CustomerController extends Controller {
|
||||||
await deleteFolder(`customer/${customerId}`);
|
await deleteFolder(`customer/${customerId}`);
|
||||||
const data = await tx.customer.delete({
|
const data = await tx.customer.delete({
|
||||||
include: {
|
include: {
|
||||||
branch: true,
|
branch: {
|
||||||
|
omit: {
|
||||||
|
otpCode: true,
|
||||||
|
otpExpires: true,
|
||||||
|
userId: true,
|
||||||
|
},
|
||||||
|
},
|
||||||
registeredBranch: {
|
registeredBranch: {
|
||||||
include: {
|
include: {
|
||||||
headOffice: true,
|
headOffice: true,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue