diff --git a/AutobusApi.Domain/Common/EntityBase.cs b/AutobusApi.Domain/Common/EntityBase.cs new file mode 100644 index 0000000..38cd4dc --- /dev/null +++ b/AutobusApi.Domain/Common/EntityBase.cs @@ -0,0 +1,8 @@ +namespace AutobusApi.Domain.Common; + +public class EntityBase +{ + public required int Id { get; set; } + + public required bool IsDeleted { get; set; } +} diff --git a/AutobusApi.Domain/Entities/Address.cs b/AutobusApi.Domain/Entities/Address.cs new file mode 100644 index 0000000..f2594c1 --- /dev/null +++ b/AutobusApi.Domain/Entities/Address.cs @@ -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 RouteAddresses { get; set; } = null!; + + public required int CityId { get; set; } + + public City City { get; set; } = null!; +} diff --git a/AutobusApi.Domain/Entities/Aircraft.cs b/AutobusApi.Domain/Entities/Aircraft.cs new file mode 100644 index 0000000..5148393 --- /dev/null +++ b/AutobusApi.Domain/Entities/Aircraft.cs @@ -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; } +} diff --git a/AutobusApi.Domain/Entities/Bus.cs b/AutobusApi.Domain/Entities/Bus.cs new file mode 100644 index 0000000..3538c26 --- /dev/null +++ b/AutobusApi.Domain/Entities/Bus.cs @@ -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; } +} diff --git a/AutobusApi.Domain/Entities/Carriage.cs b/AutobusApi.Domain/Entities/Carriage.cs new file mode 100644 index 0000000..d737a48 --- /dev/null +++ b/AutobusApi.Domain/Entities/Carriage.cs @@ -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 { get; set; } = null!; +} diff --git a/AutobusApi.Domain/Entities/City.cs b/AutobusApi.Domain/Entities/City.cs new file mode 100644 index 0000000..ac50496 --- /dev/null +++ b/AutobusApi.Domain/Entities/City.cs @@ -0,0 +1,14 @@ +using AutobusApi.Domain.Common; + +namespace AutobusApi.Domain.Entities; + +public class City : EntityBase +{ + public required string Name { get; set; } + + public ICollection
Addresses { get; set; } = null!; + + public required int RegionId { get; set; } + + public Region Region { get; set; } = null!; +} diff --git a/AutobusApi.Domain/Entities/Company.cs b/AutobusApi.Domain/Entities/Company.cs new file mode 100644 index 0000000..1ff4d97 --- /dev/null +++ b/AutobusApi.Domain/Entities/Company.cs @@ -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 Vehicles { get; set; } = null!; + + public ICollection Employees { get; set; } = null!; +} diff --git a/AutobusApi.Domain/Entities/Country.cs b/AutobusApi.Domain/Entities/Country.cs new file mode 100644 index 0000000..ddb860e --- /dev/null +++ b/AutobusApi.Domain/Entities/Country.cs @@ -0,0 +1,10 @@ +using AutobusApi.Domain.Common; + +namespace AutobusApi.Domain.Entities; + +public class Country : EntityBase +{ + public required string Name { get; set; } + + public ICollection Regions { get; set; } = null!; +} diff --git a/AutobusApi.Domain/Entities/Employee.cs b/AutobusApi.Domain/Entities/Employee.cs new file mode 100644 index 0000000..6e32101 --- /dev/null +++ b/AutobusApi.Domain/Entities/Employee.cs @@ -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 Documents { get; set; } = null!; + + public ICollection Shifts { get; set; } = null!; +} diff --git a/AutobusApi.Domain/Entities/EmployeeDocument.cs b/AutobusApi.Domain/Entities/EmployeeDocument.cs new file mode 100644 index 0000000..2fda8e5 --- /dev/null +++ b/AutobusApi.Domain/Entities/EmployeeDocument.cs @@ -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!; +} diff --git a/AutobusApi.Domain/Entities/Region.cs b/AutobusApi.Domain/Entities/Region.cs new file mode 100644 index 0000000..6fc3d39 --- /dev/null +++ b/AutobusApi.Domain/Entities/Region.cs @@ -0,0 +1,14 @@ +using AutobusApi.Domain.Common; + +namespace AutobusApi.Domain.Entities; + +public class Region : EntityBase +{ + public required string Name { get; set; } + + public ICollection Cities { get; set; } = null!; + + public required int CountryId { get; set; } + + public Country Country { get; set; } = null!; +} diff --git a/AutobusApi.Domain/Entities/Review.cs b/AutobusApi.Domain/Entities/Review.cs new file mode 100644 index 0000000..485eace --- /dev/null +++ b/AutobusApi.Domain/Entities/Review.cs @@ -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!; +} diff --git a/AutobusApi.Domain/Entities/Route.cs b/AutobusApi.Domain/Entities/Route.cs new file mode 100644 index 0000000..5280297 --- /dev/null +++ b/AutobusApi.Domain/Entities/Route.cs @@ -0,0 +1,10 @@ +using AutobusApi.Domain.Common; + +namespace AutobusApi.Domain.Entities; + +public class Route : EntityBase +{ + public ICollection RouteAddresses { get; set; } = null!; + + public ICollection VehicleEnrollments { get; set; } = null!; +} diff --git a/AutobusApi.Domain/Entities/RouteAddress.cs b/AutobusApi.Domain/Entities/RouteAddress.cs new file mode 100644 index 0000000..50b3bbe --- /dev/null +++ b/AutobusApi.Domain/Entities/RouteAddress.cs @@ -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 { get; set; } = null!; +} diff --git a/AutobusApi.Domain/Entities/RouteAddressDetails.cs b/AutobusApi.Domain/Entities/RouteAddressDetails.cs new file mode 100644 index 0000000..bcc73a8 --- /dev/null +++ b/AutobusApi.Domain/Entities/RouteAddressDetails.cs @@ -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!; +} diff --git a/AutobusApi.Domain/Entities/Ticket.cs b/AutobusApi.Domain/Entities/Ticket.cs new file mode 100644 index 0000000..03e7017 --- /dev/null +++ b/AutobusApi.Domain/Entities/Ticket.cs @@ -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!; +} diff --git a/AutobusApi.Domain/Entities/TicketDocument.cs b/AutobusApi.Domain/Entities/TicketDocument.cs new file mode 100644 index 0000000..9500602 --- /dev/null +++ b/AutobusApi.Domain/Entities/TicketDocument.cs @@ -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!; +} diff --git a/AutobusApi.Domain/Entities/TicketGroup.cs b/AutobusApi.Domain/Entities/TicketGroup.cs new file mode 100644 index 0000000..00125b6 --- /dev/null +++ b/AutobusApi.Domain/Entities/TicketGroup.cs @@ -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 Tickets { get; set; } = null!; +} diff --git a/AutobusApi.Domain/Entities/Train.cs b/AutobusApi.Domain/Entities/Train.cs new file mode 100644 index 0000000..f3a07ec --- /dev/null +++ b/AutobusApi.Domain/Entities/Train.cs @@ -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 { get; set; } = null!; +} diff --git a/AutobusApi.Domain/Entities/TrainCarriage.cs b/AutobusApi.Domain/Entities/TrainCarriage.cs new file mode 100644 index 0000000..cc41180 --- /dev/null +++ b/AutobusApi.Domain/Entities/TrainCarriage.cs @@ -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!; +} diff --git a/AutobusApi.Domain/Entities/User.cs b/AutobusApi.Domain/Entities/User.cs new file mode 100644 index 0000000..858f56f --- /dev/null +++ b/AutobusApi.Domain/Entities/User.cs @@ -0,0 +1,10 @@ +using AutobusApi.Domain.Common; + +namespace AutobusApi.Domain.Entities; + +public class User : EntityBase +{ + public ICollection TicketGroups { get; set; } = null!; + + public ICollection Reviews { get; set; } = null!; +} diff --git a/AutobusApi.Domain/Entities/Vehicle.cs b/AutobusApi.Domain/Entities/Vehicle.cs new file mode 100644 index 0000000..3bd58ac --- /dev/null +++ b/AutobusApi.Domain/Entities/Vehicle.cs @@ -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 Enrollments { get; set; } = null!; +} diff --git a/AutobusApi.Domain/Entities/VehicleEnrollment.cs b/AutobusApi.Domain/Entities/VehicleEnrollment.cs new file mode 100644 index 0000000..ebf9c71 --- /dev/null +++ b/AutobusApi.Domain/Entities/VehicleEnrollment.cs @@ -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 { get; set; } = null!; + + public ICollection Crew { get; set; } = null!; + + public ICollection Tickets { get; set; } = null!; + + public ICollection Reviews { get; set; } = null!; +} diff --git a/AutobusApi.Domain/Entities/VehicleEnrollmentEmployee.cs b/AutobusApi.Domain/Entities/VehicleEnrollmentEmployee.cs new file mode 100644 index 0000000..10271b7 --- /dev/null +++ b/AutobusApi.Domain/Entities/VehicleEnrollmentEmployee.cs @@ -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!; +} diff --git a/AutobusApi.Domain/Enums/CarriageType.cs b/AutobusApi.Domain/Enums/CarriageType.cs new file mode 100644 index 0000000..8886894 --- /dev/null +++ b/AutobusApi.Domain/Enums/CarriageType.cs @@ -0,0 +1,7 @@ +namespace AutobusApi.Domain.Enums; + +public enum CarriageType +{ + Coupe = 0, + ReservedSeat = 1 +} diff --git a/AutobusApi.Domain/Enums/EmployeeDocumentType.cs b/AutobusApi.Domain/Enums/EmployeeDocumentType.cs new file mode 100644 index 0000000..4a48798 --- /dev/null +++ b/AutobusApi.Domain/Enums/EmployeeDocumentType.cs @@ -0,0 +1,6 @@ +namespace AutobusApi.Domain.Enums; + +public enum EmployeeDocumentType +{ + Passport = 0 +} diff --git a/AutobusApi.Domain/Enums/Sex.cs b/AutobusApi.Domain/Enums/Sex.cs new file mode 100644 index 0000000..8f89e87 --- /dev/null +++ b/AutobusApi.Domain/Enums/Sex.cs @@ -0,0 +1,7 @@ +namespace AutobusApi.Domain.Enums; + +public enum Sex +{ + Male = 0, + Female = 1, +} diff --git a/AutobusApi.Domain/Enums/TicketDocumentType.cs b/AutobusApi.Domain/Enums/TicketDocumentType.cs new file mode 100644 index 0000000..42750df --- /dev/null +++ b/AutobusApi.Domain/Enums/TicketDocumentType.cs @@ -0,0 +1,6 @@ +namespace AutobusApi.Domain.Enums; + +public enum TicketDocumentType +{ + Passport = 0 +} diff --git a/AutobusApi.Domain/Enums/VehicleType.cs b/AutobusApi.Domain/Enums/VehicleType.cs new file mode 100644 index 0000000..3f250d6 --- /dev/null +++ b/AutobusApi.Domain/Enums/VehicleType.cs @@ -0,0 +1,8 @@ +namespace AutobusApi.Domain.Enums; + +public enum VehicleType +{ + Bus = 0, + Train = 1, + Aircraft = 2 +} diff --git a/AutobusApi.Domain/IEntities/ICoordinates.cs b/AutobusApi.Domain/IEntities/ICoordinates.cs new file mode 100644 index 0000000..f53a7d9 --- /dev/null +++ b/AutobusApi.Domain/IEntities/ICoordinates.cs @@ -0,0 +1,8 @@ +namespace AutobusApi.Domain.IEntities; + +public interface ICoordinates +{ + double Latitude { get; } + + double Longitude { get; } +}