feat: add link creation and lookup
All checks were successful
Build and push Docker image / build (push) Successful in 2m50s
Release new version / release (push) Successful in 26s
Update changelog / changelog (push) Successful in 25s

finally has the bare minimum functionality to say that it works!
This commit is contained in:
2026-01-03 10:51:59 +01:00
parent c19a098b1c
commit d7f4006698
8 changed files with 477 additions and 34 deletions

View File

@@ -2,6 +2,7 @@ import { Router } from 'express';
import validateSchema from '../tools/validateSchema';
import * as lc from '../controllers/linkController';
import * as ls from '../schemas/linkSchema';
import requireUser from '../middleware/requireUser';
const linkRouter = Router();
@@ -96,5 +97,42 @@ linkRouter.get('/api/v1/link/short', validateSchema(ls.shortLinkRequestSchema),
*/
linkRouter.get('/api/v1/link/fromWordlist', validateSchema(ls.sentenceLinkRequestSchema), lc.generateSentenceLinkHandler);
/**
* @openapi
*
* /api/v1/link/new:
* post:
* description:
* Register a new shortened URL. <br/>
* See linkSchema.ts for constraints.
* tags: [Link]
* summary: Shorten a link
* requestBody:
* required: true
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/CreateLinkRequestDTO'
* produces:
* - application/json
* responses:
* 200:
* description: New link created successfully
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/CreateLinkResponseDTO'
* 400:
* description: Bad request
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/ErrorDTO'
*/
linkRouter.post('/api/v1/link/new',
validateSchema(ls.createLinkRequestSchema),
lc.createLinkHandler
);
export default linkRouter;