4553f63deb
- monorepo (npm workspaces): apps/api (Fastify+Prisma+TS), apps/web (Vite+React+TS), packages/shared (zod schemas) - SSO via auth.queo.ru: jose+JWKS plugin, requireDocPermission(viewer|user|admin) - DEV_BYPASS_AUTH for local development (hard-checked off in production) - M2: organization upsert, clients CRUD with search, services catalog with soft-delete - BigInt -> Number serializer for Prisma money columns - Embedded Postgres + npm run dev:demo for one-command local boot - Docker compose for queoserver: postgres + api + web (nginx as ingress proxying /api -> api:3030) - First migration 0_init committed (prisma migrate diff) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
33 lines
925 B
TypeScript
33 lines
925 B
TypeScript
import { PrismaClient } from '@prisma/client';
|
|
|
|
const prisma = new PrismaClient();
|
|
|
|
async function main() {
|
|
const id = process.env.DEFAULT_ORGANIZATION_ID ?? '00000000-0000-0000-0000-000000000001';
|
|
|
|
const existing = await prisma.organization.findUnique({ where: { id } });
|
|
if (existing) {
|
|
console.log(`organization ${id} already exists — skipping seed`);
|
|
return;
|
|
}
|
|
|
|
await prisma.organization.create({
|
|
data: {
|
|
id,
|
|
name: 'ООО «Моя компания»',
|
|
inn: '0000000000',
|
|
// Остальные реквизиты пользователь заполнит через UI на странице «Реквизиты».
|
|
},
|
|
});
|
|
console.log(`organization ${id} created (заполните реквизиты в UI: /organization)`);
|
|
}
|
|
|
|
main()
|
|
.catch((e) => {
|
|
console.error(e);
|
|
process.exit(1);
|
|
})
|
|
.finally(async () => {
|
|
await prisma.$disconnect();
|
|
});
|