diff --git a/packages/backend/src/server/api/endpoints/antennas/create.ts b/packages/backend/src/server/api/endpoints/antennas/create.ts index c1ba7bcdfd..a25b32b404 100644 --- a/packages/backend/src/server/api/endpoints/antennas/create.ts +++ b/packages/backend/src/server/api/endpoints/antennas/create.ts @@ -23,6 +23,12 @@ export const meta = { code: "NO_SUCH_USER_GROUP", id: "aa3c0b9a-8cae-47c0-92ac-202ce5906682", }, + + tooManyAntennas: { + message: "Too many antennas.", + code: "TOO_MANY_ANTENNAS", + id: "c3a5a51e-04d4-11ee-be56-0242ac120002", + }, }, res: { @@ -97,6 +103,14 @@ export default define(meta, paramDef, async (ps, user) => { let userList; let userGroupJoining; + const antennas = await Antennas.findBy({ + userId: user.id, + }); + if (antennas.length > 5 && !user.isAdmin) { + throw new ApiError(meta.errors.tooManyAntennas) + } + + if (ps.src === "list" && ps.userListId) { userList = await UserLists.findOneBy({ id: ps.userListId,