max Tag characters now 3

This commit is contained in:
2026-03-11 20:09:11 +01:00
parent 842f2ef023
commit 03d38a0b35
3 changed files with 17 additions and 2 deletions

View File

@@ -86,6 +86,9 @@ app.post('/teams', authMiddleware, async (req: Request, res: Response) => {
if (!name || !tag) {
return res.status(400).send({error: 'name and tag are required'});
}
if (tag.length > 3) {
return res.status(400).send({error: 'tag must be at most 3 characters'});
}
try {
const team = await teamService.addTeam({name, tag, description: description ?? ''});
// @ts-ignore
@@ -99,6 +102,10 @@ app.post('/teams', authMiddleware, async (req: Request, res: Response) => {
});
app.put('/teams/:id', authMiddleware, async (req: Request, res: Response) => {
const {tag} = req.body;
if (tag && tag.length > 3) {
return res.status(400).send({error: 'tag must be at most 3 characters'});
}
try {
await teamService.updateTeam(+req.params.id, req.body);
} catch (err) {