DashboardView ("میز کار"): Rebuilt from scratch with a new structure, distinct from the old card+grid layout but visually aligned with HomeView (same blurred bar, @ink/@wine palette, staged reveal animation on mount):
Single hero card (ink→wine gradient) showing balance, gold/fiat debt, and identity — no quick-action icons inside it anymore.
Live gold rate folded into a slim inline row at the bottom instead of a titled section.
Iterated shadow/spacing on the hero card per feedback (softer, less clipped).
DialogVant / DialogVantOneButton (shared modal components, used in 7+ call sites: Dashboard, Cart, SingleProduct, Register, App): Replaced Vant's default dialog chrome with the app's own rounded-card language — circular icon badge for the illustration, pill-shaped primary/secondary buttons. No call-site markup changed.
LoginView: Rebuilt from scratch — full-bleed dark hero (brand + step copy) overlapped by a floating white form sheet, animated crossfade transition between the mobile-number and OTP steps, same staged entrance animation as Home/Dashboard. All auth logic (API check, OTP stub, session login) unchanged.
56 lines
2.1 KiB
TypeScript
56 lines
2.1 KiB
TypeScript
import 'reflect-metadata';
|
|
import { NestFactory } from '@nestjs/core';
|
|
import { ValidationPipe } from '@nestjs/common';
|
|
import { NestExpressApplication } from '@nestjs/platform-express';
|
|
import { extname, join } from 'node:path';
|
|
import type { Response } from 'express';
|
|
import { AppModule } from './app.module';
|
|
import { prepareDatabase } from './prisma/bootstrap';
|
|
import { PrismaExceptionFilter } from './prisma/prisma-exception.filter';
|
|
|
|
// serve-static's bundled `mime` version predates .avif, so it falls back to
|
|
// application/octet-stream — browsers still render the image (they sniff
|
|
// content), but a strict client or an <img> under some CSPs would not.
|
|
const EXTRA_MIME_TYPES: Record<string, string> = {
|
|
'.avif': 'image/avif',
|
|
};
|
|
|
|
async function bootstrap() {
|
|
await prepareDatabase();
|
|
|
|
const app = await NestFactory.create<NestExpressApplication>(AppModule);
|
|
app.setGlobalPrefix('api');
|
|
app.useGlobalPipes(new ValidationPipe({ whitelist: true, transform: true }));
|
|
app.useGlobalFilters(new PrismaExceptionFilter());
|
|
app.enableCors();
|
|
// Uploaded files, mounted OUTSIDE the /api prefix so the URLs stored on
|
|
// UploadedFile.url ("/uploads/<name>") resolve directly.
|
|
app.useStaticAssets(process.env.UPLOAD_DIR ?? join(process.cwd(), 'storage', 'uploads'), {
|
|
prefix: '/uploads/',
|
|
index: false,
|
|
dotfiles: 'deny',
|
|
setHeaders: (res: Response, path: string) => {
|
|
const mime = EXTRA_MIME_TYPES[extname(path).toLowerCase()];
|
|
if (mime) res.setHeader('Content-Type', mime);
|
|
},
|
|
});
|
|
const port = Number(process.env.PORT ?? 3000);
|
|
|
|
try {
|
|
// Bind all interfaces explicitly so the container is reachable from nginx.
|
|
await app.listen(port, '0.0.0.0');
|
|
} catch (err) {
|
|
if ((err as NodeJS.ErrnoException).code === 'EADDRINUSE') {
|
|
// eslint-disable-next-line no-console
|
|
console.error(
|
|
`\n[api] Port ${port} is already in use. Free it or change API_PORT ` +
|
|
`in the repo-root .env (and PORT in apps/api/.env to match) — the ` +
|
|
`API will not fall back to a different port.\n`,
|
|
);
|
|
process.exit(1);
|
|
}
|
|
throw err;
|
|
}
|
|
}
|
|
bootstrap();
|