add domain entities
This commit is contained in:
parent
b08ae03fbe
commit
58140b6f70
8
AutobusApi.Domain/Common/EntityBase.cs
Normal file
8
AutobusApi.Domain/Common/EntityBase.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace AutobusApi.Domain.Common;
|
||||
|
||||
public class EntityBase
|
||||
{
|
||||
public required int Id { get; set; }
|
||||
|
||||
public required bool IsDeleted { get; set; }
|
||||
}
|
20
AutobusApi.Domain/Entities/Address.cs
Normal file
20
AutobusApi.Domain/Entities/Address.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
using AutobusApi.Domain.Enums;
|
||||
using AutobusApi.Domain.IEntities;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class Address : EntityBase
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
|
||||
public required ICoordinates Location { get; set; }
|
||||
|
||||
public required VehicleType VehicleType { get; set; }
|
||||
|
||||
public ICollection<RouteAddress> RouteAddresses { get; set; } = null!;
|
||||
|
||||
public required int CityId { get; set; }
|
||||
|
||||
public City City { get; set; } = null!;
|
||||
}
|
16
AutobusApi.Domain/Entities/Aircraft.cs
Normal file
16
AutobusApi.Domain/Entities/Aircraft.cs
Normal file
@ -0,0 +1,16 @@
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class Aircraft : Vehicle
|
||||
{
|
||||
public Vehicle Vehicle { get; set; } = null!;
|
||||
|
||||
public required string Number { get; set; }
|
||||
|
||||
public required string Model { get; set; }
|
||||
|
||||
public required int Capacity { get; set; }
|
||||
|
||||
public required bool HasWiFi { get; set; }
|
||||
|
||||
public required bool HasMultimedia { get; set; }
|
||||
}
|
22
AutobusApi.Domain/Entities/Bus.cs
Normal file
22
AutobusApi.Domain/Entities/Bus.cs
Normal file
@ -0,0 +1,22 @@
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class Bus : Vehicle
|
||||
{
|
||||
public Vehicle Vehicle { get; set; } = null!;
|
||||
|
||||
public required string Number { get; set; }
|
||||
|
||||
public required string Model { get; set; }
|
||||
|
||||
public required int Capacity { get; set; }
|
||||
|
||||
public required bool HasClimateControl { get; set; }
|
||||
|
||||
public required bool HasWC { get; set; }
|
||||
|
||||
public required bool HasWiFi { get; set; }
|
||||
|
||||
public required bool HasMultimedia { get; set; }
|
||||
|
||||
public required bool HasOutlets { get; set; }
|
||||
}
|
19
AutobusApi.Domain/Entities/Carriage.cs
Normal file
19
AutobusApi.Domain/Entities/Carriage.cs
Normal file
@ -0,0 +1,19 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
using AutobusApi.Domain.Enums;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class Carriage : EntityBase
|
||||
{
|
||||
public required CarriageType Type { get; set; }
|
||||
|
||||
public required int Capacity { get; set; }
|
||||
|
||||
public required int Number { get; set; }
|
||||
|
||||
public required bool HasWiFi { get; set; }
|
||||
|
||||
public required bool HasOutlets { get; set; }
|
||||
|
||||
public ICollection<TrainCarriage> TrainCarriage { get; set; } = null!;
|
||||
}
|
14
AutobusApi.Domain/Entities/City.cs
Normal file
14
AutobusApi.Domain/Entities/City.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class City : EntityBase
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
|
||||
public ICollection<Address> Addresses { get; set; } = null!;
|
||||
|
||||
public required int RegionId { get; set; }
|
||||
|
||||
public Region Region { get; set; } = null!;
|
||||
}
|
18
AutobusApi.Domain/Entities/Company.cs
Normal file
18
AutobusApi.Domain/Entities/Company.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class Company : EntityBase
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
|
||||
public required string LegalAddress { get; set; }
|
||||
|
||||
public required string ContactEmail { get; set; }
|
||||
|
||||
public required string ContactPhoneNumber { get; set; }
|
||||
|
||||
public ICollection<Vehicle> Vehicles { get; set; } = null!;
|
||||
|
||||
public ICollection<Employee> Employees { get; set; } = null!;
|
||||
}
|
10
AutobusApi.Domain/Entities/Country.cs
Normal file
10
AutobusApi.Domain/Entities/Country.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class Country : EntityBase
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
|
||||
public ICollection<Region> Regions { get; set; } = null!;
|
||||
}
|
25
AutobusApi.Domain/Entities/Employee.cs
Normal file
25
AutobusApi.Domain/Entities/Employee.cs
Normal file
@ -0,0 +1,25 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
using AutobusApi.Domain.Enums;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class Employee : EntityBase
|
||||
{
|
||||
public required string FisrtName { get; set; }
|
||||
|
||||
public required string LastName { get; set; }
|
||||
|
||||
public required string Patronymic { get; set; }
|
||||
|
||||
public required Sex Sex { get; set; }
|
||||
|
||||
public required DateOnly BirthDate { get; set; }
|
||||
|
||||
public required int EmployerCompanyId { get; set; }
|
||||
|
||||
public Company EmployerCompany { get; set; } = null!;
|
||||
|
||||
public ICollection<EmployeeDocument> Documents { get; set; } = null!;
|
||||
|
||||
public ICollection<VehicleEnrollmentEmployee> Shifts { get; set; } = null!;
|
||||
}
|
15
AutobusApi.Domain/Entities/EmployeeDocument.cs
Normal file
15
AutobusApi.Domain/Entities/EmployeeDocument.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
using AutobusApi.Domain.Enums;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class EmployeeDocument : EntityBase
|
||||
{
|
||||
public required EmployeeDocumentType Type { get; set; }
|
||||
|
||||
public required string Information { get; set; }
|
||||
|
||||
public required int EmployeeId { get; set; }
|
||||
|
||||
public Employee Employee { get; set; } = null!;
|
||||
}
|
14
AutobusApi.Domain/Entities/Region.cs
Normal file
14
AutobusApi.Domain/Entities/Region.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class Region : EntityBase
|
||||
{
|
||||
public required string Name { get; set; }
|
||||
|
||||
public ICollection<City> Cities { get; set; } = null!;
|
||||
|
||||
public required int CountryId { get; set; }
|
||||
|
||||
public Country Country { get; set; } = null!;
|
||||
}
|
20
AutobusApi.Domain/Entities/Review.cs
Normal file
20
AutobusApi.Domain/Entities/Review.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class Review : EntityBase
|
||||
{
|
||||
public required int Rating { get; set; }
|
||||
|
||||
public required string? Comment { get; set; }
|
||||
|
||||
public required DateTime PostDateTimeUtc { get; set; }
|
||||
|
||||
public required int UserId { get; set; }
|
||||
|
||||
public User User { get; set; } = null!;
|
||||
|
||||
public required int VehicleEnrollmentId { get; set; }
|
||||
|
||||
public VehicleEnrollment VehicleEnrollment { get; set; } = null!;
|
||||
}
|
10
AutobusApi.Domain/Entities/Route.cs
Normal file
10
AutobusApi.Domain/Entities/Route.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class Route : EntityBase
|
||||
{
|
||||
public ICollection<RouteAddress> RouteAddresses { get; set; } = null!;
|
||||
|
||||
public ICollection<VehicleEnrollment> VehicleEnrollments { get; set; } = null!;
|
||||
}
|
18
AutobusApi.Domain/Entities/RouteAddress.cs
Normal file
18
AutobusApi.Domain/Entities/RouteAddress.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class RouteAddress : EntityBase
|
||||
{
|
||||
public required int Order { get; set; }
|
||||
|
||||
public required int AddressId { get; set; }
|
||||
|
||||
public Address Address { get; set; } = null!;
|
||||
|
||||
public required int RouteId { get; set; }
|
||||
|
||||
public Route Route { get; set; } = null!;
|
||||
|
||||
public ICollection<RouteAddressDetails> RouteAddressDetails { get; set; } = null!;
|
||||
}
|
20
AutobusApi.Domain/Entities/RouteAddressDetails.cs
Normal file
20
AutobusApi.Domain/Entities/RouteAddressDetails.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class RouteAddressDetails : EntityBase
|
||||
{
|
||||
public required TimeSpan TimeToNextAddress { get; set; }
|
||||
|
||||
public required double CostToNextAddress { get; set; }
|
||||
|
||||
public required TimeSpan CurrentAddressStopTime { get; set; }
|
||||
|
||||
public required int RouteAddressId { get; set; }
|
||||
|
||||
public RouteAddress RouteAddress { get; set; } = null!;
|
||||
|
||||
public required int VehicleEnrollmentId { get; set; }
|
||||
|
||||
public VehicleEnrollment VehicleEnrollment { get; set; } = null!;
|
||||
}
|
14
AutobusApi.Domain/Entities/Ticket.cs
Normal file
14
AutobusApi.Domain/Entities/Ticket.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class Ticket : EntityBase
|
||||
{
|
||||
public required int TicketGroupId { get; set; }
|
||||
|
||||
public TicketGroup TicketGroup { get; set; } = null!;
|
||||
|
||||
public required int VehicleEnrollmentId { get; set; }
|
||||
|
||||
public VehicleEnrollment VehicleEnrollment { get; set; } = null!;
|
||||
}
|
15
AutobusApi.Domain/Entities/TicketDocument.cs
Normal file
15
AutobusApi.Domain/Entities/TicketDocument.cs
Normal file
@ -0,0 +1,15 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
using AutobusApi.Domain.Enums;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class TicketDocument : EntityBase
|
||||
{
|
||||
public required TicketDocumentType Type { get; set; }
|
||||
|
||||
public required string Information { get; set; }
|
||||
|
||||
public required int TicketGroupId { get; set; }
|
||||
|
||||
public TicketGroup TicketGroup { get; set; } = null!;
|
||||
}
|
39
AutobusApi.Domain/Entities/TicketGroup.cs
Normal file
39
AutobusApi.Domain/Entities/TicketGroup.cs
Normal file
@ -0,0 +1,39 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
using AutobusApi.Domain.Enums;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class TicketGroup : EntityBase
|
||||
{
|
||||
public required string BuyerFirstName { get; set; }
|
||||
|
||||
public required string BuyerLastName { get; set; }
|
||||
|
||||
public required string BuyerPhoneNumber { get; set; }
|
||||
|
||||
public required string BuyerEmailAddress { get; set; }
|
||||
|
||||
public required string PassengerFirstName { get; set; }
|
||||
|
||||
public required string PassengerLastName { get; set; }
|
||||
|
||||
public required string PassengerPatronymic { get; set; }
|
||||
|
||||
public required Sex PassengerSex { get; set; }
|
||||
|
||||
public required DateOnly PassengerBirthDate { get; set; }
|
||||
|
||||
public required DateTime PurchaseDateTimeUtc { get; set; }
|
||||
|
||||
public required bool IsReturned { get; set; }
|
||||
|
||||
public int? UserId { get; set; }
|
||||
|
||||
public User? User { get; set; }
|
||||
|
||||
public required int TicketDocumentId { get; set; }
|
||||
|
||||
public TicketDocument TicketDocument { get; set; } = null!;
|
||||
|
||||
public ICollection<Ticket> Tickets { get; set; } = null!;
|
||||
}
|
10
AutobusApi.Domain/Entities/Train.cs
Normal file
10
AutobusApi.Domain/Entities/Train.cs
Normal file
@ -0,0 +1,10 @@
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class Train : Vehicle
|
||||
{
|
||||
public Vehicle Vehicle { get; set; } = null!;
|
||||
|
||||
public required string Number { get; set; }
|
||||
|
||||
public ICollection<TrainCarriage> TrainCarriage { get; set; } = null!;
|
||||
}
|
14
AutobusApi.Domain/Entities/TrainCarriage.cs
Normal file
14
AutobusApi.Domain/Entities/TrainCarriage.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class TrainCarriage : EntityBase
|
||||
{
|
||||
public required int TrainId { get; set; }
|
||||
|
||||
public Train Train { get; set; } = null!;
|
||||
|
||||
public required int CarriageId { get; set; }
|
||||
|
||||
public Carriage Carriage { get; set; } = null!;
|
||||
}
|
10
AutobusApi.Domain/Entities/User.cs
Normal file
10
AutobusApi.Domain/Entities/User.cs
Normal file
@ -0,0 +1,10 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class User : EntityBase
|
||||
{
|
||||
public ICollection<TicketGroup> TicketGroups { get; set; } = null!;
|
||||
|
||||
public ICollection<Review> Reviews { get; set; } = null!;
|
||||
}
|
12
AutobusApi.Domain/Entities/Vehicle.cs
Normal file
12
AutobusApi.Domain/Entities/Vehicle.cs
Normal file
@ -0,0 +1,12 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class Vehicle : EntityBase
|
||||
{
|
||||
public required int CompanyId { get; set; }
|
||||
|
||||
public Company Company { get; set; } = null!;
|
||||
|
||||
public ICollection<VehicleEnrollment> Enrollments { get; set; } = null!;
|
||||
}
|
24
AutobusApi.Domain/Entities/VehicleEnrollment.cs
Normal file
24
AutobusApi.Domain/Entities/VehicleEnrollment.cs
Normal file
@ -0,0 +1,24 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class VehicleEnrollment : EntityBase
|
||||
{
|
||||
public required DateTime DepartureDateTimeUtc { get; set; }
|
||||
|
||||
public required int VehicleId { get; set; }
|
||||
|
||||
public Vehicle Vehicle { get; set; } = null!;
|
||||
|
||||
public required int RouteId { get; set; }
|
||||
|
||||
public Route Route { get; set; } = null!;
|
||||
|
||||
public ICollection<RouteAddressDetails> RouteAddressDetails { get; set; } = null!;
|
||||
|
||||
public ICollection<VehicleEnrollmentEmployee> Crew { get; set; } = null!;
|
||||
|
||||
public ICollection<Ticket> Tickets { get; set; } = null!;
|
||||
|
||||
public ICollection<Review> Reviews { get; set; } = null!;
|
||||
}
|
14
AutobusApi.Domain/Entities/VehicleEnrollmentEmployee.cs
Normal file
14
AutobusApi.Domain/Entities/VehicleEnrollmentEmployee.cs
Normal file
@ -0,0 +1,14 @@
|
||||
using AutobusApi.Domain.Common;
|
||||
|
||||
namespace AutobusApi.Domain.Entities;
|
||||
|
||||
public class VehicleEnrollmentEmployee : EntityBase
|
||||
{
|
||||
public required int EmployeeId { get; set; }
|
||||
|
||||
public Employee Employee { get; set; } = null!;
|
||||
|
||||
public required int VehicleEnrollmentId { get; set; }
|
||||
|
||||
public VehicleEnrollment VehicleEnrollment { get; set; } = null!;
|
||||
}
|
7
AutobusApi.Domain/Enums/CarriageType.cs
Normal file
7
AutobusApi.Domain/Enums/CarriageType.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace AutobusApi.Domain.Enums;
|
||||
|
||||
public enum CarriageType
|
||||
{
|
||||
Coupe = 0,
|
||||
ReservedSeat = 1
|
||||
}
|
6
AutobusApi.Domain/Enums/EmployeeDocumentType.cs
Normal file
6
AutobusApi.Domain/Enums/EmployeeDocumentType.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace AutobusApi.Domain.Enums;
|
||||
|
||||
public enum EmployeeDocumentType
|
||||
{
|
||||
Passport = 0
|
||||
}
|
7
AutobusApi.Domain/Enums/Sex.cs
Normal file
7
AutobusApi.Domain/Enums/Sex.cs
Normal file
@ -0,0 +1,7 @@
|
||||
namespace AutobusApi.Domain.Enums;
|
||||
|
||||
public enum Sex
|
||||
{
|
||||
Male = 0,
|
||||
Female = 1,
|
||||
}
|
6
AutobusApi.Domain/Enums/TicketDocumentType.cs
Normal file
6
AutobusApi.Domain/Enums/TicketDocumentType.cs
Normal file
@ -0,0 +1,6 @@
|
||||
namespace AutobusApi.Domain.Enums;
|
||||
|
||||
public enum TicketDocumentType
|
||||
{
|
||||
Passport = 0
|
||||
}
|
8
AutobusApi.Domain/Enums/VehicleType.cs
Normal file
8
AutobusApi.Domain/Enums/VehicleType.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace AutobusApi.Domain.Enums;
|
||||
|
||||
public enum VehicleType
|
||||
{
|
||||
Bus = 0,
|
||||
Train = 1,
|
||||
Aircraft = 2
|
||||
}
|
8
AutobusApi.Domain/IEntities/ICoordinates.cs
Normal file
8
AutobusApi.Domain/IEntities/ICoordinates.cs
Normal file
@ -0,0 +1,8 @@
|
||||
namespace AutobusApi.Domain.IEntities;
|
||||
|
||||
public interface ICoordinates
|
||||
{
|
||||
double Latitude { get; }
|
||||
|
||||
double Longitude { get; }
|
||||
}
|
Loading…
Reference in New Issue
Block a user