chore: initialize SkyMoney (api + prisma + docker-compose) ( still in progress

This commit is contained in:
2025-11-07 22:52:33 -06:00
commit f4160b91db
13 changed files with 2014 additions and 0 deletions

20
api/src/scripts/seed.ts Normal file
View File

@@ -0,0 +1,20 @@
// prisma/seed.ts (optional: creates one demo user + categories)
import { PrismaClient } from '@prisma/client';
const db = new PrismaClient();
async function main() {
const user = await db.user.upsert({
where: { email: 'demo@user.test' },
update: {},
create: { email: 'demo@user.test' }
});
await db.variableCategory.createMany({
data: [
{ userId: user.id, name: 'Groceries', percent: 30, priority: 10 },
{ userId: user.id, name: 'Gas', percent: 20, priority: 20 },
{ userId: user.id, name: 'Fun', percent: 50, priority: 30 }
],
skipDuplicates: true
});
console.log('Seeded:', user.email);
}
main().finally(()=>db.$disconnect());

10
api/src/server.ts Normal file
View File

@@ -0,0 +1,10 @@
import Fastify from "fastify";
const app = Fastify({ logger: true });
app.get("/health", async () => ({ ok: true }));
const port = Number(process.env.PORT ?? 8080);
app.listen({ port, host: "0.0.0.0" }).catch((err) => {
app.log.error(err);
process.exit(1);
});