Skip to content

Commit

Permalink
feat(weblinks): add weblinks route and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihoub2 committed Jan 19, 2024
1 parent 9b2aefe commit 92f0281
Show file tree
Hide file tree
Showing 6 changed files with 137 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/api/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ import termsRoutes from './terms/terms.routes';
import usersGroupsRoutes from './groups/groups.routes';
import usersRoutes from './users/users.routes';
import identifiersRoutes from './identifiers/identifier.routes';
import weblinksRoutes from './weblinks/weblinks.routes';

// Load API specifications
const apiSpec = path.join(path.resolve(), 'docs/reference/api.yml');
Expand Down Expand Up @@ -111,6 +112,7 @@ app.use(documentTypesRoutes);
app.use(emailTypesRoutes);
app.use(followUpsRoutes);
app.use(geographicalcategoriesRoutes);
app.use(identifiersRoutes);
app.use(jobsRoutes);
app.use(journalRoutes);
app.use(legalCategoriesRoutes);
Expand All @@ -131,7 +133,7 @@ app.use(supervisingMinistersRoutes);
app.use(termsRoutes);
app.use(usersGroupsRoutes);
app.use(usersRoutes);
app.use(identifiersRoutes);
app.use(weblinksRoutes);

// Error handler
app.use(handleErrors);
Expand Down
11 changes: 11 additions & 0 deletions src/api/weblinks/weblinks.routes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import express from 'express';
import controllers from '../commons/middlewares/crud.middlewares';
import { weblinksRepository as repository } from '../commons/repositories';
import { weblinks as resource } from '../resources';

const router = new express.Router();

router.route(`/${resource}`)
.get(controllers.list(repository));

export default router;
8 changes: 8 additions & 0 deletions src/openapi/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,10 @@ paths:
'/jobs':
$ref: './paths/jobs/jobs.yml#/collectionMethods'

### WEBLINKS ###
'/weblinks':
$ref: './paths/weblinks/weblinks.yml#/collectionMethods'

components:
parameters:
apiKeyId:
Expand Down Expand Up @@ -606,6 +610,8 @@ components:
$ref: ./schemas/users/user-admin.yml
UserLight:
$ref: ./schemas/users/user-light.yml
Weblinks:
$ref: './schemas/weblinks/weblinks.yml'

### PAYLOADS ###
ApiKeyPayload:
Expand Down Expand Up @@ -734,6 +740,8 @@ components:
$ref: './schemas/terms/enums/weblink-types.yml'
TermIdentifierTypesEnum:
$ref: './schemas/terms/enums/identifier-types.yml'
WeblinksEnum:
$ref: './schemas/weblinks/enums/type.yml'

### COMMON MODELS ###
Error:
Expand Down
32 changes: 32 additions & 0 deletions src/openapi/paths/weblinks/weblinks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
collectionMethods:
get:
tags:
- Weblinks
summary: List all weblinks
parameters:
- $ref: '../../api.yml#/components/parameters/filters'
- $ref: '../../api.yml#/components/parameters/skip'
- $ref: '../../api.yml#/components/parameters/limit'
- $ref: '../../api.yml#/components/parameters/sort'
responses:
'200':
description: OK
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '../../api.yml#/components/schemas/Weblinks'
totalCount:
type: integer
'400':
$ref: '../../api.yml#/components/responses/BadRequest'
'401':
$ref: '../../api.yml#/components/responses/Unauthorized'
'403':
$ref: '../../api.yml#/components/responses/Forbidden'
'500':
$ref: '../../api.yml#/components/responses/ServerError'
53 changes: 53 additions & 0 deletions src/openapi/schemas/weblinks/enums/type.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
type: string
enum:
- Actualités
- BSO
- CanalU
- Catalogue de formations
- DataGouvFr
- EdCF
- EducPros
- Espace presse
- Hal
- hceres
- IUF
- jorfsearch
- LeMonde
- Lieux inspirants
- mooc
- OE1
- OE2
- OE3
- official
- Onisep
- Page avec le lien vers l'organigramme
- Page bilan social
- Page histoire
- Page liste des composantes
- Page rapport d'activité
- personal
- Photothèque
- PiaWEB
- POpenData
- rankingLeiden
- rankingQs
- rankingScimago
- rankingShanghai
- rankingThe
- rankingUmultirank
- rankingWebometrics
- scanR
- Service communication
- ServicePublic
- Services généraux
- TalentCNRS
- TheConversation
- website
- websiteCatForm
- websiteDirectory
- websiteGovernance
- websiteOrganizationChart
- websiteRss
- websiteRechercheData
- websiteDataWarehouse
- Wikipedia
30 changes: 30 additions & 0 deletions src/openapi/schemas/weblinks/weblinks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
title: Weblinks
description: Liste des sites web
allOf:
- type: object
properties:
id:
type: string
readOnly: true
description: Unique identifier
pattern: '^[a-zA-Z0-9]{15}$'
resourceId:
type: string
readOnly: true
description: Unique resource identifier
pattern: '^[a-zA-Z0-9]{5}$'
type:
$ref: ../../api.yml#/components/schemas/WeblinksEnum
value:
type: string
active:
type: boolean
startDate:
type: string
nullable: true
pattern: '((^$)|(^\d{4}$)|(^\d{4}-(0[1-9]|1[0-2]))|(^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$))'
endDate:
type: string
nullable: true
pattern: '((^$)|(^\d{4}$)|(^\d{4}-(0[1-9]|1[0-2]))|(^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])$))'
- $ref: '../../api.yml#/components/schemas/Metas'

0 comments on commit 92f0281

Please sign in to comment.