Skip to content
This repository was archived by the owner on Jun 9, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion backend/src/Logitar.Portal.Client/BaseClient.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using Logitar.Net.Http;
using Logitar.Portal.Contracts;
using Logitar.Portal.Contracts.Constants;
using Logitar.Portal.Contracts.Errors;

namespace Logitar.Portal.Client;

Expand Down
28 changes: 28 additions & 0 deletions backend/src/Logitar.Portal.Contracts/Error.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
namespace Logitar.Portal.Contracts;

public record Error
{
public string Code { get; set; } = string.Empty;
public string Message { get; set; } = string.Empty;
public Dictionary<string, object?> Data { get; set; } = [];

public Error()
{
}

public Error(string code, string message, IEnumerable<KeyValuePair<string, object?>>? data = null)
{
Code = code;
Message = message;

if (data != null)
{
foreach (KeyValuePair<string, object?> item in data)
{
Data[item.Key] = item.Value;
}
}
}

public override string ToString() => $"{Code}: {Message}";
}
28 changes: 0 additions & 28 deletions backend/src/Logitar.Portal.Contracts/Errors/Error.cs

This file was deleted.

21 changes: 0 additions & 21 deletions backend/src/Logitar.Portal.Contracts/Errors/ErrorData.cs

This file was deleted.

17 changes: 15 additions & 2 deletions backend/src/Logitar.Portal.Web/Controllers/AccountController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@
using Logitar.Portal.Application.Activities;
using Logitar.Portal.Application.Sessions.Commands;
using Logitar.Portal.Application.Users.Commands;
using Logitar.Portal.Contracts.Errors;
using Logitar.Portal.Contracts;
using Logitar.Portal.Contracts.Sessions;
using Logitar.Portal.Contracts.Users;
using Logitar.Portal.Web.Constants;
using Logitar.Portal.Web.Extensions;
using Logitar.Portal.Web.Models.Account;
using Logitar.Portal.Web.Models.Users;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http.Extensions;
using Microsoft.AspNetCore.Mvc;

namespace Logitar.Portal.Web.Controllers;
Expand Down Expand Up @@ -58,7 +59,19 @@ public async Task<ActionResult<SessionModel>> SignInAsync([FromBody] SignInModel
}
catch (InvalidCredentialsException)
{
return BadRequest(new Error("InvalidCredentials", "The specified credentials did not match."));
Error error = new(code: "InvalidCredentials", message: "The specified credentials did not match.");
return Problem(
detail: error.Message,
instance: Request.GetDisplayUrl(),
statusCode: StatusCodes.Status400BadRequest,
title: "Invalid Credentials",
type: null,
extensions: new Dictionary<string, object?>
{
["code"] = error.Code,
["message"] = error.Message,
["data"] = error.Data
});
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ public static class DependencyInjectionExtensions
public static IServiceCollection AddLogitarPortalWeb(this IServiceCollection services)
{
services
.AddControllersWithViews(options =>
{
options.Filters.Add<ExceptionHandling>();
options.Filters.Add<LoggingFilter>();
})
.AddControllersWithViews(options => options.Filters.Add<LoggingFilter>())
.AddJsonOptions(options => options.JsonSerializerOptions.Converters.Add(new JsonStringEnumConverter()));

return services;
Expand Down
122 changes: 0 additions & 122 deletions backend/src/Logitar.Portal.Web/Filters/ExceptionHandling.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Logitar.Portal.Web.Models.Users;

public record EmailModel : IEmail
public record UpdateProfileEmail : IEmail
{
public string Address { get; set; } = string.Empty;
public bool IsVerified { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ public record UpdateProfilePayload
public ChangePasswordModel? Password { get; set; }

public ChangeModel<UpdateProfileAddress>? Address { get; set; }
public ChangeModel<EmailModel>? Email { get; set; }
public ChangeModel<PhoneModel>? Phone { get; set; }
public ChangeModel<UpdateProfileEmail>? Email { get; set; }
public ChangeModel<UpdateProfilePhone>? Phone { get; set; }

public ChangeModel<string>? FirstName { get; set; }
public ChangeModel<string>? MiddleName { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Logitar.Portal.Web.Models.Users;

public record PhoneModel : IPhone
public record UpdateProfilePhone : IPhone
{
public string? CountryCode { get; set; }
public string Number { get; set; } = string.Empty;
Expand Down
28 changes: 0 additions & 28 deletions backend/src/Logitar.Portal.Web/Models/ValidationError.cs

This file was deleted.

4 changes: 2 additions & 2 deletions backend/src/Logitar.Portal.Worker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/runtime:8.0 AS base
FROM mcr.microsoft.com/dotnet/runtime:9.0 AS base
USER app
WORKDIR /app

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["src/Logitar.Portal.Worker/Logitar.Portal.Worker.csproj", "src/Logitar.Portal.Worker/"]
Expand Down
4 changes: 2 additions & 2 deletions backend/src/Logitar.Portal/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base
FROM mcr.microsoft.com/dotnet/aspnet:9.0 AS base
USER app
WORKDIR /app
EXPOSE 8080
EXPOSE 8081

FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY ["src/Logitar.Portal/Logitar.Portal.csproj", "src/Logitar.Portal/"]
Expand Down
Loading