Compare commits
5 Commits
31e539102b
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| ba9f74afd5 | |||
| 7528b36c48 | |||
| 84571c3516 | |||
| f7f5ac7e3b | |||
| 7c71af2a9f |
@@ -8,7 +8,13 @@
|
|||||||
"mcp__Claude_Preview__preview_start",
|
"mcp__Claude_Preview__preview_start",
|
||||||
"Bash(curl -s http://localhost:8080/api/v1/users -H \"Authorization: Bearer test\")",
|
"Bash(curl -s http://localhost:8080/api/v1/users -H \"Authorization: Bearer test\")",
|
||||||
"Bash(curl -s -X POST http://localhost:8080/api/v1/auth/login -H \"Content-Type: application/json\" -d \"{\"\"email\"\":\"\"admin@demo.com\"\",\"\"password\"\":\"\"password123\"\"}\")",
|
"Bash(curl -s -X POST http://localhost:8080/api/v1/auth/login -H \"Content-Type: application/json\" -d \"{\"\"email\"\":\"\"admin@demo.com\"\",\"\"password\"\":\"\"password123\"\"}\")",
|
||||||
"Bash(curl -s \"http://localhost:8080/api/v1/users\" -H \"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbW16c3JsdXowMDA0dTVqM2JldWwyMnM3IiwidmVuZG9ySWQiOiJkZW1vLXZlbmRvciIsInJvbGVJZCI6ImNtbXpzcmx0ZDAwMDB1NWozdnV6Y2QzZW0iLCJyb2xlTmFtZSI6Im93bmVyIiwiaWF0IjoxNzc0MDY2MjU4LCJleHAiOjE3NzQwNjcxNTh9.eBSLkZVXafSBE-o6A2I626EgBcxxXSKGVu7pv3yQdhU\")"
|
"Bash(curl -s \"http://localhost:8080/api/v1/users\" -H \"Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiJjbW16c3JsdXowMDA0dTVqM2JldWwyMnM3IiwidmVuZG9ySWQiOiJkZW1vLXZlbmRvciIsInJvbGVJZCI6ImNtbXpzcmx0ZDAwMDB1NWozdnV6Y2QzZW0iLCJyb2xlTmFtZSI6Im93bmVyIiwiaWF0IjoxNzc0MDY2MjU4LCJleHAiOjE3NzQwNjcxNTh9.eBSLkZVXafSBE-o6A2I626EgBcxxXSKGVu7pv3yQdhU\")",
|
||||||
|
"Bash(DATABASE_URL=\"file:./prisma/dev.db\" npx prisma migrate dev --name add_events_rename_roles)",
|
||||||
|
"Bash(DATABASE_URL=\"file:./prisma/dev.db\" npx tsx prisma/seed.ts)",
|
||||||
|
"Bash(git add:*)",
|
||||||
|
"Bash(git commit:*)",
|
||||||
|
"Bash(npx tsc:*)",
|
||||||
|
"Bash(curl -s http://localhost:8080/api/v1/health)"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
75
.github/workflows/ci.yml
vendored
75
.github/workflows/ci.yml
vendored
@@ -1,75 +0,0 @@
|
|||||||
name: CI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
pull_request:
|
|
||||||
branches: [main]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
server:
|
|
||||||
name: Server — typecheck & build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: server
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
cache: npm
|
|
||||||
cache-dependency-path: server/package-lock.json
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Generate Prisma client
|
|
||||||
run: npx prisma generate
|
|
||||||
|
|
||||||
- name: Typecheck
|
|
||||||
run: npx tsc --noEmit
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: npm run build
|
|
||||||
|
|
||||||
client:
|
|
||||||
name: Client — typecheck & build
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: client
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: 20
|
|
||||||
cache: npm
|
|
||||||
cache-dependency-path: client/package-lock.json
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm ci
|
|
||||||
|
|
||||||
- name: Typecheck
|
|
||||||
run: npx tsc --noEmit
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: npm run build
|
|
||||||
|
|
||||||
docker:
|
|
||||||
name: Docker build (smoke test)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: [server, client]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Build image
|
|
||||||
run: |
|
|
||||||
docker build \
|
|
||||||
--build-arg NODE_ENV=production \
|
|
||||||
-t vendor-pos:ci .
|
|
||||||
25
.github/workflows/docker-build.yml
vendored
Normal file
25
.github/workflows/docker-build.yml
vendored
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
name: Build and Push Docker Image
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container:
|
||||||
|
image: catthehacker/ubuntu:act-latest
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Log in to Gitea Container Registry
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: registry.alwisp.com
|
||||||
|
username: ${{ secrets.REGISTRY_USER }}
|
||||||
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
|
||||||
|
- name: Build and Push
|
||||||
|
run: |
|
||||||
|
docker build -t registry.alwisp.com/${{ gitea.repository_owner }}/${{ gitea.repository }}:latest .
|
||||||
|
docker push registry.alwisp.com/${{ gitea.repository_owner }}/${{ gitea.repository }}:latest
|
||||||
@@ -33,6 +33,7 @@ export function Btn({
|
|||||||
children,
|
children,
|
||||||
variant = "primary",
|
variant = "primary",
|
||||||
type = "button",
|
type = "button",
|
||||||
|
size,
|
||||||
disabled,
|
disabled,
|
||||||
onClick,
|
onClick,
|
||||||
style,
|
style,
|
||||||
@@ -40,6 +41,7 @@ export function Btn({
|
|||||||
children: React.ReactNode;
|
children: React.ReactNode;
|
||||||
variant?: "primary" | "danger" | "ghost";
|
variant?: "primary" | "danger" | "ghost";
|
||||||
type?: "button" | "submit" | "reset";
|
type?: "button" | "submit" | "reset";
|
||||||
|
size?: "sm";
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
onClick?: () => void;
|
onClick?: () => void;
|
||||||
style?: React.CSSProperties;
|
style?: React.CSSProperties;
|
||||||
@@ -47,9 +49,9 @@ export function Btn({
|
|||||||
const base: React.CSSProperties = {
|
const base: React.CSSProperties = {
|
||||||
border: "none",
|
border: "none",
|
||||||
borderRadius: "var(--radius)",
|
borderRadius: "var(--radius)",
|
||||||
padding: "8px 16px",
|
padding: size === "sm" ? "4px 10px" : "8px 16px",
|
||||||
fontWeight: 600,
|
fontWeight: 600,
|
||||||
fontSize: 13,
|
fontSize: size === "sm" ? 12 : 13,
|
||||||
cursor: disabled ? "not-allowed" : "pointer",
|
cursor: disabled ? "not-allowed" : "pointer",
|
||||||
opacity: disabled ? 0.6 : 1,
|
opacity: disabled ? 0.6 : 1,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -301,7 +301,7 @@ function emptyProduct() {
|
|||||||
return { name: "", sku: "", price: "", categoryId: "", taxId: "", description: "" };
|
return { name: "", sku: "", price: "", categoryId: "", taxId: "", description: "" };
|
||||||
}
|
}
|
||||||
|
|
||||||
function f(key: string, set: React.Dispatch<React.SetStateAction<Record<string, string>>>) {
|
function f<T extends Record<string, string>>(key: keyof T, set: React.Dispatch<React.SetStateAction<T>>) {
|
||||||
return (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) =>
|
return (e: React.ChangeEvent<HTMLInputElement | HTMLSelectElement | HTMLTextAreaElement>) =>
|
||||||
set((prev) => ({ ...prev, [key]: e.target.value }));
|
set((prev) => ({ ...prev, [key]: e.target.value }));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ export default function UsersPage() {
|
|||||||
|
|
||||||
const openEdit = (user: User) => {
|
const openEdit = (user: User) => {
|
||||||
setSelected(user);
|
setSelected(user);
|
||||||
setForm({ name: user.name, email: user.email, password: "", roleId: user.role.id });
|
setForm({ name: user.name, email: user.email, password: "", roleId: user.role.id, vendorId: user.vendor?.id ?? "" });
|
||||||
setError("");
|
setError("");
|
||||||
setModal("edit");
|
setModal("edit");
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
PORT=8080
|
PORT=8080
|
||||||
NODE_ENV=development
|
NODE_ENV=development
|
||||||
DATABASE_URL=file:./dev.db
|
DATABASE_URL=file:./prisma/dev.db
|
||||||
JWT_SECRET=change-me-in-production
|
JWT_SECRET=change-me-in-production
|
||||||
LOG_LEVEL=info
|
LOG_LEVEL=info
|
||||||
CORS_ORIGIN=http://localhost:5173
|
CORS_ORIGIN=http://localhost:5173
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
import express from "express";
|
import express from "express";
|
||||||
import cors from "cors";
|
import cors from "cors";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { fileURLToPath } from "url";
|
|
||||||
import healthRouter from "./routes/health.js";
|
import healthRouter from "./routes/health.js";
|
||||||
import authRouter from "./routes/auth.js";
|
import authRouter from "./routes/auth.js";
|
||||||
import vendorsRouter from "./routes/vendors.js";
|
import vendorsRouter from "./routes/vendors.js";
|
||||||
@@ -15,9 +14,6 @@ import eventsRouter from "./routes/events.js";
|
|||||||
import { errorHandler } from "./middleware/errorHandler.js";
|
import { errorHandler } from "./middleware/errorHandler.js";
|
||||||
import { requestLogger } from "./middleware/requestLogger.js";
|
import { requestLogger } from "./middleware/requestLogger.js";
|
||||||
|
|
||||||
const __filename = fileURLToPath(import.meta.url);
|
|
||||||
const __dirname = path.dirname(__filename);
|
|
||||||
|
|
||||||
export function createApp() {
|
export function createApp() {
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user