feat: write a dto in a separate project

This commit is contained in:
Polianin Nikita 2024-02-16 23:54:52 +03:00
parent 511c0db3ee
commit 1b8c82949a
10 changed files with 232 additions and 0 deletions

23
ApiDto/ApiDto.csproj Normal file
View File

@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>disable</ImplicitUsings>
<Nullable>enable</Nullable>
<Company>Winsomnia</Company>
<Version>1.0.0-a0</Version>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<AssemblyName>Mirea.Api.Dto</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace>
<GenerateDocumentationFile>True</GenerateDocumentationFile>
<DocumentationFile>ApiDtoDocs.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<None Update="ApiDtoDocs.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

View File

@ -0,0 +1,22 @@
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// Represents basic information about a campus.
/// </summary>
public class CampusBasicInfoResponse
{
/// <summary>
/// Gets or sets the unique identifier of the campus.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets the code name of the campus.
/// </summary>
public required string CodeName { get; set; }
/// <summary>
/// Gets or sets the full name of the campus (optional).
/// </summary>
public string? FullName { get; set; }
}

View File

@ -0,0 +1,27 @@
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// Represents detailed information about a campus.
/// </summary>
public class CampusDetailsResponse
{
/// <summary>
/// Gets or sets the unique identifier of the campus.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets the code name of the campus.
/// </summary>
public required string CodeName { get; set; }
/// <summary>
/// Gets or sets the full name of the campus (optional).
/// </summary>
public string? FullName { get; set; }
/// <summary>
/// Gets or sets the address of the campus (optional).
/// </summary>
public string? Address { get; set; }
}

View File

@ -0,0 +1,17 @@
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// Represents information about a discipline.
/// </summary>
public class DisciplineResponse
{
/// <summary>
/// Gets or sets the unique identifier of the discipline.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets the name of the discipline.
/// </summary>
public required string Name { get; set; }
}

View File

@ -0,0 +1,18 @@
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// A class for providing information about an error
/// </summary>
public class ErrorResponse
{
/// <summary>
/// The text or translation code of the error. This field may not contain information in specific scenarios.
/// For example, it might be empty for HTTP 204 responses where no content is returned or if the validation texts have not been configured.
/// </summary>
public required string Error { get; set; }
/// <summary>
/// In addition to returning the response code in the header, it is also duplicated in this field.
/// Represents the HTTP response code.
/// </summary>
public required int Code { get; set; }
}

View File

@ -0,0 +1,32 @@
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// Represents detailed information about a faculty.
/// </summary>
public class FacultyDetailsResponse
{
/// <summary>
/// Gets or sets the unique identifier of the faculty.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets the name of the faculty.
/// </summary>
public required string Name { get; set; }
/// <summary>
/// Gets or sets the unique identifier of the campus to which the faculty belongs (optional).
/// </summary>
public int? CampusId { get; set; }
/// <summary>
/// Gets or sets the name of the campus to which the faculty belongs (optional).
/// </summary>
public string? CampusName { get; set; }
/// <summary>
/// Gets or sets the code name of the campus to which the faculty belongs (optional).
/// </summary>
public string? CampusCode { get; set; }
}

View File

@ -0,0 +1,22 @@
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// Represents basic information about a faculty.
/// </summary>
public class FacultyResponse
{
/// <summary>
/// Gets or sets the unique identifier of the faculty.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets the name of the faculty.
/// </summary>
public required string Name { get; set; }
/// <summary>
/// Gets or sets the unique identifier of the campus to which the faculty belongs (optional).
/// </summary>
public int? CampusId { get; set; }
}

View File

@ -0,0 +1,27 @@
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// Represents detailed information about a group.
/// </summary>
public class GroupDetailsResponse
{
/// <summary>
/// Gets or sets the unique identifier of the group.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets the name of the group.
/// </summary>
public required string Name { get; set; }
/// <summary>
/// Gets or sets the unique identifier of the faculty to which the group belongs (optional).
/// </summary>
public int? FacultyId { get; set; }
/// <summary>
/// Gets or sets the name of the faculty to which the group belongs (optional).
/// </summary>
public string? FacultyName { get; set; }
}

View File

@ -0,0 +1,22 @@
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// Represents basic information about a group.
/// </summary>
public class GroupResponse
{
/// <summary>
/// Gets or sets the unique identifier of the group.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets the name of the group.
/// </summary>
public required string Name { get; set; }
/// <summary>
/// Gets or sets the unique identifier of the faculty to which the group belongs (optional).
/// </summary>
public int? FacultyId { get; set; }
}

View File

@ -0,0 +1,22 @@
namespace Mirea.Api.Dto.Responses;
/// <summary>
/// Represents information about a professor.
/// </summary>
public class ProfessorResponse
{
/// <summary>
/// Gets or sets the unique identifier of the professor.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets the name of the professor.
/// </summary>
public required string Name { get; set; }
/// <summary>
/// Gets or sets the alternate name of the professor (optional).
/// </summary>
public string? AltName { get; set; }
}