Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 67c704009e | |||
| 831de8b610 | |||
| fd43e84c0c | |||
| 1ce8d33b0d |
@@ -1,23 +1,15 @@
|
|||||||
"use client";
|
"use client"
|
||||||
|
|
||||||
import { ChakraProvider, defaultSystem } from "@chakra-ui/react";
|
import { ChakraProvider, defaultSystem } from "@chakra-ui/react"
|
||||||
import * as React from "react";
|
import {
|
||||||
import type { ReactNode } from "react";
|
ColorModeProvider,
|
||||||
import { ColorModeProvider as ThemeColorModeProvider } from "./color-mode";
|
type ColorModeProviderProps,
|
||||||
|
} from "./color-mode"
|
||||||
|
|
||||||
export interface ColorModeProviderProps {
|
export function Provider(props: ColorModeProviderProps) {
|
||||||
children: React.ReactNode;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function ColorModeProvider({ children }: ColorModeProviderProps) {
|
|
||||||
// Wrap children with the real color-mode provider
|
|
||||||
return <ThemeColorModeProvider>{children}</ThemeColorModeProvider>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function Provider({ children }: { children: ReactNode }) {
|
|
||||||
return (
|
return (
|
||||||
<ChakraProvider value={defaultSystem}>
|
<ChakraProvider value={defaultSystem}>
|
||||||
<ColorModeProvider>{children}</ColorModeProvider>
|
<ColorModeProvider {...props} />
|
||||||
</ChakraProvider>
|
</ChakraProvider>
|
||||||
);
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,23 +1,16 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
|
import react from "@vitejs/plugin-react";
|
||||||
|
import svgr from "vite-plugin-svgr";
|
||||||
import tailwindcss from "@tailwindcss/vite";
|
import tailwindcss from "@tailwindcss/vite";
|
||||||
import path from "node:path";
|
import tsconfigPaths from "vite-tsconfig-paths";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [tailwindcss()],
|
plugins: [react(), svgr(), tailwindcss(), tsconfigPaths()],
|
||||||
resolve: {
|
|
||||||
alias: {
|
|
||||||
"@": path.resolve(__dirname, "src"),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
server: {
|
server: {
|
||||||
host: "0.0.0.0",
|
host: "0.0.0.0",
|
||||||
allowedHosts: ["insta.the1s.de"],
|
port: 8001,
|
||||||
port: 8101,
|
watch: {
|
||||||
watch: { usePolling: true },
|
usePolling: true,
|
||||||
hmr: {
|
|
||||||
host: "insta.the1s.de",
|
|
||||||
port: 8101,
|
|
||||||
protocol: "wss",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@ server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
location /backend/ {
|
location /backend/ {
|
||||||
proxy_pass http://borrow_system-backend_v2:8102/;
|
proxy_pass http://borrow_system-backend_v2:8004/;
|
||||||
}
|
}
|
||||||
|
|
||||||
location ~* \.(?:js|mjs|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
|
location ~* \.(?:js|mjs|css|png|jpg|jpeg|gif|ico|svg|woff2?)$ {
|
||||||
|
|||||||
@@ -8,13 +8,9 @@ export default defineConfig({
|
|||||||
plugins: [react(), svgr(), tailwindcss(), tsconfigPaths()],
|
plugins: [react(), svgr(), tailwindcss(), tsconfigPaths()],
|
||||||
server: {
|
server: {
|
||||||
host: "0.0.0.0",
|
host: "0.0.0.0",
|
||||||
allowedHosts: ["admin.insta.the1s.de"],
|
port: 8003,
|
||||||
port: 8103,
|
watch: {
|
||||||
watch: { usePolling: true },
|
usePolling: true,
|
||||||
hmr: {
|
|
||||||
host: "admin.insta.the1s.de",
|
|
||||||
port: 8103,
|
|
||||||
protocol: "wss",
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
+3
-3
@@ -1,11 +1,11 @@
|
|||||||
{
|
{
|
||||||
"backend-info": {
|
"backend-info": {
|
||||||
"version": "v2.2"
|
"version": "v2.2 (dev)"
|
||||||
},
|
},
|
||||||
"frontend-info": {
|
"frontend-info": {
|
||||||
"version": "v2.2"
|
"version": "v2.2 (dev)"
|
||||||
},
|
},
|
||||||
"admin-panel-info": {
|
"admin-panel-info": {
|
||||||
"version": "v1.4"
|
"version": "v1.4 (dev)"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -63,11 +63,9 @@ export const createLoanInDatabase = async (
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
const itemNames = itemIds
|
const itemNames = itemIds.map(
|
||||||
.map(
|
(id) => itemsRows.find((r) => Number(r.id) === Number(id)).item_name,
|
||||||
(id) => itemsRows.find((r) => Number(r.id) === Number(id))?.item_name,
|
);
|
||||||
)
|
|
||||||
.filter(Boolean);
|
|
||||||
|
|
||||||
// Build lockers array (unique, only 2-digit numbers from safe_nr)
|
// Build lockers array (unique, only 2-digit numbers from safe_nr)
|
||||||
const lockers = [
|
const lockers = [
|
||||||
@@ -109,27 +107,24 @@ export const createLoanInDatabase = async (
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generate unique loan_code (retry a few times)
|
let index = false;
|
||||||
let loanCode = null;
|
let candidate;
|
||||||
for (let i = 0; i < 6; i++) {
|
let loanCode;
|
||||||
const candidate = Math.floor(100000 + Math.random() * 899999); // 6 digits
|
|
||||||
const [exists] = await conn.query(
|
// Generates 6-digit loan code
|
||||||
"SELECT 1 FROM loans WHERE loan_code = ? LIMIT 1",
|
do {
|
||||||
|
candidate = Math.floor(100000 + Math.random() * 899999);
|
||||||
|
|
||||||
|
const [rows] = await conn.query(
|
||||||
|
"SELECT 1 FROM loans where loan_code = ? LIMIT 1",
|
||||||
[candidate],
|
[candidate],
|
||||||
);
|
);
|
||||||
if (exists.length === 0) {
|
|
||||||
|
if (rows.length == 0) {
|
||||||
|
index = true;
|
||||||
loanCode = candidate;
|
loanCode = candidate;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
} while (index === false);
|
||||||
if (!loanCode) {
|
|
||||||
await conn.rollback();
|
|
||||||
return {
|
|
||||||
success: false,
|
|
||||||
code: "SERVER_ERROR",
|
|
||||||
message: "Failed to generate unique loan code",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// Insert loan (now includes lockers)
|
// Insert loan (now includes lockers)
|
||||||
const [insertRes] = await conn.query(
|
const [insertRes] = await conn.query(
|
||||||
|
|||||||
+20
-24
@@ -1,23 +1,23 @@
|
|||||||
services:
|
services:
|
||||||
usr-frontend_v2:
|
# usr-frontend_v2:
|
||||||
container_name: borrow_system-usr-frontend
|
# container_name: borrow_system-usr-frontend
|
||||||
networks:
|
# build: ./FrontendV2
|
||||||
- proxynet
|
# ports:
|
||||||
build: ./FrontendV2
|
# - "8001:80"
|
||||||
restart: unless-stopped
|
# restart: always
|
||||||
|
|
||||||
admin-frontend:
|
# admin-frontend:
|
||||||
container_name: borrow_system-admin-frontend
|
# container_name: borrow_system-admin-frontend
|
||||||
networks:
|
# build: ./admin
|
||||||
- proxynet
|
# ports:
|
||||||
build: ./admin
|
# - "8003:80"
|
||||||
restart: unless-stopped
|
# restart: always
|
||||||
|
|
||||||
backend_v2:
|
backend_v2:
|
||||||
container_name: borrow_system-backend_v2
|
container_name: borrow_system-backend_v2
|
||||||
networks:
|
|
||||||
- proxynet
|
|
||||||
build: ./backendV2
|
build: ./backendV2
|
||||||
|
ports:
|
||||||
|
- "8004:8004"
|
||||||
environment:
|
environment:
|
||||||
NODE_ENV: production
|
NODE_ENV: production
|
||||||
DB_HOST: mysql_v2
|
DB_HOST: mysql_v2
|
||||||
@@ -26,14 +26,12 @@ services:
|
|||||||
DB_NAME: borrow_system_new
|
DB_NAME: borrow_system_new
|
||||||
depends_on:
|
depends_on:
|
||||||
- mysql_v2
|
- mysql_v2
|
||||||
restart: unless-stopped
|
restart: always
|
||||||
|
|
||||||
mysql_v2:
|
mysql_v2:
|
||||||
container_name: borrow_system-mysql-v2
|
container_name: borrow_system-mysql-v2
|
||||||
networks:
|
|
||||||
- proxynet
|
|
||||||
image: mysql:8.0
|
image: mysql:8.0
|
||||||
restart: unless-stopped
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD_V2}
|
MYSQL_ROOT_PASSWORD: ${DB_PASSWORD_V2}
|
||||||
MYSQL_DATABASE: borrow_system_new
|
MYSQL_DATABASE: borrow_system_new
|
||||||
@@ -41,11 +39,13 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- mysql-v2-data:/var/lib/mysql
|
- mysql-v2-data:/var/lib/mysql
|
||||||
- ./mysql-timezone.cnf:/etc/mysql/conf.d/timezone.cnf:ro
|
- ./mysql-timezone.cnf:/etc/mysql/conf.d/timezone.cnf:ro
|
||||||
|
ports:
|
||||||
|
- "3310:3306"
|
||||||
|
|
||||||
no-as-a-service:
|
no-as-a-service:
|
||||||
container_name: borrow_system-naas
|
container_name: borrow_system-naas
|
||||||
networks:
|
ports:
|
||||||
- proxynet
|
- "3000:3000"
|
||||||
build:
|
build:
|
||||||
context: ./no-as-a-service
|
context: ./no-as-a-service
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
@@ -54,7 +54,3 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
mysql-data:
|
mysql-data:
|
||||||
mysql-v2-data:
|
mysql-v2-data:
|
||||||
|
|
||||||
networks:
|
|
||||||
proxynet:
|
|
||||||
external: true
|
|
||||||
|
|||||||
+1
-1
Submodule no-as-a-service updated: 764062a307...e6b4218394
Reference in New Issue
Block a user