Merge branch 'develop'
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s
All checks were successful
Spell Check / Spell Check with Typos (push) Successful in 6s
This commit is contained in:
commit
aac73f334c
8 changed files with 156 additions and 86 deletions
|
|
@ -1,8 +1,4 @@
|
|||
name: Gitea Action
|
||||
|
||||
run-name: Build ${{ github.actor }}
|
||||
|
||||
# Intended for local gitea instance only.
|
||||
name: Deploy Local
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
24
.forgejo/workflows/spellcheck.yaml
Normal file
24
.forgejo/workflows/spellcheck.yaml
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
name: Spell Check
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
|
||||
env:
|
||||
CLICOLOR: 1
|
||||
|
||||
jobs:
|
||||
spelling:
|
||||
name: Spell Check with Typos
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Actions Repository
|
||||
uses: actions/checkout@v4
|
||||
- name: Spell Check Repo
|
||||
uses: crate-ci/typos@v1.29.9
|
||||
with:
|
||||
files: ./src
|
||||
31
.github/workflows/local-build-dev.yaml
vendored
31
.github/workflows/local-build-dev.yaml
vendored
|
|
@ -1,31 +0,0 @@
|
|||
name: local-build-dev
|
||||
|
||||
# Intended for local network use.
|
||||
# Remote access is possible if the host has a public IP address.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: ${{ vars.DOCKER_REGISTRY }}
|
||||
|
||||
jobs:
|
||||
local-build-dev:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Setup Docker Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
with:
|
||||
config-inline: |
|
||||
[registry."${{ env.REGISTRY }}"]
|
||||
http = true
|
||||
insecure = true
|
||||
- name: Build and Push Docker Image
|
||||
uses: docker/build-push-action@v3
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: ${{ env.REGISTRY }}/jws/jws-backend:dev
|
||||
allow: security.insecure
|
||||
2
.typos.toml
Normal file
2
.typos.toml
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
[default]
|
||||
extend-ignore-re = ["(?Rm)^.*(#|//)\\s*spellchecker:disable-line$"]
|
||||
|
|
@ -341,7 +341,7 @@ function nationality(text: string, lang: "th" | "en" = "en") {
|
|||
case "th":
|
||||
return (
|
||||
{
|
||||
["THA"]: "ไทย",
|
||||
["THA"]: "ไทย", // spellchecker:disable-line
|
||||
["MMR"]: "เมียนมา",
|
||||
["LAO"]: "ลาว",
|
||||
["KHM"]: "กัมพูชา",
|
||||
|
|
@ -353,7 +353,7 @@ function nationality(text: string, lang: "th" | "en" = "en") {
|
|||
default:
|
||||
return (
|
||||
{
|
||||
["THA"]: "Thai",
|
||||
["THA"]: "Thai", // spellchecker:disable-line
|
||||
["MMR"]: "Myanmar",
|
||||
["LAO"]: "Laos",
|
||||
["KHM"]: "Khmer",
|
||||
|
|
|
|||
|
|
@ -536,7 +536,7 @@ export class CreditNoteController extends Controller {
|
|||
if (record.creditNoteStatus !== CreditNoteStatus.Waiting) {
|
||||
throw new HttpError(
|
||||
HttpStatus.BAD_REQUEST,
|
||||
"Accpeted credit note cannot be deleted",
|
||||
"Accepted credit note cannot be deleted",
|
||||
"creditNoteAcceptedNoDelete",
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -73,7 +73,14 @@ export class LineController extends Controller {
|
|||
status: activeOnly ? { not: Status.INACTIVE } : undefined,
|
||||
id: customerBranchId,
|
||||
customerId,
|
||||
userId: line.user.sub,
|
||||
OR: [
|
||||
{ userId: line.user.sub },
|
||||
{
|
||||
customer: {
|
||||
branch: { some: { userId: line.user.sub } },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
subDistrict: zipCode ? { zipCode } : undefined,
|
||||
gender,
|
||||
|
|
@ -135,7 +142,14 @@ export class LineController extends Controller {
|
|||
where: {
|
||||
id: employeeId,
|
||||
customerBranch: {
|
||||
userId: line.user.sub,
|
||||
OR: [
|
||||
{ userId: line.user.sub },
|
||||
{
|
||||
customer: {
|
||||
branch: { some: { userId: line.user.sub } },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
@ -220,7 +234,16 @@ export class LineController extends Controller {
|
|||
// registeredBranch: { OR: permissionCond(req.user) },
|
||||
},
|
||||
employee: {
|
||||
customerBranch: { userId: line.user.sub },
|
||||
customerBranch: {
|
||||
OR: [
|
||||
{ userId: line.user.sub },
|
||||
{
|
||||
customer: {
|
||||
branch: { some: { userId: line.user.sub } },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
} satisfies Prisma.RequestDataWhereInput;
|
||||
|
||||
|
|
@ -282,7 +305,16 @@ export class LineController extends Controller {
|
|||
where: {
|
||||
id: requestDataId,
|
||||
employee: {
|
||||
customerBranch: { userId: line.user.sub },
|
||||
customerBranch: {
|
||||
OR: [
|
||||
{ userId: line.user.sub },
|
||||
{
|
||||
customer: {
|
||||
branch: { some: { userId: line.user.sub } },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
include: {
|
||||
|
|
@ -399,7 +431,16 @@ export class LineController extends Controller {
|
|||
: undefined,
|
||||
quotationId,
|
||||
employee: {
|
||||
customerBranch: { userId: line.user.sub },
|
||||
customerBranch: {
|
||||
OR: [
|
||||
{ userId: line.user.sub },
|
||||
{
|
||||
customer: {
|
||||
branch: { some: { userId: line.user.sub } },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
} satisfies Prisma.RequestWorkWhereInput;
|
||||
|
|
@ -519,7 +560,16 @@ export class LineController extends Controller {
|
|||
id: requestWorkId,
|
||||
request: {
|
||||
employee: {
|
||||
customerBranch: { userId: line.user.sub },
|
||||
customerBranch: {
|
||||
OR: [
|
||||
{ userId: line.user.sub },
|
||||
{
|
||||
customer: {
|
||||
branch: { some: { userId: line.user.sub } },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
@ -546,49 +596,60 @@ export class LineController extends Controller {
|
|||
@Query() status?: QuotationStatus,
|
||||
@Query() pendingOnly?: boolean,
|
||||
@Query() inProgressOnly?: boolean,
|
||||
@Query() historyOnly?: boolean,
|
||||
@Query() successOnly?: boolean,
|
||||
@Query() canceledOnly?: boolean,
|
||||
@Query() urgentFirst?: boolean,
|
||||
@Query() includeRegisteredBranch?: boolean,
|
||||
@Query() code?: string,
|
||||
@Query() query = "",
|
||||
) {
|
||||
const where = {
|
||||
OR: [
|
||||
...(queryOrNot<Prisma.QuotationWhereInput[]>(query, [
|
||||
{ code: { contains: query, mode: "insensitive" } },
|
||||
{ workName: { contains: query } },
|
||||
{
|
||||
customerBranch: {
|
||||
OR: [
|
||||
OR:
|
||||
query || pendingOnly
|
||||
? [
|
||||
...(queryOrNot<Prisma.QuotationWhereInput[]>(query, [
|
||||
{ code: { contains: query, mode: "insensitive" } },
|
||||
{ customerName: { contains: query } },
|
||||
{ firstName: { contains: query } },
|
||||
{ firstNameEN: { contains: query } },
|
||||
{ lastName: { contains: query } },
|
||||
{ lastNameEN: { contains: query } },
|
||||
],
|
||||
},
|
||||
},
|
||||
]) || []),
|
||||
...(queryOrNot<Prisma.QuotationWhereInput[]>(!!pendingOnly, [
|
||||
{
|
||||
requestData: {
|
||||
some: {
|
||||
requestDataStatus: "Pending",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
requestData: { none: {} },
|
||||
},
|
||||
]) || []),
|
||||
],
|
||||
{ workName: { contains: query } },
|
||||
{
|
||||
customerBranch: {
|
||||
OR: [
|
||||
{ code: { contains: query, mode: "insensitive" } },
|
||||
{ customerName: { contains: query } },
|
||||
{ firstName: { contains: query } },
|
||||
{ firstNameEN: { contains: query } },
|
||||
{ lastName: { contains: query } },
|
||||
{ lastNameEN: { contains: query } },
|
||||
],
|
||||
},
|
||||
},
|
||||
]) || []),
|
||||
...(queryOrNot<Prisma.QuotationWhereInput[]>(!!pendingOnly, [
|
||||
{
|
||||
requestData: {
|
||||
some: {
|
||||
requestDataStatus: "Pending",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
requestData: { none: {} },
|
||||
},
|
||||
]) || []),
|
||||
]
|
||||
: undefined,
|
||||
isDebitNote: false,
|
||||
code,
|
||||
payCondition,
|
||||
quotationStatus: historyOnly ? { in: ["ProcessComplete", "Canceled"] } : status,
|
||||
quotationStatus: successOnly ? "ProcessComplete" : canceledOnly ? "Canceled" : status,
|
||||
customerBranch: {
|
||||
userId: line.user.sub,
|
||||
OR: [
|
||||
{ userId: line.user.sub },
|
||||
{
|
||||
customer: {
|
||||
branch: { some: { userId: line.user.sub } },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
requestData: inProgressOnly
|
||||
? {
|
||||
|
|
@ -698,7 +759,16 @@ export class LineController extends Controller {
|
|||
where: {
|
||||
id: quotationId,
|
||||
isDebitNote: false,
|
||||
customerBranch: { userId: line.user.sub },
|
||||
customerBranch: {
|
||||
OR: [
|
||||
{ userId: line.user.sub },
|
||||
{
|
||||
customer: {
|
||||
branch: { some: { userId: line.user.sub } },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ import { RequestWithLineUser } from "../interfaces/user";
|
|||
import HttpError from "../interfaces/http-error";
|
||||
import HttpStatus from "../interfaces/http-status";
|
||||
|
||||
type SendEmail = {
|
||||
type SendOTP = {
|
||||
identityNumber: string;
|
||||
email: string;
|
||||
};
|
||||
|
|
@ -25,11 +25,22 @@ export class verificationController extends Controller {
|
|||
@Get()
|
||||
@Security("line")
|
||||
async isRegistered(@Request() req: RequestWithLineUser) {
|
||||
return !!(await prisma.customerBranch.findFirst({ where: { userId: req.user.sub } }));
|
||||
return !!(await prisma.customerBranch.findFirst({
|
||||
where: {
|
||||
OR: [
|
||||
{ userId: req.user.sub },
|
||||
{
|
||||
customer: {
|
||||
branch: { some: { userId: req.user.sub } },
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
}));
|
||||
}
|
||||
|
||||
@Post("/send-otp")
|
||||
public async sendOTP(@Body() body: SendEmail) {
|
||||
public async sendOTP(@Body() body: SendOTP) {
|
||||
if (
|
||||
![
|
||||
process.env.SMTP_HOST,
|
||||
|
|
@ -133,13 +144,11 @@ export class verificationController extends Controller {
|
|||
customerBranch.otpExpires &&
|
||||
customerBranch.otpExpires >= new Date()
|
||||
) {
|
||||
const dataCustomer = await prisma.customerBranch.update({
|
||||
const dataCustomer = await prisma.customerBranch.updateMany({
|
||||
where: {
|
||||
id: customerBranch.id,
|
||||
},
|
||||
data: {
|
||||
userId: req.user.sub,
|
||||
customerId: customerBranch.customerId,
|
||||
},
|
||||
data: { userId: req.user.sub },
|
||||
});
|
||||
|
||||
return dataCustomer;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue