update team get endpoint
All checks were successful
deploy / build-and-deploy (push) Successful in 28s
All checks were successful
deploy / build-and-deploy (push) Successful in 28s
This commit is contained in:
@ -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
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user