add new apis for test in arvan

release
Amir Hossein Khademi 2024-03-10 09:27:13 +03:30
parent f18c415979
commit 7aa057cd8c
5 changed files with 28 additions and 13 deletions

View File

@ -1 +1 @@
0.17.20.30 0.17.20.32

View File

@ -17,8 +17,8 @@
"TaxesFee": 9 "TaxesFee": 9
}, },
"SiteSettings": { "SiteSettings": {
"BaseUrl": "https://api.vesmook.com", "BaseUrl": "https://api.vesmeh.com",
"AdminPanelBaseUrl": "https://admin.vesmook.com", "AdminPanelBaseUrl": "https://admin.vesmeh.com",
"KaveNegarApiKey": "3735494B4143727A794346457461576A2B4B6668414973424E333561505A694B", "KaveNegarApiKey": "3735494B4143727A794346457461576A2B4B6668414973424E333561505A694B",
"UserSetting": { "UserSetting": {
"Username": "09214802813", "Username": "09214802813",

View File

@ -9,17 +9,32 @@ public class SeedController : ICarterModule
var group = app.NewVersionedApi("Seed") var group = app.NewVersionedApi("Seed")
.MapGroup("api/seed"); .MapGroup("api/seed");
group.MapPost("categories", SeedCategoriesAsync) group.MapGet("test1", () =>
{
return TypedResults.BadRequest(new ApiResult(false, ApiResultStatusCode.ServerError,
"Server Error 1 ( BAD REQUEST )"));
})
.WithDisplayName("SeedCategoriesAsync") .WithDisplayName("SeedCategoriesAsync")
.HasApiVersion(1.0); .HasApiVersion(1.0);
group.MapPost("brands", SeedBrandsAsync) group.MapGet("test2", () =>
.WithDisplayName("SeedBrandsAsync") {
.HasApiVersion(1.0); throw new Exception("Server Error 2 ( EXCEPTION THROWN )");
})
.WithDisplayName("SeedCategoriesAsync")
.HasApiVersion(1.0);
group.MapPost("products",SeedProductsAsync) //group.MapPost("categories", SeedCategoriesAsync)
.WithDisplayName("SeedProductsAsync") // .WithDisplayName("SeedCategoriesAsync")
.HasApiVersion(1.0); // .HasApiVersion(1.0);
//group.MapPost("brands", SeedBrandsAsync)
// .WithDisplayName("SeedBrandsAsync")
// .HasApiVersion(1.0);
//group.MapPost("products",SeedProductsAsync)
// .WithDisplayName("SeedProductsAsync")
// .HasApiVersion(1.0);
} }

View File

@ -6,8 +6,8 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization> <InvariantGlobalization>true</InvariantGlobalization>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<AssemblyVersion>0.17.20.30</AssemblyVersion> <AssemblyVersion>0.17.20.32</AssemblyVersion>
<FileVersion>0.17.20.30</FileVersion> <FileVersion>0.17.20.32</FileVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View File

@ -145,7 +145,7 @@ public class ExceptionHandlerMiddleware
Formatting = Formatting.Indented Formatting = Formatting.Indented
}); });
context.Response.StatusCode = (int)httpStatusCode; context.Response.StatusCode = (int)HttpStatusCode.InternalServerError;
context.Response.ContentType = "application/json"; context.Response.ContentType = "application/json";
await context.Response.WriteAsJsonAsync(result); await context.Response.WriteAsJsonAsync(result);
} }