Skip to content

Commit

Permalink
fix: update signalement openapi client
Browse files Browse the repository at this point in the history
  • Loading branch information
MaGOs92 committed Jun 27, 2024
1 parent 4f796b3 commit 4867d2f
Show file tree
Hide file tree
Showing 14 changed files with 48 additions and 54 deletions.
26 changes: 0 additions & 26 deletions components/signalement/signalement-viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,32 +143,6 @@ function SignalementViewer({
</Paragraph>
)}

{signalement.author && (
<Paragraph
background="white"
padding={8}
borderRadius={8}
marginBottom={8}
width="100%"
>
<h3>Auteur du signalement</h3>
<Pane display="flex">
<Pane marginRight={20}>
<h4>Nom</h4>
<div>{signalement.author?.lastName}</div>
</Pane>
<Pane marginRight={20}>
<h4>Prénom</h4>
<div>{signalement.author?.firstName}</div>
</Pane>
<Pane>
<h4>Email</h4>
<div>{signalement.author?.email}</div>
</Pane>
</Pane>
</Paragraph>
)}

<style jsx>{`
h3,
h4,
Expand Down
4 changes: 2 additions & 2 deletions contexts/signalement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ export function SignalementContextProvider(props: ChildrenProps) {
const { token } = useContext(TokenContext);

const fetchSignalements = useCallback(async () => {
const signalements = await SignalementsService.getSignalements(
const paginatedSignalements = await SignalementsService.getSignalements(
baseLocale.commune,
undefined,
undefined,
Signalement.status.PENDING
);
setSignalements(signalements);
setSignalements(paginatedSignalements.data);
}, [baseLocale.commune]);

useEffect(() => {
Expand Down
1 change: 1 addition & 0 deletions lib/openapi-signalement/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export { ExistingNumero } from './models/ExistingNumero';
export { ExistingToponyme } from './models/ExistingToponyme';
export { ExistingVoie } from './models/ExistingVoie';
export type { ObjectId } from './models/ObjectId';
export type { PaginatedSignalementsDTO } from './models/PaginatedSignalementsDTO';
export type { Point } from './models/Point';
export { Position } from './models/Position';
export { Signalement } from './models/Signalement';
Expand Down
4 changes: 1 addition & 3 deletions lib/openapi-signalement/models/Author.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
/* eslint-disable */

export type Author = {
firstName?: string | null;
lastName?: string | null;
email: string;
email?: string | null;
};

4 changes: 1 addition & 3 deletions lib/openapi-signalement/models/AuthorDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@
/* eslint-disable */

export type AuthorDTO = {
firstName?: string | null;
lastName?: string | null;
email: string;
email?: string | null;
captchaToken: string;
};

1 change: 1 addition & 0 deletions lib/openapi-signalement/models/ExistingLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

export type ExistingLocation = {
type: ExistingLocation.type;
banId?: string | null;
};

export namespace ExistingLocation {
Expand Down
1 change: 1 addition & 0 deletions lib/openapi-signalement/models/ExistingNumero.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { Position } from './Position';

export type ExistingNumero = {
type: ExistingNumero.type;
banId?: string | null;
numero: number;
suffixe: string;
position: Position;
Expand Down
1 change: 1 addition & 0 deletions lib/openapi-signalement/models/ExistingToponyme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

export type ExistingToponyme = {
type: ExistingToponyme.type;
banId?: string | null;
nom: string;
};

Expand Down
1 change: 1 addition & 0 deletions lib/openapi-signalement/models/ExistingVoie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

export type ExistingVoie = {
type: ExistingVoie.type;
banId?: string | null;
nom: string;
};

Expand Down
14 changes: 14 additions & 0 deletions lib/openapi-signalement/models/PaginatedSignalementsDTO.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* generated using openapi-typescript-codegen -- do no edit */
/* istanbul ignore file */
/* tslint:disable */
/* eslint-disable */

import type { Signalement } from './Signalement';

export type PaginatedSignalementsDTO = {
data: Array<Signalement>;
page: number;
limit: number;
total: number;
};

1 change: 0 additions & 1 deletion lib/openapi-signalement/models/UpdateSignalementDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
/* eslint-disable */

export type UpdateSignalementDTO = {
id: string;
status: UpdateSignalementDTO.status;
};

Expand Down
32 changes: 19 additions & 13 deletions lib/openapi-signalement/services/SignalementsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/* tslint:disable */
/* eslint-disable */
import type { CreateSignalementDTO } from '../models/CreateSignalementDTO';
import type { PaginatedSignalementsDTO } from '../models/PaginatedSignalementsDTO';
import type { Signalement } from '../models/Signalement';
import type { UpdateSignalementDTO } from '../models/UpdateSignalementDTO';

Expand All @@ -20,7 +21,7 @@ export class SignalementsService {
* @param status
* @param limit
* @param page
* @returns any[]
* @returns PaginatedSignalementsDTO
* @throws ApiError
*/
public static getSignalements(
Expand All @@ -30,7 +31,7 @@ export class SignalementsService {
status?: 'PENDING' | 'IGNORED' | 'PROCESSED',
limit?: number,
page?: number,
): CancelablePromise<any[]> {
): CancelablePromise<PaginatedSignalementsDTO> {
return __request(OpenAPI, {
method: 'GET',
url: '/signalements',
Expand Down Expand Up @@ -68,37 +69,42 @@ export class SignalementsService {
}

/**
* Update a given signalement
* @param requestBody
* Get signalement by id
* @param idSignalement
* @returns Signalement
* @throws ApiError
*/
public static updateSignalement(
requestBody: UpdateSignalementDTO,
public static getSignalementById(
idSignalement: string,
): CancelablePromise<Signalement> {
return __request(OpenAPI, {
method: 'PUT',
url: '/signalements',
body: requestBody,
mediaType: 'application/json',
method: 'GET',
url: '/signalements/{idSignalement}',
path: {
'idSignalement': idSignalement,
},
});
}

/**
* Get signalement by id
* Update a given signalement
* @param idSignalement
* @param requestBody
* @returns Signalement
* @throws ApiError
*/
public static getSignalementById(
public static updateSignalement(
idSignalement: string,
requestBody: UpdateSignalementDTO,
): CancelablePromise<Signalement> {
return __request(OpenAPI, {
method: 'GET',
method: 'PUT',
url: '/signalements/{idSignalement}',
path: {
'idSignalement': idSignalement,
},
body: requestBody,
mediaType: 'application/json',
});
}

Expand Down
8 changes: 4 additions & 4 deletions lib/openapi-signalement/services/SourcesService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,18 +48,18 @@ export class SourcesService {

/**
* Get source by id
* @param id
* @param idSource
* @returns Source
* @throws ApiError
*/
public static getSourceById(
id: string,
idSource: string,
): CancelablePromise<Source> {
return __request(OpenAPI, {
method: 'GET',
url: '/sources/{id}',
url: '/sources/{idSource}',
path: {
'id': id,
'idSource': idSource,
},
});
}
Expand Down
4 changes: 2 additions & 2 deletions pages/bal/[balId]/signalements/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,13 @@ function SignalementsPage({ baseLocale, signalements: initialSignalements }) {
}, [signalements]);

Check warning on line 74 in pages/bal/[balId]/signalements/index.tsx

View workflow job for this annotation

GitHub Actions / build (16.x)

React Hook useEffect has missing dependencies: 'addMarker', 'disableMarkers', and 'handleSelectSignalement'. Either include them or remove the dependency array

Check warning on line 74 in pages/bal/[balId]/signalements/index.tsx

View workflow job for this annotation

GitHub Actions / build (18.x)

React Hook useEffect has missing dependencies: 'addMarker', 'disableMarkers', and 'handleSelectSignalement'. Either include them or remove the dependency array

Check warning on line 74 in pages/bal/[balId]/signalements/index.tsx

View workflow job for this annotation

GitHub Actions / build (20.x)

React Hook useEffect has missing dependencies: 'addMarker', 'disableMarkers', and 'handleSelectSignalement'. Either include them or remove the dependency array

Check warning on line 74 in pages/bal/[balId]/signalements/index.tsx

View workflow job for this annotation

GitHub Actions / build (22.x)

React Hook useEffect has missing dependencies: 'addMarker', 'disableMarkers', and 'handleSelectSignalement'. Either include them or remove the dependency array

const updateSignalements = async () => {
const signalements = await SignalementsService.getSignalements(
const paginatedSignalements = await SignalementsService.getSignalements(
baseLocale.commune,
undefined,
undefined,
Signalement.status.PENDING
);
setSignalements(signalements);
setSignalements(paginatedSignalements.data);
};

const handleSelectSignalement = (id) => {
Expand Down

0 comments on commit 4867d2f

Please sign in to comment.