Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(app): New API service #4381

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft

refactor(app): New API service #4381

wants to merge 3 commits into from

Conversation

nicobret
Copy link
Collaborator

Pull Request Title Rules

Pull request format must respect this format:

<type>(<scope>, <scope>...): <Notion ID> or "sentry" - <description>

Allowed types: feat, fix, refactor, chore.
Allowed scopes: release, app, admin, misc, api, all, github, terraform, kb, lib.

Notion ID, followed by a - is mandatory on types refactor, feat and fix.

If you really need to bypass the pull request title validation, you can add the bypass title label to you PR.

Examples of valid PR titles:

  • chore(release): New version 1.3.3.7
  • refactor(api): 1789 - Removed monarchy from codebase
  • fix(api, app, admin): 1981 - User cannot delete each other accounts anymore.
  • fix(api): sentry - Implement capture or fix a bug.

Description

Todo

Checklist

  • ⚠️ My code can have side-effects on other part of the code-base
  • I have added the Plausible tags/events
  • I have performed a self-review of my code (and removed console.log)

Ticket / Issue

Testing instructions

Copy link

codeclimate bot commented Sep 27, 2024

Code Climate has analyzed commit 40ae9ec and detected 0 issues on this pull request.

The test coverage on the diff in this pull request is 100.0% (50% is the threshold).

This pull request will bring the total coverage in the repository to 45.3% (0.0% change).

View more on Code Climate.

Copy link
Collaborator

@achorein achorein left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pour les service je voyais plus quelque chose comme ça https://github.com/betagouv/service-national-universel/blob/fac8a67dc0dca438f110ba242f6e5a79f160e090/admin/src/services/classeService.ts
pour qu'il gère lui même le throw et que côté composant react on gère le catch exception si besoin

return res;
}

async getUser() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

du coup si c'est une api générique, il ne faudrait pas avoir de service user dedans non ?

credentials: RequestCredentials;
}

interface ApiResponse {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utiliser RouteResponseBody depuis la snu-lib

export type RouteResponseBody<T> = { ok: boolean; data?: T; code?: string; message?: string };

const res = await response.json();
return res;
}
async remove(path: string): Promise<ApiResponse> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pourquoi remove alors qu'on utilise le verbe http DELETE ?

return user as YoungDto;
}

async openpdf(path: string, body: unknown) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

downloadPdf plutot non ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants