fix: remove dto from get request, change the wording of error messages

This commit is contained in:
2025-05-31 20:09:56 +02:00
parent a83d8e963a
commit b9a7ca08f5

View File

@@ -1,5 +1,4 @@
using System.Runtime.Intrinsics.Arm;
using System.Security.Cryptography;
using System.Security.Cryptography;
using System.Text;
using Microsoft.EntityFrameworkCore;
using WebApp.Data;
@@ -153,14 +152,14 @@ namespace WebApp.Endpoints
} else
{
// Ma - (ta para UserId <-> SkillId już istnieje w bazie) użytkownik już ma ten skill
return Results.Json(new { message = "User already has this skill" }, statusCode: 400);
return Results.Json(new { message = "You already have this skill!" }, statusCode: 400);
}
return Results.Json(new { message = "Skill added successfully!" }, statusCode: 201);
});
group.MapDelete("/delete_skill", async (SingleSkillDto dto, HttpContext httpContext, ApplicationDbContext context, GeneralUseHelpers guh) =>
group.MapPost("/remove_skill", async (SingleSkillDto dto, HttpContext httpContext, ApplicationDbContext context, GeneralUseHelpers guh) =>
{
// Uzyskaj użytkownika z tokenu
Token? token = await guh.GetTokenFromHTTPContext(httpContext);
@@ -194,13 +193,13 @@ namespace WebApp.Endpoints
else
{
// Ma - (ta para UserId <-> SkillId już istnieje w bazie) użytkownik już ma ten skill
return Results.Json(new { message = "User already has deleted this skill" }, statusCode: 400);
return Results.Json(new { message = "You don't have this skill" }, statusCode: 400);
}
return Results.Json(new { message = "Skill deleted successfully!" }, statusCode: 201);
});
group.MapGet("/get_skills", async (SingleSkillDto dto, HttpContext httpContext, ApplicationDbContext context, GeneralUseHelpers guh) =>
group.MapGet("/get_skills", async (HttpContext httpContext, ApplicationDbContext context, GeneralUseHelpers guh) =>
{
// Uzyskaj użytkownika z tokenu
Token? token = await guh.GetTokenFromHTTPContext(httpContext);