Compare commits
11 Commits
develop/mo
...
develop/re
Author | SHA1 | Date | |
---|---|---|---|
![]() |
87ccb2f1ff | ||
![]() |
46f784d587 | ||
![]() |
66b9bf5bdd | ||
![]() |
35b1cd1eba | ||
![]() |
4de7a564e3 | ||
![]() |
08d6727dca | ||
![]() |
d767108fcf | ||
![]() |
5ff3393f54 | ||
![]() |
5a531e1288 | ||
![]() |
5b7cf25753 | ||
![]() |
19b2357771 |
9
01_Requirements/REQ0181/index.md
Normal file
9
01_Requirements/REQ0181/index.md
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
tags: frontend, side-menu
|
||||
---
|
||||
|
||||
# REQ0181 frontend side menu configuration
|
||||
|
||||
## sources
|
||||
|
||||
`src/layouts/nav-config-dashboard.tsx`
|
11
01_Requirements/REQ0182/index.md
Normal file
11
01_Requirements/REQ0182/index.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
tags: frontend, product, details
|
||||
---
|
||||
|
||||
# REQ0182 frontend product details
|
||||
|
||||
frontend page to display product details
|
||||
|
||||
## sources
|
||||
|
||||
T.B.A.
|
11
01_Requirements/REQ0183/index.md
Normal file
11
01_Requirements/REQ0183/index.md
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
tags: frontend, product, new
|
||||
---
|
||||
|
||||
# REQ0182 frontend product new
|
||||
|
||||
frontend page to create new product
|
||||
|
||||
## sources
|
||||
|
||||
T.B.A.
|
@@ -158,3 +158,5 @@
|
||||
- [REQ0169: DemoStorageExample](./REQ0169/index.md)
|
||||
- [REQ0170: DemoWeatherAppUi](./REQ0170/index.md)
|
||||
- [REQ0180: REQ0180 service port schedule](./REQ0180/index.md)
|
||||
- [REQ0181: REQ0181 frontend side menu configuration](./REQ0181/index.md)
|
||||
- [REQ0182: REQ0182 frontend product details](./REQ0182/index.md)
|
||||
|
@@ -43,6 +43,7 @@
|
||||
"@next-auth/prisma-adapter": "^1.0.7",
|
||||
"@prisma/adapter-pg": "^6.8.2",
|
||||
"@prisma/client": "^5.6.0",
|
||||
"@types/bcrypt": "^5.0.2",
|
||||
"bcrypt": "^5.1.1",
|
||||
"date-fns": "^4.1.0",
|
||||
"dayjs": "^1.11.13",
|
||||
|
@@ -1144,6 +1144,7 @@ model EventReview {
|
||||
eventItemId String?
|
||||
}
|
||||
|
||||
// NOTE: need to consider with Event
|
||||
// mapped to IEventItem
|
||||
model EventItem {
|
||||
id String @id @default(uuid())
|
||||
|
12
03_source/cms_backend/scripts/10_build.sh
Executable file
12
03_source/cms_backend/scripts/10_build.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -x
|
||||
|
||||
yarn db:push
|
||||
|
||||
npx nodemon --ext ts,tsx --exec "yarn tsc"
|
||||
|
||||
|
||||
|
||||
# yarn build
|
||||
|
5
03_source/cms_backend/scripts/20_prod.sh
Executable file
5
03_source/cms_backend/scripts/20_prod.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -x
|
||||
|
||||
npm run start
|
@@ -10,7 +10,8 @@ import type { NextRequest } from 'next/server';
|
||||
|
||||
import { STATUS, response, handleError } from 'src/utils/response';
|
||||
|
||||
import { AccessLogService } from '../../../../modules/AccessLog/AccessLog.service';
|
||||
// import { AccessLogService } from '../../../../modules/AccessLog/AccessLog.service';
|
||||
import { getAccessLogById } from 'src/app/services/AccessLog.service';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
@@ -27,7 +28,7 @@ export async function GET(req: NextRequest) {
|
||||
const accessLogId = searchParams.get('accessLogId');
|
||||
if (!accessLogId) return response({ message: 'accessLogId is required!' }, STATUS.BAD_REQUEST);
|
||||
|
||||
const accessLog = await AccessLogService.findById(accessLogId);
|
||||
const accessLog = await getAccessLogById(accessLogId);
|
||||
|
||||
if (!accessLog) return response({ message: 'AccessLog not found!' }, STATUS.NOT_FOUND);
|
||||
|
||||
|
@@ -2,7 +2,7 @@ import type { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
import { STATUS, response, handleError } from 'src/utils/response';
|
||||
|
||||
import { listAppLogs, deleteAppLog, updateAppLog, createNewAppLog } from 'src/app/services/AppLog.service';
|
||||
import { listAppLogs, deleteAppLog, createNewAppLog } from 'src/app/services/AppLog.service';
|
||||
|
||||
// import prisma from '../../lib/prisma';
|
||||
|
||||
@@ -34,28 +34,29 @@ export async function POST(req: NextRequest) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
***************************************
|
||||
* PUT - update AppLog
|
||||
***************************************
|
||||
*/
|
||||
export async function PUT(req: NextRequest) {
|
||||
const { searchParams } = req.nextUrl;
|
||||
const appLogId = searchParams.get('appLogId');
|
||||
// TODO: delete `update AppLog`
|
||||
// /**
|
||||
// ***************************************
|
||||
// * PUT - update AppLog
|
||||
// ***************************************
|
||||
// */
|
||||
// export async function PUT(req: NextRequest) {
|
||||
// const { searchParams } = req.nextUrl;
|
||||
// const appLogId = searchParams.get('appLogId');
|
||||
|
||||
const { data } = await req.json();
|
||||
// const { data } = await req.json();
|
||||
|
||||
try {
|
||||
if (!appLogId) throw new Error('appLogId cannot null');
|
||||
const id: number = parseInt(appLogId);
|
||||
// try {
|
||||
// if (!appLogId) throw new Error('appLogId cannot null');
|
||||
// const id: number = parseInt(appLogId);
|
||||
|
||||
const updateResult = await updateAppLog(id, data);
|
||||
// const updateResult = await updateAppLog(id, data);
|
||||
|
||||
return response(updateResult, STATUS.OK);
|
||||
} catch (error) {
|
||||
return handleError('AppLog - Update', error);
|
||||
}
|
||||
}
|
||||
// return response(updateResult, STATUS.OK);
|
||||
// } catch (error) {
|
||||
// return handleError('AppLog - Update', error);
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
***************************************
|
||||
@@ -72,7 +73,7 @@ export async function DELETE(req: NextRequest) {
|
||||
if (!appLogId) throw new Error('appLogId cannot null');
|
||||
const id: number = parseInt(appLogId);
|
||||
|
||||
const deleteResult = await deleteAppLog(id);
|
||||
const deleteResult = await deleteAppLog(id.toString());
|
||||
|
||||
return response(deleteResult, STATUS.OK);
|
||||
} catch (error) {
|
||||
|
@@ -7,29 +7,28 @@ import { _events } from 'src/_mock/_event';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export const runtime = 'edge';
|
||||
// export const runtime = 'edge';
|
||||
|
||||
/** **************************************
|
||||
* GET - Search events
|
||||
*************************************** */
|
||||
export async function GET(req: NextRequest) {
|
||||
try {
|
||||
const { searchParams } = req.nextUrl;
|
||||
const query = searchParams.get('query')?.trim().toLowerCase();
|
||||
// try {
|
||||
//
|
||||
// TODO: implement search events
|
||||
//
|
||||
// const { searchParams } = req.nextUrl;
|
||||
// const query = searchParams.get('query')?.trim().toLowerCase();
|
||||
// if (!query) {
|
||||
// return response({ results: [] }, STATUS.OK);
|
||||
// }
|
||||
// const events = _events();
|
||||
// // Accept search by name or sku
|
||||
// const results = events.filter(({ name, sku }) => name.toLowerCase().includes(query) || sku?.toLowerCase().includes(query));
|
||||
// logger('[Event] search-results', results.length);
|
||||
// return response({ results }, STATUS.OK);
|
||||
|
||||
if (!query) {
|
||||
return response({ results: [] }, STATUS.OK);
|
||||
}
|
||||
|
||||
const events = _events();
|
||||
|
||||
// Accept search by name or sku
|
||||
const results = events.filter(({ name, sku }) => name.toLowerCase().includes(query) || sku?.toLowerCase().includes(query));
|
||||
|
||||
logger('[Event] search-results', results.length);
|
||||
|
||||
return response({ results }, STATUS.OK);
|
||||
} catch (error) {
|
||||
return handleError('Event - Get search', error);
|
||||
}
|
||||
// } catch (error) {
|
||||
return handleError('Event - Get search not implemented', {});
|
||||
// }
|
||||
}
|
||||
|
@@ -28,7 +28,7 @@ export async function POST(req: NextRequest) {
|
||||
|
||||
try {
|
||||
const order = await createOrder(data);
|
||||
return response(order, STATUS.CREATED);
|
||||
return response(order, STATUS.OK);
|
||||
} catch (error) {
|
||||
return handleError('Order - Create', error);
|
||||
}
|
||||
@@ -48,7 +48,7 @@ export async function PUT(req: NextRequest) {
|
||||
if (!orderId) throw new Error('orderId cannot be null');
|
||||
const id: number = parseInt(orderId);
|
||||
|
||||
const updatedOrder = await updateOrder(id, data);
|
||||
const updatedOrder = await updateOrder(id.toString(), data);
|
||||
return response(updatedOrder, STATUS.OK);
|
||||
} catch (error) {
|
||||
return handleError('Order - Update', error);
|
||||
@@ -68,7 +68,7 @@ export async function DELETE(req: NextRequest) {
|
||||
if (!orderId) throw new Error('orderId cannot be null');
|
||||
const id: number = parseInt(orderId);
|
||||
|
||||
await deleteOrder(id);
|
||||
await deleteOrder(id.toString());
|
||||
return response({ success: true }, STATUS.OK);
|
||||
} catch (error) {
|
||||
return handleError('Order - Delete', error);
|
||||
|
@@ -24,13 +24,14 @@ export async function GET(req: NextRequest, res: NextResponse) {
|
||||
***************************************
|
||||
*/
|
||||
export async function POST(req: NextRequest) {
|
||||
const OPERATION = 'Product - Create';
|
||||
const { data } = await req.json();
|
||||
|
||||
try {
|
||||
const product = await createProduct(data);
|
||||
return response(product, STATUS.CREATED);
|
||||
return response(OPERATION, STATUS.OK);
|
||||
} catch (error) {
|
||||
return handleError('Product - Create', error);
|
||||
return handleError(OPERATION, error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import prisma from '@/lib/prisma';
|
||||
import { NextResponse } from 'next/server';
|
||||
|
||||
import prisma from 'src/app/lib/prisma';
|
||||
|
||||
// GET: 获取所有学生
|
||||
export async function GET() {
|
||||
try {
|
||||
|
@@ -14,8 +14,8 @@ export async function GET(req: NextRequest, res: NextResponse) {
|
||||
if (!userId) throw new Error('userId cannot be null');
|
||||
const result = await isAdmin(userId);
|
||||
|
||||
return response(result, STATUS.OK);
|
||||
return response(result ? 'true' : 'false', STATUS.OK);
|
||||
} catch (error) {
|
||||
return handleError('Post - Get latest', error);
|
||||
return handleError('GET - checkAdmin', error);
|
||||
}
|
||||
}
|
||||
|
@@ -14,8 +14,8 @@ export async function GET(req: NextRequest, res: NextResponse) {
|
||||
if (!userId) throw new Error('userId cannot be null');
|
||||
const result = await isAdmin(userId);
|
||||
|
||||
return response(result, STATUS.OK);
|
||||
return response('GET - helloworld', STATUS.OK);
|
||||
} catch (error) {
|
||||
return handleError('Post - Get latest', error);
|
||||
return handleError('GET - helloworld', error);
|
||||
}
|
||||
}
|
||||
|
@@ -22,14 +22,17 @@ export async function GET(req: NextRequest, res: NextResponse) {
|
||||
***************************************
|
||||
*/
|
||||
export async function POST(req: NextRequest) {
|
||||
const OPERATION = 'User - Create';
|
||||
const { data } = await req.json();
|
||||
|
||||
try {
|
||||
const createResult = await createNewUser(data);
|
||||
// TODO: temporary ignore output from function due to `createNewUser` is still a dummy
|
||||
// const createResult = await createNewUser(data);
|
||||
await createNewUser(data);
|
||||
|
||||
return response(createResult, STATUS.OK);
|
||||
return response(OPERATION, STATUS.OK);
|
||||
} catch (error) {
|
||||
return handleError('User - Create', error);
|
||||
return handleError(OPERATION, error);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +51,7 @@ export async function PUT(req: NextRequest) {
|
||||
if (!userId) throw new Error('userId cannot null');
|
||||
const id: number = parseInt(userId);
|
||||
|
||||
const updateResult = await updateUser(id, data);
|
||||
const updateResult = await updateUser(id.toString(), data);
|
||||
|
||||
return response(updateResult, STATUS.OK);
|
||||
} catch (error) {
|
||||
@@ -71,10 +74,10 @@ export async function DELETE(req: NextRequest) {
|
||||
if (!userId) throw new Error('userId cannot null');
|
||||
const id: number = parseInt(userId);
|
||||
|
||||
const deleteResult = await deleteUser(id);
|
||||
await deleteUser(id);
|
||||
|
||||
return response(deleteResult, STATUS.OK);
|
||||
return response('User - Delete', STATUS.OK);
|
||||
} catch (error) {
|
||||
return handleError('User - Update', error);
|
||||
return handleError('User - Delete', error);
|
||||
}
|
||||
}
|
||||
|
@@ -30,10 +30,15 @@ async function listAccessLogs(): Promise<AccessLog[]> {
|
||||
});
|
||||
}
|
||||
|
||||
// TODO: obsoleted getAccessLog, use getAccessLogById instead
|
||||
async function getAccessLog(id: string): Promise<AccessLog | null> {
|
||||
return prisma.accessLog.findUnique({ where: { id } });
|
||||
}
|
||||
|
||||
async function getAccessLogById(id: string): Promise<AccessLog | null> {
|
||||
return prisma.accessLog.findUnique({ where: { id } });
|
||||
}
|
||||
|
||||
async function createAccessLog(userId?: string, message?: string, metadata?: Record<string, any>): Promise<AccessLog> {
|
||||
return prisma.accessLog.create({
|
||||
data: {
|
||||
@@ -44,6 +49,10 @@ async function createAccessLog(userId?: string, message?: string, metadata?: Rec
|
||||
});
|
||||
}
|
||||
|
||||
function helloworld(): string {
|
||||
return 'helloworld';
|
||||
}
|
||||
|
||||
// async function update(id: string, data: UpdateAccessLog): Promise<AccessLog> {
|
||||
// return prisma.accessLog.update({
|
||||
// where: { id },
|
||||
@@ -63,4 +72,7 @@ export {
|
||||
getAccessLog,
|
||||
listAccessLogs,
|
||||
createAccessLog,
|
||||
getAccessLogById,
|
||||
//
|
||||
helloworld,
|
||||
};
|
||||
|
@@ -6,11 +6,14 @@
|
||||
// RULES:
|
||||
// - Follows same pattern as helloworld.service.ts
|
||||
//
|
||||
import type { Event } from '@prisma/client';
|
||||
|
||||
import prisma from '../lib/prisma';
|
||||
|
||||
type CreateEvent = {
|
||||
eventDate: DateTime;
|
||||
eventDate: Date;
|
||||
title: string;
|
||||
joinMembers?: Json[];
|
||||
joinMembers?: JSON[];
|
||||
price: number;
|
||||
currency: string;
|
||||
duration_m: number;
|
||||
@@ -22,9 +25,9 @@ type CreateEvent = {
|
||||
};
|
||||
|
||||
type UpdateEvent = {
|
||||
eventDate?: DateTime;
|
||||
eventDate?: Date;
|
||||
title?: string;
|
||||
joinMembers?: Json[];
|
||||
joinMembers?: JSON[];
|
||||
price?: number;
|
||||
currency?: string;
|
||||
duration_m?: number;
|
||||
@@ -35,9 +38,9 @@ type UpdateEvent = {
|
||||
memberId?: number;
|
||||
};
|
||||
|
||||
// async function listEvents(): Promise<Event[]> {
|
||||
// return prisma.event.findMany();
|
||||
// }
|
||||
async function listEvents(): Promise<Event[]> {
|
||||
return prisma.event.findMany();
|
||||
}
|
||||
|
||||
// async function getEvent(eventId: number) {
|
||||
// return prisma.event.findFirst({ where: { id: eventId } });
|
||||
|
@@ -12,9 +12,9 @@ import type { EventItem } from '@prisma/client';
|
||||
import prisma from '../lib/prisma';
|
||||
|
||||
type CreateEvent = {
|
||||
eventDate: DateTime;
|
||||
eventDate: Date;
|
||||
title: string;
|
||||
joinMembers?: Json[];
|
||||
joinMembers?: JSON[];
|
||||
price: number;
|
||||
currency: string;
|
||||
duration_m: number;
|
||||
@@ -26,9 +26,9 @@ type CreateEvent = {
|
||||
};
|
||||
|
||||
type UpdateEvent = {
|
||||
eventDate?: DateTime;
|
||||
eventDate?: Date;
|
||||
title?: string;
|
||||
joinMembers?: Json[];
|
||||
joinMembers?: JSON[];
|
||||
price?: number;
|
||||
currency?: string;
|
||||
duration_m?: number;
|
||||
|
@@ -11,9 +11,24 @@ import type { OrderItem } from '@prisma/client';
|
||||
import prisma from '../lib/prisma';
|
||||
|
||||
type CreateOrderItem = {
|
||||
orderNumber?: string;
|
||||
// orderNumber?: string;
|
||||
// status?: string;
|
||||
// eventIds?: number[];
|
||||
|
||||
taxes: number;
|
||||
status: string;
|
||||
shipping: number;
|
||||
discount: number;
|
||||
subtotal: number;
|
||||
orderNumber: string;
|
||||
totalAmount: number;
|
||||
totalQuantity: number;
|
||||
history: Record<string, any>;
|
||||
payment: Record<string, any>;
|
||||
customer: Record<string, any>;
|
||||
delivery: Record<string, any>;
|
||||
items: Record<string, any>[];
|
||||
shippingAddress: Record<string, any>;
|
||||
};
|
||||
|
||||
type UpdateOrderItem = {
|
||||
|
@@ -38,7 +38,7 @@ async function getUserItem(userId: string): Promise<UserItem | null> {
|
||||
return prisma.userItem.findFirst({ where: { id: userId } });
|
||||
}
|
||||
|
||||
async function updateUser(userId: string, updateForm: UpdateUser): Promise<User> {
|
||||
async function updateUser(userId: string, updateForm: UpdateUser): Promise<UserItem> {
|
||||
return prisma.userItem.update({
|
||||
where: { id: userId },
|
||||
data: updateForm,
|
||||
@@ -82,7 +82,7 @@ async function changeToUser(userIdToPromote: string, userIdOfApplicant: string)
|
||||
return promoteResult;
|
||||
}
|
||||
|
||||
async function getUserById1(id: string): Promise<UserItem | null> {
|
||||
async function getUserById(id: string): Promise<UserItem | null> {
|
||||
return prisma.userItem.findFirst({ where: { id } });
|
||||
}
|
||||
|
||||
|
@@ -43,7 +43,8 @@
|
||||
"**/*.draft",
|
||||
"**/*.log",
|
||||
"**/*.tmp",
|
||||
"**/*del"
|
||||
"**/*del",
|
||||
"prisma/*"
|
||||
],
|
||||
"include": [
|
||||
"next-env.d.ts",
|
||||
|
@@ -770,6 +770,13 @@
|
||||
dependencies:
|
||||
tslib "^2.4.0"
|
||||
|
||||
"@types/bcrypt@^5.0.2":
|
||||
version "5.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@types/bcrypt/-/bcrypt-5.0.2.tgz#22fddc11945ea4fbc3655b3e8b8847cc9f811477"
|
||||
integrity sha512-6atioO8Y75fNcbmj0G7UjI9lXN2pQ/IGJ2FWT4a/btd0Lk9lQalHLKhkgKVZ3r+spnmWUKfbMi1GEe9wyHQfNQ==
|
||||
dependencies:
|
||||
"@types/node" "*"
|
||||
|
||||
"@types/estree@^1.0.6":
|
||||
version "1.0.7"
|
||||
resolved "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz"
|
||||
@@ -790,6 +797,13 @@
|
||||
resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.17.17.tgz#fb85a04f47e9e4da888384feead0de05f7070355"
|
||||
integrity sha512-RRVJ+J3J+WmyOTqnz3PiBLA501eKwXl2noseKOrNo/6+XEHjTAxO4xHvxQB6QuNm+s4WRbn6rSiap8+EA+ykFQ==
|
||||
|
||||
"@types/node@*":
|
||||
version "24.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@types/node/-/node-24.0.1.tgz#e9bfcb1c35547437c294403b7bec497772a88b0a"
|
||||
integrity sha512-MX4Zioh39chHlDJbKmEgydJDS3tspMP/lnQC67G3SWsTnb9NeYVWOjkxpOSy4oMfPs4StcWHwBrvUb4ybfnuaw==
|
||||
dependencies:
|
||||
undici-types "~7.8.0"
|
||||
|
||||
"@types/node@^22.13.13":
|
||||
version "22.13.13"
|
||||
resolved "https://registry.npmjs.org/@types/node/-/node-22.13.13.tgz"
|
||||
@@ -3486,6 +3500,11 @@ undici-types@~6.20.0:
|
||||
resolved "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz"
|
||||
integrity sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==
|
||||
|
||||
undici-types@~7.8.0:
|
||||
version "7.8.0"
|
||||
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-7.8.0.tgz#de00b85b710c54122e44fbfd911f8d70174cd294"
|
||||
integrity sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw==
|
||||
|
||||
unique-names-generator@^4.7.1:
|
||||
version "4.7.1"
|
||||
resolved "https://registry.yarnpkg.com/unique-names-generator/-/unique-names-generator-4.7.1.tgz#966407b12ba97f618928f77322cfac8c80df5597"
|
||||
|
@@ -1,14 +1,23 @@
|
||||
#
|
||||
# REQ0180 service port schedule
|
||||
#
|
||||
services:
|
||||
frontend:
|
||||
command: 'sleep infinity'
|
||||
command: "sleep infinity"
|
||||
ports:
|
||||
- 8080:8080
|
||||
|
||||
mobile:
|
||||
command: 'sleep infinity'
|
||||
command: "sleep infinity"
|
||||
ports:
|
||||
- 3000:3000
|
||||
|
||||
cms_backend:
|
||||
command: 'sleep infinity'
|
||||
command: "sleep infinity"
|
||||
ports:
|
||||
- 7272:7272
|
||||
- 5555:5555
|
||||
|
||||
postgres:
|
||||
# container_name: postgres
|
||||
ports:
|
||||
- '5432:5432'
|
||||
- 5432:5432
|
||||
|
@@ -1,3 +1,6 @@
|
||||
#
|
||||
# REQ0180 service port schedule
|
||||
#
|
||||
volumes:
|
||||
db:
|
||||
driver: local
|
||||
@@ -11,8 +14,8 @@ services:
|
||||
- 10001:8080
|
||||
volumes:
|
||||
- ../frontend:/app
|
||||
working_dir: '/app'
|
||||
command: './dev.sh'
|
||||
working_dir: "/app"
|
||||
command: "./scripts/20_prod.sh"
|
||||
|
||||
mobile:
|
||||
image: 192.168.10.61:5000/hksingleparty_mobile
|
||||
@@ -22,8 +25,8 @@ services:
|
||||
- 10004:3000
|
||||
volumes:
|
||||
- ../mobile:/app
|
||||
working_dir: '/app'
|
||||
command: './dev.sh'
|
||||
working_dir: "/app"
|
||||
command: "./scripts/20_prod.sh"
|
||||
|
||||
cms_backend:
|
||||
image: 192.168.10.61:5000/demo_minimal_kit_backend
|
||||
@@ -36,8 +39,8 @@ services:
|
||||
- 10003:5555
|
||||
volumes:
|
||||
- ../cms_backend:/app
|
||||
working_dir: '/app'
|
||||
command: './dev.sh'
|
||||
working_dir: "/app"
|
||||
command: "./scripts/20_prod.sh"
|
||||
|
||||
postgres:
|
||||
image: postgres:14.1-alpine
|
||||
@@ -45,6 +48,6 @@ services:
|
||||
env_file:
|
||||
- .env
|
||||
expose:
|
||||
- '5432'
|
||||
- "5432"
|
||||
volumes:
|
||||
- db:/var/lib/postgresql/data
|
||||
|
@@ -3,7 +3,6 @@
|
||||
yarn --dev
|
||||
|
||||
while true; do
|
||||
|
||||
# yarn tsc:print
|
||||
yarn lint:print
|
||||
|
3
03_source/frontend/scripts/10_build.sh
Executable file
3
03_source/frontend/scripts/10_build.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
yarn build
|
10
03_source/frontend/scripts/20_prod.sh
Executable file
10
03_source/frontend/scripts/20_prod.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
yarn build
|
||||
|
||||
while true; do
|
||||
yarn start
|
||||
|
||||
echo "restarting..."
|
||||
sleep 1
|
||||
done
|
83
03_source/frontend/src/lib/axios.ts
Normal file
83
03_source/frontend/src/lib/axios.ts
Normal file
@@ -0,0 +1,83 @@
|
||||
import type { AxiosRequestConfig } from 'axios';
|
||||
import axios from 'axios';
|
||||
import { CONFIG } from 'src/global-config';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
const axiosInstance = axios.create({ baseURL: CONFIG.serverUrl });
|
||||
|
||||
axiosInstance.interceptors.response.use(
|
||||
(response) => response,
|
||||
(error) => Promise.reject((error.response && error.response.data) || 'Something went wrong!')
|
||||
);
|
||||
|
||||
export default axiosInstance;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export const fetcher = async (args: string | [string, AxiosRequestConfig]) => {
|
||||
try {
|
||||
const [url, config] = Array.isArray(args) ? args : [args];
|
||||
|
||||
const res = await axiosInstance.get(url, { ...config });
|
||||
|
||||
return res.data;
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch:', error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export const endpoints = {
|
||||
chat: '/api/chat',
|
||||
kanban: '/api/kanban',
|
||||
calendar: '/api/calendar',
|
||||
auth: {
|
||||
me: '/api/auth/me',
|
||||
signIn: '/api/auth/sign-in',
|
||||
signUp: '/api/auth/sign-up',
|
||||
},
|
||||
mail: {
|
||||
list: '/api/mail/list',
|
||||
details: '/api/mail/details',
|
||||
labels: '/api/mail/labels',
|
||||
},
|
||||
post: {
|
||||
list: '/api/post/list',
|
||||
details: '/api/post/details',
|
||||
latest: '/api/post/latest',
|
||||
search: '/api/post/search',
|
||||
},
|
||||
product: {
|
||||
list: '/api/product/list',
|
||||
details: '/api/product/details',
|
||||
search: '/api/product/search',
|
||||
},
|
||||
user: {
|
||||
list: '/api/user/list',
|
||||
profile: '/api/user/profile',
|
||||
update: '/api/user/update',
|
||||
settings: '/api/user/settings',
|
||||
details: '/api/user/details',
|
||||
},
|
||||
order: {
|
||||
list: '/api/order/list',
|
||||
profile: '/api/order/profile',
|
||||
update: '/api/order/update',
|
||||
settings: '/api/order/settings',
|
||||
details: '/api/order/details',
|
||||
changeStatus: (orderId: string) => `/api/order/changeStatus?orderId=${orderId}`,
|
||||
},
|
||||
invoice: {
|
||||
list: '/api/invoice/list',
|
||||
profile: '/api/invoice/profile',
|
||||
update: '/api/invoice/update',
|
||||
saveInvoice: (invoiceId: string) => `/api/invoice/saveInvoice?invoiceId=${invoiceId}`,
|
||||
settings: '/api/invoice/settings',
|
||||
details: '/api/invoice/details',
|
||||
changeStatus: (invoiceId: string) => `/api/invoice/changeStatus?invoiceId=${invoiceId}`,
|
||||
search: '/api/invoice/search',
|
||||
},
|
||||
};
|
19
03_source/frontend/src/lib/firebase.ts
Normal file
19
03_source/frontend/src/lib/firebase.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import type { FirebaseApp } from 'firebase/app';
|
||||
import type { Auth as AuthType } from 'firebase/auth';
|
||||
import type { Firestore as FirestoreType } from 'firebase/firestore';
|
||||
|
||||
import { getAuth } from 'firebase/auth';
|
||||
import { initializeApp } from 'firebase/app';
|
||||
import { getFirestore } from 'firebase/firestore';
|
||||
|
||||
import { CONFIG } from 'src/global-config';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
const isFirebase = CONFIG.auth.method === 'firebase';
|
||||
|
||||
export const firebaseApp = isFirebase ? initializeApp(CONFIG.firebase) : ({} as FirebaseApp);
|
||||
|
||||
export const AUTH = isFirebase ? getAuth(firebaseApp) : ({} as AuthType);
|
||||
|
||||
export const FIRESTORE = isFirebase ? getFirestore(firebaseApp) : ({} as FirestoreType);
|
16
03_source/frontend/src/lib/supabase.ts
Normal file
16
03_source/frontend/src/lib/supabase.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { SupabaseClient } from '@supabase/supabase-js';
|
||||
|
||||
import { createClient } from '@supabase/supabase-js';
|
||||
|
||||
import { CONFIG } from 'src/global-config';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
const isSupabase = CONFIG.auth.method === 'supabase';
|
||||
|
||||
const supabaseUrl = CONFIG.supabase.url;
|
||||
const supabaseKey = CONFIG.supabase.key;
|
||||
|
||||
export const supabase = isSupabase
|
||||
? createClient(supabaseUrl, supabaseKey)
|
||||
: ({} as SupabaseClient<any, 'public', any>);
|
@@ -31,8 +31,16 @@ export default defineConfig({
|
||||
},
|
||||
],
|
||||
},
|
||||
server: { port: PORT, host: true },
|
||||
preview: { port: PORT, host: true },
|
||||
server: {
|
||||
port: PORT,
|
||||
host: true,
|
||||
allowedHosts: ['pa_admin.louislabs.com', 'localhost'],
|
||||
},
|
||||
preview: {
|
||||
port: PORT,
|
||||
host: true,
|
||||
allowedHosts: ['pa_admin.louislabs.com', 'localhost'],
|
||||
},
|
||||
build: {
|
||||
sourcemap: true,
|
||||
},
|
||||
|
Submodule 03_source/ionic-react-conference-app deleted from 616068e5eb
@@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env zsh
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -x
|
||||
|
||||
@@ -10,10 +10,7 @@ set -ex
|
||||
|
||||
npm run format
|
||||
|
||||
git add .
|
||||
|
||||
npm run build
|
||||
|
||||
git commit -m"build ok,"
|
||||
|
||||
echo "done"
|
5
03_source/mobile/scripts/20_prod.sh
Executable file
5
03_source/mobile/scripts/20_prod.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -x
|
||||
|
||||
npm run start
|
84
03_source/mobile/src/lib/axios.ts
Normal file
84
03_source/mobile/src/lib/axios.ts
Normal file
@@ -0,0 +1,84 @@
|
||||
import type { AxiosRequestConfig } from 'axios';
|
||||
import axios from 'axios';
|
||||
import { CONFIG } from '../global-config';
|
||||
// import { CONFIG } from 'src/global-config';
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
const axiosInstance = axios.create({ baseURL: CONFIG.serverUrl });
|
||||
|
||||
axiosInstance.interceptors.response.use(
|
||||
(response) => response,
|
||||
(error) => Promise.reject((error.response && error.response.data) || 'Something went wrong!')
|
||||
);
|
||||
|
||||
export default axiosInstance;
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export const fetcher = async (args: string | [string, AxiosRequestConfig]) => {
|
||||
try {
|
||||
const [url, config] = Array.isArray(args) ? args : [args];
|
||||
|
||||
const res = await axiosInstance.get(url, { ...config });
|
||||
|
||||
return res.data;
|
||||
} catch (error) {
|
||||
console.error('Failed to fetch:', error);
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
export const endpoints = {
|
||||
chat: '/api/chat',
|
||||
kanban: '/api/kanban',
|
||||
calendar: '/api/calendar',
|
||||
auth: {
|
||||
me: '/api/auth/me',
|
||||
signIn: 'http://localhost:7272/api/auth/sign-in',
|
||||
signUp: '/api/auth/sign-up',
|
||||
},
|
||||
mail: {
|
||||
list: '/api/mail/list',
|
||||
details: '/api/mail/details',
|
||||
labels: '/api/mail/labels',
|
||||
},
|
||||
post: {
|
||||
list: '/api/post/list',
|
||||
details: '/api/post/details',
|
||||
latest: '/api/post/latest',
|
||||
search: '/api/post/search',
|
||||
},
|
||||
product: {
|
||||
list: '/api/product/list',
|
||||
details: '/api/product/details',
|
||||
search: '/api/product/search',
|
||||
},
|
||||
user: {
|
||||
list: '/api/user/list',
|
||||
profile: '/api/user/profile',
|
||||
update: '/api/user/update',
|
||||
settings: '/api/user/settings',
|
||||
details: '/api/user/details',
|
||||
},
|
||||
order: {
|
||||
list: '/api/order/list',
|
||||
profile: '/api/order/profile',
|
||||
update: '/api/order/update',
|
||||
settings: '/api/order/settings',
|
||||
details: '/api/order/details',
|
||||
changeStatus: (orderId: string) => `/api/order/changeStatus?orderId=${orderId}`,
|
||||
},
|
||||
invoice: {
|
||||
list: '/api/invoice/list',
|
||||
profile: '/api/invoice/profile',
|
||||
update: '/api/invoice/update',
|
||||
saveInvoice: (invoiceId: string) => `/api/invoice/saveInvoice?invoiceId=${invoiceId}`,
|
||||
settings: '/api/invoice/settings',
|
||||
details: '/api/invoice/details',
|
||||
changeStatus: (invoiceId: string) => `/api/invoice/changeStatus?invoiceId=${invoiceId}`,
|
||||
search: '/api/invoice/search',
|
||||
},
|
||||
};
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user