Skip to content

Commit 375cd6b

Browse files
committed
improved advance queue endpoint output
1 parent f536a02 commit 375cd6b

2 files changed

Lines changed: 18 additions & 18 deletions

File tree

backend/README.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,11 @@ Updates the configuration parameters for the queue.
9797
Advances the queue by removing the person at the front and notifying the next `N` users in line via Telegram.
9898
- **Method:** `POST`
9999
- **Auth:** Required (Admin)
100-
- **Success (200 OK):** Returns the updated queue or a message if the queue is empty.
100+
- **Success (200 OK):** Returns the updated queue or an empty list if queue is empty.
101101
- **Possible Errors:**
102102

103-
| Code | Error Message | Reason |
104-
|:-----|:--------------|:-------|
103+
| Code | Error Message | Reason |
104+
|:-----|:--------------|:------------------------------------|
105105
| 403 | `Forbidden` | User is not authorized as an admin. |
106106

107107
### `/queue/entries`
@@ -112,7 +112,7 @@ Updates the configuration parameters for the queue.
112112
- **Possible Errors:**
113113

114114
| Code | Error Message | Reason |
115-
| :--- | :------------------------------ | :---------------------------------------------- |
115+
|:-----|:--------------------------------|:------------------------------------------------|
116116
| 403 | `Forbidden` | User is not an admin. |
117117
| 500 | `Failed to fetch queue entries` | Failed to read queue entries from the database. |
118118

@@ -123,10 +123,10 @@ Adds the current user to the queue.
123123
- **Success (200 OK):** `{ "joined": boolean, "position": number, "ahead": number }`
124124
- **Possible Errors:**
125125

126-
| Code | Error Message | Reason |
127-
| :--- | :---------------------------- | :---------------------------------------------- |
128-
| 409 | `User already in queue` | User is already in the queue. |
129-
| 500 | `No queue configured` | No configuration record exists in the database. |
126+
| Code | Error Message | Reason |
127+
|:-----|:------------------------|:------------------------------------------------|
128+
| 409 | `User already in queue` | User is already in the queue. |
129+
| 500 | `No queue configured` | No configuration record exists in the database. |
130130

131131
### `/queue/entries/me`
132132
Removes the current user from the queue.
@@ -135,10 +135,10 @@ Removes the current user from the queue.
135135
- **Success (200 OK):** `{ "left": true }`
136136
- **Possible Errors:**
137137

138-
| Code | Error Message | Reason |
139-
| :--- | :---------------------- | :---------------------------------------------- |
140-
| 400 | `User not in queue` | User is not currently in the queue. |
141-
| 500 | `Failed to leave queue` | Failed to remove user from the queue. |
138+
| Code | Error Message | Reason |
139+
|:-----|:------------------------|:--------------------------------------|
140+
| 400 | `User not in queue` | User is not currently in the queue. |
141+
| 500 | `Failed to leave queue` | Failed to remove user from the queue. |
142142

143143
### `/queue/entries/me`
144144
Returns how many people are ahead of the current user in the queue.
@@ -147,10 +147,10 @@ Returns how many people are ahead of the current user in the queue.
147147
- **Success (200 OK):** `{ "ahead": number }`
148148
- **Possible Errors:**
149149

150-
| Code | Error Message | Reason |
151-
| :--- | :------------------------------------ | :---------------------------------------------- |
152-
| 400 | `User not in queue` | User is not currently in the queue. |
153-
| 500 | `No queue configured` | No configuration record exists in the database. |
150+
| Code | Error Message | Reason |
151+
|:-----|:----------------------|:------------------------------------------------|
152+
| 400 | `User not in queue` | User is not currently in the queue. |
153+
| 500 | `No queue configured` | No configuration record exists in the database. |
154154

155155
### `/admins`
156156
Retrieves a list of all current users with administrative privileges.

backend/src/routes/private/queue/next.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const route: FastifyPluginAsyncZod = async (fastify, _) => {
1212
});
1313

1414
if (allEntries.length === 0) {
15-
return reply.code(200).send({message: "Queue is empty"});
15+
return reply.code(200).send({entries: []});
1616
}
1717

1818
const top = allEntries.shift();
@@ -34,7 +34,7 @@ const route: FastifyPluginAsyncZod = async (fastify, _) => {
3434
})
3535
}
3636

37-
return reply.code(200).send({allEntries: allEntries});
37+
return reply.code(200).send({entries: allEntries});
3838

3939
});
4040

0 commit comments

Comments
 (0)