-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(backend/personnalisations,badkend/referentiels): ajout du calcul…
… de score
- Loading branch information
Showing
77 changed files
with
24,931 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
backend/src/auth/decorators/allow-anonymous-access.decorator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { Reflector } from '@nestjs/core'; | ||
|
||
export const AllowAnonymousAccess = Reflector.createDecorator<boolean>(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { Reflector } from '@nestjs/core'; | ||
|
||
export const AllowPublicAccess = Reflector.createDecorator<boolean>(); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { CommonModule } from '../common/common.module'; | ||
import { CollectiviteController } from './controllers/collectivite.controller'; | ||
import CollectivitesService from './services/collectivites.service'; | ||
import GroupementsService from './services/groupements.service'; | ||
|
||
@Module({ | ||
imports: [CommonModule], | ||
providers: [CollectivitesService, GroupementsService], | ||
exports: [CollectivitesService, GroupementsService], | ||
controllers: [], | ||
controllers: [CollectiviteController], | ||
}) | ||
export class CollectivitesModule {} |
24 changes: 24 additions & 0 deletions
24
backend/src/collectivites/controllers/collectivite.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Controller, Get, Param } from '@nestjs/common'; | ||
import { ApiOkResponse } from '@nestjs/swagger'; | ||
import { AllowPublicAccess } from '../../auth/decorators/allow-public-access.decorator'; | ||
import CollectivitesService from '../services/collectivites.service'; | ||
|
||
/** | ||
* Création des classes de réponse à partir du schema pour générer automatiquement la documentation OpenAPI | ||
*/ | ||
//export class VersionResponseClass extends createZodDto(versionResponseSchema) {} | ||
|
||
@Controller() | ||
export class CollectiviteController { | ||
constructor(private readonly collectiviteService: CollectivitesService) {} | ||
|
||
@AllowPublicAccess() | ||
@Get('collectivites/:collectivite_id') | ||
@ApiOkResponse({ | ||
//type: VersionResponseClass, | ||
description: "Récupération des informations d'une collectivite", | ||
}) | ||
async getCollectivite(@Param('collectivite_id') collectiviteId: number) { | ||
return this.collectiviteService.getCollectivite(collectiviteId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { roundTo } from './number.helper'; | ||
|
||
describe('number helper', () => { | ||
describe('roundTo', () => { | ||
it('roundTo for 1.5625', async () => { | ||
expect(roundTo(1.5625, 3)).toBe(1.563); | ||
}); | ||
|
||
it('roundTo for 0.3375', async () => { | ||
expect(roundTo(0.3375, 3)).toBe(0.338); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.