Release v1.0.0 #16
.envDbInitializer.csDependencyInjection.csPersistence.csprojUberDbContext.cs
.gitea/workflows
ApiDto
ApiDto.csproj
Common
Requests
Responses
Application
Application.csprojDependencyInjection.cs
Backend.slnCommon
Behaviors
Exceptions
Mappings
Cqrs
Campus
Queries
Discipline
Queries
Faculty
Queries
Group
Queries
LectureHall
Queries
Professor
Queries
Schedule
Interfaces
Domain/Schedule
Campus.csDiscipline.csFaculty.csGroup.csLectureHall.csLesson.csLessonAssociation.csProfessor.csSpecificWeek.csTypeOfOccupation.cs
Endpoint
Common
Attributes
BadRequestResponseAttribute.csLocalhostAttribute.csMaintenanceModeIgnoreAttribute.csNotFoundResponseAttribute.csTokenAuthenticationAttribute.cs
Exceptions
Interfaces
Services
Configuration
EnvironmentManager.cs
General
Swagger
Controllers
BaseController.cs
Endpoint.csprojConfiguration
V1
CampusController.csDisciplineController.csFacultyController.csGroupController.csLectureHallController.csProfessorController.csScheduleController.cs
WeatherForecastController.csMiddleware
Program.csWeatherForecast.csPersistence
Contexts
Schedule
EntityTypeConfigurations
Schedule
45
ApiDto/Requests/Configuration/EmailRequest.cs
Normal file
45
ApiDto/Requests/Configuration/EmailRequest.cs
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
|
||||||
|
namespace Mirea.Api.Dto.Requests.Configuration;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents a request to configure email settings.
|
||||||
|
/// </summary>
|
||||||
|
public class EmailRequest
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the server address.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string Server { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the email address from which emails will be sent.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string From { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the password for the email account.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string Password { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the port number.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public int Port { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether SSL is enabled.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public bool Ssl { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets the username.
|
||||||
|
/// </summary>
|
||||||
|
[Required]
|
||||||
|
public required string User { get; set; }
|
||||||
|
}
|
@ -214,6 +214,32 @@ public class SetupController(ISetupToken setupToken, IMaintenanceModeNotConfigur
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpPost("SetEmail")]
|
||||||
|
[TokenAuthentication]
|
||||||
|
[BadRequestResponse]
|
||||||
|
public ActionResult<bool> SetEmail([FromBody] EmailRequest? request)
|
||||||
|
{
|
||||||
|
var settings = (request == null) switch
|
||||||
|
{
|
||||||
|
true => new EmailSettings(),
|
||||||
|
false => new EmailSettings
|
||||||
|
{
|
||||||
|
Server = request.Server,
|
||||||
|
From = request.From,
|
||||||
|
Password = request.Password,
|
||||||
|
Port = request.Port,
|
||||||
|
Ssl = request.Ssl,
|
||||||
|
User = request.User
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var general = GeneralConfig;
|
||||||
|
general.EmailSettings = settings;
|
||||||
|
GeneralConfig = general;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user