update team get endpoint
All checks were successful
deploy / build-and-deploy (push) Successful in 28s

This commit is contained in:
2025-05-18 21:11:09 +02:00
parent 560bf04b6c
commit 201829a523
4 changed files with 88 additions and 14 deletions

View File

@ -7,18 +7,27 @@ export const GET: APIRoute = async ({ request }) => {
return new Response(null, { status: 401 });
}
const teams = await db.getTeams({});
const teams = await db.getTeamsFull({});
const response = [];
for (const team of teams) {
const users = [];
if (team.memberOne.uuid) users.push(team.memberOne.uuid);
if (team.memberTwo.uuid) users.push(team.memberTwo.uuid);
response.push({
name: team.name,
color: team.color,
users: users
name: team.team.name,
color: team.team.color,
lastJoined: team.team.lastJoined ? new Date(team.team.lastJoined).getTime() : null,
strikeWeight: team.strikeWeight ?? 0,
memberOne: team.memberOne
? {
uuid: team.memberOne.uuid,
dead: team.memberOneDeath != null
}
: null,
memberTwo: team.memberTwo
? {
uuid: team.memberTwo.uuid,
dead: team.memberTwoDeath != null
}
: null
});
}