Update plugins/sangmata.js
Browse files- plugins/sangmata.js +49 -0
plugins/sangmata.js
CHANGED
@@ -4,6 +4,55 @@ import { authenticateApiKey, apiLimiter } from '../middleware/midware.js';
|
|
4 |
import { SangMata } from '../models.js';
|
5 |
const SangmataRoutes = express.Router();
|
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
7 |
SangmataRoutes.post("/api/v2/sangmata/tracker", authenticateApiKey, async (req, res) => {
|
8 |
try {
|
9 |
const { user_id, username, first_name } = req.body;
|
|
|
4 |
import { SangMata } from '../models.js';
|
5 |
const SangmataRoutes = express.Router();
|
6 |
|
7 |
+
/**
|
8 |
+
* @swagger
|
9 |
+
* /api/v2/sangmata/tracker:
|
10 |
+
* post:
|
11 |
+
* summary: Create a sangmata tracker
|
12 |
+
* tags: [Federation]
|
13 |
+
* description: Creates a new sangmata with a first name and username.
|
14 |
+
* security:
|
15 |
+
* - apiKeyAuth: []
|
16 |
+
* requestBody:
|
17 |
+
* required: true
|
18 |
+
* content:
|
19 |
+
* application/json:
|
20 |
+
* schema:
|
21 |
+
* type: object
|
22 |
+
* properties:
|
23 |
+
* user_id:
|
24 |
+
* type: integer
|
25 |
+
* description: UserId
|
26 |
+
* username:
|
27 |
+
* type: string
|
28 |
+
* description: Usernames.
|
29 |
+
* first_name:
|
30 |
+
* type: string
|
31 |
+
* description: first name.
|
32 |
+
*
|
33 |
+
* parameters:
|
34 |
+
* - in: header
|
35 |
+
* name: x-api-key
|
36 |
+
* required: true
|
37 |
+
* description: API key for authentication.
|
38 |
+
* schema:
|
39 |
+
* type: string
|
40 |
+
* responses:
|
41 |
+
* 200:
|
42 |
+
* description: Sangmata successfully.
|
43 |
+
* content:
|
44 |
+
* application/json:
|
45 |
+
* schema:
|
46 |
+
* type: object
|
47 |
+
* properties:
|
48 |
+
* message:
|
49 |
+
* type: string
|
50 |
+
* example: User data updated successfully
|
51 |
+
* 400:
|
52 |
+
* description: Sangmata already exists or missing parameters.
|
53 |
+
* 500:
|
54 |
+
* description: Internal server error.
|
55 |
+
*/
|
56 |
SangmataRoutes.post("/api/v2/sangmata/tracker", authenticateApiKey, async (req, res) => {
|
57 |
try {
|
58 |
const { user_id, username, first_name } = req.body;
|