nice update

This commit is contained in:
gpatruno
2026-07-16 20:23:58 +02:00
parent a0d7163464
commit 9106c8b873
47 changed files with 5183 additions and 1732 deletions
+11
View File
@@ -5,6 +5,7 @@ import { publicUser, requireAuth } from '../middleware.js';
const router = Router();
const STARTING_BALANCE = Number(process.env.STARTING_BALANCE || 10000);
const STARTING_OSU = Number(process.env.STARTING_OSU || 100);
router.post('/register', async (req, res) => {
try {
@@ -32,6 +33,7 @@ router.post('/register', async (req, res) => {
username,
passwordHash,
balance: STARTING_BALANCE,
osuBalance: STARTING_OSU,
role: 'user',
},
});
@@ -45,6 +47,15 @@ router.post('/register', async (req, res) => {
},
});
await prisma.transaction.create({
data: {
userId: user.id,
type: 'seed_osu',
amount: STARTING_OSU,
meta: JSON.stringify({ reason: 'starting_osu' }),
},
});
req.session.userId = user.id;
req.session.role = user.role;