randydev commited on
Commit
940688f
·
verified ·
1 Parent(s): 776ce42

Update plugins/federations.js

Browse files
Files changed (1) hide show
  1. plugins/federations.js +95 -1
plugins/federations.js CHANGED
@@ -182,6 +182,56 @@ FedsRoutes.get("/api/v2/federation/getfed/:uuid", authenticateApiKey, apiLimiter
182
  }
183
  });
184
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  FedsRoutes.post('/api/v2/federation/unban', authenticateApiKey, async (req, res) => {
186
  try {
187
  const { name, user_id } = req.body;
@@ -210,7 +260,51 @@ FedsRoutes.post('/api/v2/federation/unban', authenticateApiKey, async (req, res)
210
  }
211
  });
212
 
213
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  FedsRoutes.post("/api/v2/federation/ban", authenticateApiKey, apiLimiter, async (req, res) => {
215
  try {
216
  const { federation_uuid, user_id } = req.body;
 
182
  }
183
  });
184
 
185
+ /**
186
+ * @swagger
187
+ * /api/v2/federation/unban:
188
+ * post:
189
+ * summary: Unban a user in a federation
190
+ * tags: [Federation]
191
+ * description: Removes a user from the banned list of a specified federation.
192
+ * security:
193
+ * - apiKeyAuth: []
194
+ * requestBody:
195
+ * required: true
196
+ * content:
197
+ * application/json:
198
+ * schema:
199
+ * type: object
200
+ * properties:
201
+ * name:
202
+ * type: string
203
+ * description: Name of the federation where the user will be unbanned.
204
+ * user_id:
205
+ * type: integer
206
+ * description: User ID to be unbanned.
207
+ * parameters:
208
+ * - in: header
209
+ * name: x-api-key
210
+ * required: true
211
+ * description: API key for authentication.
212
+ * schema:
213
+ * type: string
214
+ * responses:
215
+ * 200:
216
+ * description: User unbanned successfully.
217
+ * content:
218
+ * application/json:
219
+ * schema:
220
+ * type: object
221
+ * properties:
222
+ * success:
223
+ * type: boolean
224
+ * example: true
225
+ * message:
226
+ * type: string
227
+ * example: "User 12345 unbanned from federation FederationName."
228
+ * 400:
229
+ * description: Missing federation name or user ID.
230
+ * 404:
231
+ * description: Federation not found.
232
+ * 500:
233
+ * description: Internal server error.
234
+ */
235
  FedsRoutes.post('/api/v2/federation/unban', authenticateApiKey, async (req, res) => {
236
  try {
237
  const { name, user_id } = req.body;
 
260
  }
261
  });
262
 
263
+ /**
264
+ * @swagger
265
+ * /api/v2/federation/ban:
266
+ * post:
267
+ * summary: Ban a user in a federation
268
+ * tags: [Federation]
269
+ * description: Bans a user in the specified federation and all its sub-federations.
270
+ * security:
271
+ * - apiKeyAuth: []
272
+ * requestBody:
273
+ * required: true
274
+ * content:
275
+ * application/json:
276
+ * schema:
277
+ * type: object
278
+ * properties:
279
+ * federation_uuid:
280
+ * type: string
281
+ * description: UUID of the federation where the user will be banned.
282
+ * user_id:
283
+ * type: integer
284
+ * description: User ID to be banned.
285
+ * parameters:
286
+ * - in: header
287
+ * name: x-api-key
288
+ * required: true
289
+ * description: API key for authentication.
290
+ * schema:
291
+ * type: string
292
+ * responses:
293
+ * 200:
294
+ * description: User banned successfully.
295
+ * content:
296
+ * application/json:
297
+ * schema:
298
+ * type: object
299
+ * properties:
300
+ * message:
301
+ * type: string
302
+ * example: "User 12345 banned in FederationName and all its sub-federations"
303
+ * 404:
304
+ * description: Federation not found.
305
+ * 500:
306
+ * description: Internal server error.
307
+ */
308
  FedsRoutes.post("/api/v2/federation/ban", authenticateApiKey, apiLimiter, async (req, res) => {
309
  try {
310
  const { federation_uuid, user_id } = req.body;