Feature/02 user system#6
Conversation
…rmissionsController and UsersController
…into matai-project-setup
| else | ||
| { | ||
| // TODO: throw custom exception | ||
| } |
There was a problem hiding this comment.
C'est plus un opinion personnelle qu'autre chose, mais lorsqu'on tente de supprimer une entity qui n'extiste déjà plus on peut retourner true cela fait pas de mal.
| if (role != null) | ||
| { | ||
| _context.Roles.Remove(role); | ||
| _context.SaveChanges(); | ||
| return true; | ||
| } | ||
| else | ||
| { | ||
| // TODO: throw custom exception | ||
| return false; | ||
| } |
There was a problem hiding this comment.
Même principe que plustôt. Moi je retournerai true même si le Role n'existe pas puisqu'au finale on a le résultat voulue.
There was a problem hiding this comment.
Cela s'applique pour la majorité de tes fichier. Ajoute des new line après chaque méthode pour augmenter la lisibilité du code. Tout à l'air pogner ensemble :P
| [HttpGet("Roles")] | ||
| public IActionResult GetRoles() |
There was a problem hiding this comment.
Pour tout tes endpoints tu vas probablement vouloir ajouter plus d'attribue pour rendre ton swagger plus détailler.
| modelBuilder.Entity<Permission>() | ||
| .Property(p => p.Id) | ||
| .ValueGeneratedOnAdd(); | ||
| modelBuilder.Entity<Permission>() | ||
| .HasIndex(p => new { p.System, p.Action }) | ||
| .IsUnique(); |
There was a problem hiding this comment.
Aulieu de mettre la configuration de tes entity directement dans le OnModelCreating. De les grouper dans une class à part. Exemple : https://learn.microsoft.com/en-us/ef/core/modeling/
à longterme cela vas permettre de garder ton DataContext petit et lisible ^^
eabb445 to
1681cb7
Compare
|
| GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
|---|---|---|---|---|---|
| - | Generic Password | 1121af0 | WebAPI/Program.cs | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
No description provided.