From aefb07402763d2a390a6ab18003e55c9afbb4131 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Tue, 3 Jun 2025 10:28:20 -0300 Subject: [PATCH 01/41] =?UTF-8?q?Adi=C3=A7=C3=A3o=20de=20Diagrama=20de=20c?= =?UTF-8?q?lasses?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adição de Diagrama de classes para entidades --- OneBus.Domain/Entities/Entities.cd | 265 +++++++++++++++++++++++++++++ 1 file changed, 265 insertions(+) create mode 100644 OneBus.Domain/Entities/Entities.cd diff --git a/OneBus.Domain/Entities/Entities.cd b/OneBus.Domain/Entities/Entities.cd new file mode 100644 index 0000000..49fabaa --- /dev/null +++ b/OneBus.Domain/Entities/Entities.cd @@ -0,0 +1,265 @@ + + + + + + AAACAAAAAAAAAAAAACAACAAAAAAAAgAAAAAgAAAAAAA= + Entities\BaseEntity.cs + + + + + + AAAAAAAAAAAAAAAIBEAAAAAACIAwAAAAAAAAhQAAAAA= + Entities\Address.cs + + + + + + AAAJAAAAAAAAAACCAAAAABAABAAAgAAAQAAJAAAAAEA= + Entities\Bus.cs + + + + + + AAIAAAIAAAAEAAAAAAAAAAAADAAAAAABAAAQAgACAAA= + Entities\BusAudit.cs + + + + + + AAJAAABAAAAAAAAAAAAAAAAABAAAEAABAAAAAAACAAA= + Entities\BusOperation.cs + + + + + + QAAAIAAAACAAAAAAAAAAAAQAAIAACBACAAAAIAAAAAA= + Entities\Company.cs + + + + + + QAACAAAEACAAAAAAEAAwQRYAAAAAERACQABAIACAAAA= + Entities\Employee.cs + + + + + + ACAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAACAAA= + Entities\EmployeeGarage.cs + + + + + + AAAAAAAAAAAAAACAAAAAAAAAKAAgAAAAQAAAAAASAAA= + Entities\EmployeeWorkday.cs + + + + + + + + + + + + + + AAAAAAAAAAAgAAAAAAAgAAAAIAAAAAAAAAAAAAAAAAA= + Entities\Feature.cs + + + + + + QAAAAAAAAAIAAAAAAAQAAQQAAAAAABACAAAAJAAAAAA= + Entities\Garage.cs + + + + + + AAIAAABAAAIAAAAIAEAAAAwAAGAQAAAAAQAABAAAAAA= + Entities\Line.cs + + + + + + + + + + + + + + + QAABAAAAAAAAAAAAAAAAAACAAAgAAAACAAAAAAABAAA= + Entities\LineAddress.cs + + + + + + AAAAAAAAAQAAAAAAAAAAQAAAAAgAEAAAAAAAAAABAAA= + Entities\LineTariff.cs + + + + + + + + + + + + + + AAAAAAAACAAAAAAAAAABAAAACAAAAAIBAAAAAAACAAA= + Entities\LineTariffAudit.cs + + + + + + + + + + + + + + + + AAAAAAAAAAAAAACAAAAAAAAAIAggAAAAQAAAAAABAAA= + Entities\LineTime.cs + + + + + + AAAAAAAACAAgAAAAAAAAABAgBAAAgAAAAAAAAFAAAAA= + Entities\Maintenance.cs + + + + + + ACAAAAAAAEAAAAAAQAAIAAQKAAAAAAAIAAAAAAAAAAA= + Entities\Stop.cs + + + + + + + + + + + + + + + + AAAAAAAAAAAAAACAAAAAAAAAAAAEAAAAIAAAAAAAAQA= + Entities\StopTime.cs + + + + + + AABAAAAAACIAAAAAAAAAAAQAAAAACBACAAAAIAAAAAA= + Entities\User.cs + + + + + + + + + + + + + + + AAAAACAAAAIAAAAAAAAAAAQAIAAAAAAAAAAABAAAAAA= + Entities\UserType.cs + + + + + + + + + + + + + + AAAAAAAAAAIAAAQAAAAAAAQAAAAACAAAAAAACAAAAAA= + Entities\UserTypeFeature.cs + + + + + + + + + + + + + + AACAAAAEBAAgQAAAABQBAAACAGAAIBAgEQoDgAwRAgA= + Entities\Vehicle.cs + + + + + + + + + + + + + + ACAEAAAAAAAAAAAAAAAAAAAABAAAgAAAAAAAAAAAAAA= + Entities\VehicleGarage.cs + + + + + + + + + + + + + + AAAAAAAAAAAAAAAAAAAAAAAABAAAgAABABAAAAACAAA= + Entities\VehicleOperation.cs + + + + \ No newline at end of file From 45b183e7d3941ced7325f547ac71845aedc685b1 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 13:45:08 -0300 Subject: [PATCH 02/41] =?UTF-8?q?=F0=9F=A7=B9cleanup:=20Remove=20Migration?= =?UTF-8?q?s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing Migrations folder --- ...0250406013500_InitialMigration.Designer.cs | 1556 --------------- .../20250406013500_InitialMigration.cs | 859 --------- ...250502025328_AddUserTypeTables.Designer.cs | 1705 ----------------- .../20250502025328_AddUserTypeTables.cs | 164 -- .../OneBusDbContextModelSnapshot.cs | 1702 ---------------- 5 files changed, 5986 deletions(-) delete mode 100644 OneBus.Infra.Data/Migrations/20250406013500_InitialMigration.Designer.cs delete mode 100644 OneBus.Infra.Data/Migrations/20250406013500_InitialMigration.cs delete mode 100644 OneBus.Infra.Data/Migrations/20250502025328_AddUserTypeTables.Designer.cs delete mode 100644 OneBus.Infra.Data/Migrations/20250502025328_AddUserTypeTables.cs delete mode 100644 OneBus.Infra.Data/Migrations/OneBusDbContextModelSnapshot.cs diff --git a/OneBus.Infra.Data/Migrations/20250406013500_InitialMigration.Designer.cs b/OneBus.Infra.Data/Migrations/20250406013500_InitialMigration.Designer.cs deleted file mode 100644 index ab7e72b..0000000 --- a/OneBus.Infra.Data/Migrations/20250406013500_InitialMigration.Designer.cs +++ /dev/null @@ -1,1556 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using OneBus.Infra.Data.DbContexts; - -#nullable disable - -namespace OneBus.Infra.Data.Migrations -{ - [DbContext(typeof(OneBusDbContext))] - [Migration("20250406013500_InitialMigration")] - partial class InitialMigration - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.3") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("OneBus.Domain.Entities.Address", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Area") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(false) - .HasColumnType("varchar(100)") - .HasColumnName("Logradouro"); - - b.Property("City") - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("Municipio"); - - b.Property("Complement") - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("Complemento"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Number") - .HasMaxLength(30) - .IsUnicode(false) - .HasColumnType("varchar(30)") - .HasColumnName("Numero"); - - b.Property("PostCode") - .IsRequired() - .HasMaxLength(15) - .IsUnicode(false) - .HasColumnType("varchar(15)") - .HasColumnName("Cep"); - - b.Property("State") - .IsRequired() - .HasMaxLength(4) - .IsUnicode(false) - .HasColumnType("varchar(4)") - .HasColumnName("Estado"); - - b.HasKey("Id"); - - b.HasIndex("PostCode"); - - b.ToTable("Endereco", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Bus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ChassisBrand") - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("MarcaChassi"); - - b.Property("ChassisModel") - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("ModeloChassi"); - - b.Property("ChassisYear") - .HasColumnType("int") - .HasColumnName("AnoChassi"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("FumigateExpiration") - .HasColumnType("date") - .HasColumnName("DetetizacaoVencimento"); - - b.Property("HasLeftDoors") - .HasColumnType("bit") - .HasColumnName("TemPortasEsquerda"); - - b.Property("HasLowFloor") - .HasColumnType("bit") - .HasColumnName("TemPisoBaixo"); - - b.Property("InsuranceExpiration") - .HasColumnType("date") - .HasColumnName("SeguroVencimento"); - - b.Property("ServiceType") - .HasColumnType("tinyint") - .HasColumnName("Servico"); - - b.Property("VehicleId") - .HasColumnType("decimal(20,0)") - .HasColumnName("VeiculoId"); - - b.HasKey("Id"); - - b.HasIndex("VehicleId"); - - b.ToTable("Onibus", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.BusAudit", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("BusId") - .HasColumnType("decimal(20,0)") - .HasColumnName("OnibusId"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("Date") - .HasColumnType("date") - .HasColumnName("Data"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EmployeeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionarioId"); - - b.Property("TotalMileage") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)") - .HasColumnName("TotalQuilometragem"); - - b.Property("TotalMileageToday") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)") - .HasColumnName("TotalQuilometragemDia"); - - b.Property("TotalPassengers") - .HasColumnType("decimal(20,0)") - .HasColumnName("TotalPassageiros"); - - b.Property("TotalPassengersToday") - .HasColumnType("decimal(20,0)") - .HasColumnName("TotalPassageirosDia"); - - b.HasKey("Id"); - - b.HasIndex("BusId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("OnibusAuditoria", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.BusOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("BusId") - .HasColumnType("decimal(20,0)") - .HasColumnName("OnibusId"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("Date") - .HasColumnType("date") - .HasColumnName("Data"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EmployeeWorkDayId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionarioHorarioId"); - - b.Property("LineTimeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("LinhaHorarioId"); - - b.HasKey("Id"); - - b.HasIndex("BusId"); - - b.HasIndex("EmployeeWorkDayId"); - - b.HasIndex("LineTimeId"); - - b.ToTable("OnibusOperacao", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Company", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AddressId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EnderecoId"); - - b.Property("Cnpj") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)"); - - b.Property("Image") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Foto"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)") - .HasColumnName("Nome"); - - b.Property("Phone") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Telefone"); - - b.HasKey("Id"); - - b.HasIndex("AddressId"); - - b.HasIndex("Cnpj"); - - b.HasIndex("Email"); - - b.ToTable("Empresa", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AddressId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EnderecoId"); - - b.Property("BloodType") - .HasColumnType("tinyint") - .HasColumnName("TipoSanguineo"); - - b.Property("CnhCategory") - .HasColumnType("tinyint") - .HasColumnName("CategoriaCnh"); - - b.Property("CnhExpiration") - .HasColumnType("date") - .HasColumnName("ValidadeCnh"); - - b.Property("CnhNumber") - .IsUnicode(false) - .HasColumnType("varchar(900)") - .HasColumnName("NumeroCnh"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .IsUnicode(false) - .HasColumnType("varchar(30)") - .HasColumnName("Codigo"); - - b.Property("Cpf") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)"); - - b.Property("HiringDate") - .HasColumnType("date") - .HasColumnName("DataContratacao"); - - b.Property("Image") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Foto"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)") - .HasColumnName("Nome"); - - b.Property("Phone") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Telefone"); - - b.Property("Rg") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)"); - - b.Property("Role") - .HasColumnType("tinyint") - .HasColumnName("Cargo"); - - b.Property("Status") - .HasColumnType("tinyint") - .HasColumnName("Status"); - - b.HasKey("Id"); - - b.HasIndex("AddressId"); - - b.HasIndex("CnhNumber"); - - b.HasIndex("Code"); - - b.HasIndex("Cpf"); - - b.ToTable("Funcionario", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.EmployeeGarage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EmployeeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionarioId"); - - b.Property("GarageId") - .HasColumnType("decimal(20,0)") - .HasColumnName("GaragemId"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("GarageId"); - - b.ToTable("FuncionarioGaragem", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.EmployeeWorkday", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DayType") - .HasColumnType("tinyint") - .HasColumnName("Dia"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EmployeeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionarioId"); - - b.Property("EndTime") - .HasColumnType("time") - .HasColumnName("HoraFim"); - - b.Property("StartTime") - .HasColumnType("time") - .HasColumnName("HoraInicio"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.ToTable("FuncionarioHorario", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Garage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AddressId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EnderecoId"); - - b.Property("CompanyId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EmpresaId"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Image") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Foto"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)") - .HasColumnName("Nome"); - - b.Property("Phone") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Telefone"); - - b.HasKey("Id"); - - b.HasIndex("AddressId"); - - b.HasIndex("CompanyId"); - - b.ToTable("Garagem", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Line", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CompanyId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EmpresaId"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("MaxNumberBuses") - .HasColumnType("tinyint") - .HasColumnName("NumeroMaximoOnibus"); - - b.Property("Mileage") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)") - .HasColumnName("Quilometragem"); - - b.Property("MinNumberBuses") - .HasColumnType("tinyint") - .HasColumnName("NumeroMinimoOnibus"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)") - .HasColumnName("Nome"); - - b.Property("Number") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Numero"); - - b.Property("TravelTime") - .HasColumnType("time") - .HasColumnName("TempoViagem"); - - b.Property("Type") - .HasColumnType("tinyint") - .HasColumnName("Tipo"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.ToTable("Linha", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineAddress", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AddressId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EnderecoId"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("DirectionLine") - .HasColumnType("tinyint") - .HasColumnName("SentidoLinha"); - - b.Property("LineId") - .HasColumnType("decimal(20,0)") - .HasColumnName("LinhaId"); - - b.HasKey("Id"); - - b.HasIndex("AddressId"); - - b.HasIndex("LineId"); - - b.ToTable("LinhaEndereco", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTariff", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("LineId") - .HasColumnType("decimal(20,0)") - .HasColumnName("LinhaId"); - - b.Property("NumberTickets") - .HasColumnType("int") - .HasColumnName("NumeroBilhetes"); - - b.Property("Price") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)") - .HasColumnName("Preco"); - - b.HasKey("Id"); - - b.HasIndex("LineId"); - - b.ToTable("LinhaTarifa", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTariffAudit", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("Date") - .HasColumnType("date") - .HasColumnName("Data"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EmployeeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionarioId"); - - b.Property("LineTariffId") - .HasColumnType("decimal(20,0)") - .HasColumnName("LinhaTarifaId"); - - b.Property("RemainingTicketsNumber") - .HasColumnType("int") - .HasColumnName("NumeroRestanteBilhetes"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LineTariffId"); - - b.ToTable("LinhaTarifaAuditoria", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTime", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DayType") - .HasColumnType("tinyint") - .HasColumnName("Dia"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EndTime") - .HasColumnType("time") - .HasColumnName("HoraFim"); - - b.Property("LineId") - .HasColumnType("decimal(20,0)") - .HasColumnName("LinhaId"); - - b.Property("StartTime") - .HasColumnType("time") - .HasColumnName("HoraInicio"); - - b.HasKey("Id"); - - b.HasIndex("LineId"); - - b.ToTable("LinhaHorario", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Maintenance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cost") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)") - .HasColumnName("Custo"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(150) - .IsUnicode(false) - .HasColumnType("varchar(150)") - .HasColumnName("Descricao"); - - b.Property("EndDate") - .HasColumnType("date") - .HasColumnName("DataFim"); - - b.Property("Sector") - .HasColumnType("tinyint") - .HasColumnName("Setor"); - - b.Property("StartDate") - .HasColumnType("date") - .HasColumnName("DataInicio"); - - b.Property("SurveyExpiration") - .HasColumnType("date") - .HasColumnName("VistoriaVencimento"); - - b.Property("VehicleId") - .HasColumnType("decimal(20,0)") - .HasColumnName("VeiculoId"); - - b.HasKey("Id"); - - b.HasIndex("VehicleId"); - - b.ToTable("Manutencao", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Stop", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("IsFinalStop") - .HasColumnType("bit") - .HasColumnName("PontoFinal"); - - b.Property("IsInitialStop") - .HasColumnType("bit") - .HasColumnName("PontoInicial"); - - b.Property("Latitude") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)"); - - b.Property("LineAddressId") - .HasColumnType("decimal(20,0)") - .HasColumnName("LinhaEnderecoId"); - - b.Property("Longitude") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)"); - - b.Property("Name") - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("Nome"); - - b.HasKey("Id"); - - b.HasIndex("LineAddressId"); - - b.ToTable("Parada", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.StopTime", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DayType") - .HasColumnType("tinyint") - .HasColumnName("Dia"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("StopId") - .HasColumnType("decimal(20,0)") - .HasColumnName("ParadaId"); - - b.Property("Time") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(false) - .HasColumnType("varchar(100)") - .HasColumnName("Horario"); - - b.HasKey("Id"); - - b.HasIndex("StopId"); - - b.ToTable("ParadaHorario", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CompanyId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EmpresaId"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)"); - - b.Property("Image") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Foto"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)") - .HasColumnName("Nome"); - - b.Property("Password") - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("Senha"); - - b.Property("Phone") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Telefone"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(25) - .IsUnicode(false) - .HasColumnType("varchar(25)") - .HasColumnName("Sal"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.ToTable("Usuario", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Vehicle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AcquisitionDate") - .HasColumnType("date") - .HasColumnName("DataAquisicao"); - - b.Property("AxesNumber") - .HasColumnType("tinyint") - .HasColumnName("NumeroEixos"); - - b.Property("BodyworkNumber") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("NumeroCarroceria"); - - b.Property("Brand") - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("Marca"); - - b.Property("Color") - .HasMaxLength(30) - .IsUnicode(false) - .HasColumnType("varchar(30)") - .HasColumnName("Cor"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EngineNumber") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("NumeroMotor"); - - b.Property("FuelType") - .HasColumnType("tinyint") - .HasColumnName("TipoCombustivel"); - - b.Property("HasAccessibility") - .HasColumnType("bit") - .HasColumnName("TemAcessibilidade"); - - b.Property("Image") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Foto"); - - b.Property("IpvaExpiration") - .HasColumnType("date") - .HasColumnName("IpvaVencimento"); - - b.Property("LicensingExpiration") - .HasColumnType("date") - .HasColumnName("LicenciamentoVencimento"); - - b.Property("Model") - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("Modelo"); - - b.Property("NumberChassis") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("NumeroChassi"); - - b.Property("NumberDoors") - .HasColumnType("tinyint") - .HasColumnName("NumeroPortas"); - - b.Property("NumberSeats") - .HasColumnType("tinyint") - .HasColumnName("NumeroAssentos"); - - b.Property("Plate") - .IsRequired() - .HasMaxLength(15) - .IsUnicode(false) - .HasColumnType("varchar(15)") - .HasColumnName("Placa"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(30) - .IsUnicode(false) - .HasColumnType("varchar(30)") - .HasColumnName("Prefixo"); - - b.Property("Renavam") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)"); - - b.Property("Status") - .HasColumnType("tinyint"); - - b.Property("TransmissionType") - .HasColumnType("tinyint") - .HasColumnName("TipoTransmissao"); - - b.Property("Type") - .HasColumnType("tinyint") - .HasColumnName("Tipo"); - - b.Property("Year") - .HasColumnType("int") - .HasColumnName("Ano"); - - b.HasKey("Id"); - - b.HasIndex("Plate"); - - b.HasIndex("Prefix"); - - b.HasIndex("Renavam"); - - b.ToTable("Veiculo", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.VehicleGarage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("GarageId") - .HasColumnType("decimal(20,0)") - .HasColumnName("GaragemId"); - - b.Property("VehicleId") - .HasColumnType("decimal(20,0)") - .HasColumnName("VeiculoId"); - - b.HasKey("Id"); - - b.HasIndex("GarageId"); - - b.HasIndex("VehicleId"); - - b.ToTable("VeiculoGaragem", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.VehicleOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("Date") - .HasColumnType("date") - .HasColumnName("Data"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EmployeeWorkdayId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionarioHorarioId"); - - b.Property("VehicleId") - .HasColumnType("decimal(20,0)") - .HasColumnName("VeiculoId"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeWorkdayId"); - - b.HasIndex("VehicleId"); - - b.ToTable("VeiculoOperacao", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Bus", b => - { - b.HasOne("OneBus.Domain.Entities.Vehicle", "Vehicle") - .WithMany("Buses") - .HasForeignKey("VehicleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Vehicle"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.BusAudit", b => - { - b.HasOne("OneBus.Domain.Entities.Bus", "Bus") - .WithMany("BusAudits") - .HasForeignKey("BusId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.Employee", "Employee") - .WithMany("BusAudits") - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Bus"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.BusOperation", b => - { - b.HasOne("OneBus.Domain.Entities.Bus", "Bus") - .WithMany("BusOperations") - .HasForeignKey("BusId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.EmployeeWorkday", "EmployeeWorkday") - .WithMany("BusOperations") - .HasForeignKey("EmployeeWorkDayId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.LineTime", "LineTime") - .WithMany("BusOperations") - .HasForeignKey("LineTimeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Bus"); - - b.Navigation("EmployeeWorkday"); - - b.Navigation("LineTime"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Company", b => - { - b.HasOne("OneBus.Domain.Entities.Address", "Address") - .WithMany("Companies") - .HasForeignKey("AddressId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Address"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Employee", b => - { - b.HasOne("OneBus.Domain.Entities.Address", "Address") - .WithMany("Employees") - .HasForeignKey("AddressId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Address"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.EmployeeGarage", b => - { - b.HasOne("OneBus.Domain.Entities.Employee", "Employee") - .WithMany("EmployeeGarages") - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.Garage", "Garage") - .WithMany("EmployeeGarages") - .HasForeignKey("GarageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Garage"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.EmployeeWorkday", b => - { - b.HasOne("OneBus.Domain.Entities.Employee", "Employee") - .WithMany("EmployeeWorkdays") - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Garage", b => - { - b.HasOne("OneBus.Domain.Entities.Address", "Address") - .WithMany("Garages") - .HasForeignKey("AddressId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.Company", "Company") - .WithMany("Garages") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Address"); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Line", b => - { - b.HasOne("OneBus.Domain.Entities.Company", "Company") - .WithMany("Lines") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineAddress", b => - { - b.HasOne("OneBus.Domain.Entities.Address", "Address") - .WithMany("LineAddresses") - .HasForeignKey("AddressId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.Line", "Line") - .WithMany("LineAddresses") - .HasForeignKey("LineId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Address"); - - b.Navigation("Line"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTariff", b => - { - b.HasOne("OneBus.Domain.Entities.Line", "Line") - .WithMany("LineTariffs") - .HasForeignKey("LineId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Line"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTariffAudit", b => - { - b.HasOne("OneBus.Domain.Entities.Employee", "Employee") - .WithMany("LineTariffAudits") - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.LineTariff", "LineTariff") - .WithMany("LineTariffAudits") - .HasForeignKey("LineTariffId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LineTariff"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTime", b => - { - b.HasOne("OneBus.Domain.Entities.Line", "Line") - .WithMany("LineTimes") - .HasForeignKey("LineId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Line"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Maintenance", b => - { - b.HasOne("OneBus.Domain.Entities.Vehicle", "Vehicle") - .WithMany("Maintenances") - .HasForeignKey("VehicleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Vehicle"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Stop", b => - { - b.HasOne("OneBus.Domain.Entities.LineAddress", "LineAddress") - .WithMany("Stops") - .HasForeignKey("LineAddressId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("LineAddress"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.StopTime", b => - { - b.HasOne("OneBus.Domain.Entities.Stop", "Stop") - .WithMany("StopTimes") - .HasForeignKey("StopId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Stop"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.User", b => - { - b.HasOne("OneBus.Domain.Entities.Company", "Company") - .WithMany("Users") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.VehicleGarage", b => - { - b.HasOne("OneBus.Domain.Entities.Garage", "Garage") - .WithMany("VehicleGarages") - .HasForeignKey("GarageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.Vehicle", "Vehicle") - .WithMany("VehicleGarages") - .HasForeignKey("VehicleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Garage"); - - b.Navigation("Vehicle"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.VehicleOperation", b => - { - b.HasOne("OneBus.Domain.Entities.EmployeeWorkday", "EmployeeWorkday") - .WithMany("VehicleOperations") - .HasForeignKey("EmployeeWorkdayId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.Vehicle", "Vehicle") - .WithMany("VehicleOperations") - .HasForeignKey("VehicleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeWorkday"); - - b.Navigation("Vehicle"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Address", b => - { - b.Navigation("Companies"); - - b.Navigation("Employees"); - - b.Navigation("Garages"); - - b.Navigation("LineAddresses"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Bus", b => - { - b.Navigation("BusAudits"); - - b.Navigation("BusOperations"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Company", b => - { - b.Navigation("Garages"); - - b.Navigation("Lines"); - - b.Navigation("Users"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Employee", b => - { - b.Navigation("BusAudits"); - - b.Navigation("EmployeeGarages"); - - b.Navigation("EmployeeWorkdays"); - - b.Navigation("LineTariffAudits"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.EmployeeWorkday", b => - { - b.Navigation("BusOperations"); - - b.Navigation("VehicleOperations"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Garage", b => - { - b.Navigation("EmployeeGarages"); - - b.Navigation("VehicleGarages"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Line", b => - { - b.Navigation("LineAddresses"); - - b.Navigation("LineTariffs"); - - b.Navigation("LineTimes"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineAddress", b => - { - b.Navigation("Stops"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTariff", b => - { - b.Navigation("LineTariffAudits"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTime", b => - { - b.Navigation("BusOperations"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Stop", b => - { - b.Navigation("StopTimes"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Vehicle", b => - { - b.Navigation("Buses"); - - b.Navigation("Maintenances"); - - b.Navigation("VehicleGarages"); - - b.Navigation("VehicleOperations"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/OneBus.Infra.Data/Migrations/20250406013500_InitialMigration.cs b/OneBus.Infra.Data/Migrations/20250406013500_InitialMigration.cs deleted file mode 100644 index 2be4a04..0000000 --- a/OneBus.Infra.Data/Migrations/20250406013500_InitialMigration.cs +++ /dev/null @@ -1,859 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace OneBus.Infra.Data.Migrations -{ - /// - public partial class InitialMigration : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Endereco", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Logradouro = table.Column(type: "varchar(100)", unicode: false, maxLength: 100, nullable: false), - Cep = table.Column(type: "varchar(15)", unicode: false, maxLength: 15, nullable: false), - Municipio = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), - Estado = table.Column(type: "varchar(4)", unicode: false, maxLength: 4, nullable: false), - Numero = table.Column(type: "varchar(30)", unicode: false, maxLength: 30, nullable: true), - Complemento = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: true), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Endereco", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Veiculo", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Tipo = table.Column(type: "tinyint", nullable: false), - Prefixo = table.Column(type: "varchar(30)", unicode: false, maxLength: 30, nullable: false), - NumeroPortas = table.Column(type: "tinyint", nullable: false), - NumeroAssentos = table.Column(type: "tinyint", nullable: false), - TemAcessibilidade = table.Column(type: "bit", nullable: false), - TipoCombustivel = table.Column(type: "tinyint", nullable: false), - Marca = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), - Modelo = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), - Ano = table.Column(type: "int", nullable: false), - Placa = table.Column(type: "varchar(15)", unicode: false, maxLength: 15, nullable: false), - Cor = table.Column(type: "varchar(30)", unicode: false, maxLength: 30, nullable: true), - NumeroCarroceria = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: true), - NumeroChassi = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: true), - NumeroMotor = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: true), - NumeroEixos = table.Column(type: "tinyint", nullable: false), - IpvaVencimento = table.Column(type: "date", nullable: false), - LicenciamentoVencimento = table.Column(type: "date", nullable: false), - Renavam = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: false), - TipoTransmissao = table.Column(type: "tinyint", nullable: false), - DataAquisicao = table.Column(type: "date", nullable: false), - Status = table.Column(type: "tinyint", nullable: false), - Foto = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: true), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Veiculo", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Empresa", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - EnderecoId = table.Column(type: "decimal(20,0)", nullable: false), - Nome = table.Column(type: "varchar(80)", unicode: false, maxLength: 80, nullable: false), - Cnpj = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: false), - Email = table.Column(type: "varchar(80)", unicode: false, maxLength: 80, nullable: false), - Telefone = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: false), - Foto = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: true), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Empresa", x => x.Id); - table.ForeignKey( - name: "FK_Empresa_Endereco_EnderecoId", - column: x => x.EnderecoId, - principalTable: "Endereco", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Funcionario", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - EnderecoId = table.Column(type: "decimal(20,0)", nullable: false), - Nome = table.Column(type: "varchar(80)", unicode: false, maxLength: 80, nullable: false), - Rg = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: false), - Cpf = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: false), - TipoSanguineo = table.Column(type: "tinyint", nullable: true), - Codigo = table.Column(type: "varchar(30)", unicode: false, maxLength: 30, nullable: false), - Cargo = table.Column(type: "tinyint", nullable: false), - Email = table.Column(type: "varchar(80)", unicode: false, maxLength: 80, nullable: false), - Telefone = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: false), - DataContratacao = table.Column(type: "date", nullable: false), - NumeroCnh = table.Column(type: "varchar(900)", unicode: false, nullable: true), - CategoriaCnh = table.Column(type: "tinyint", nullable: true), - ValidadeCnh = table.Column(type: "date", nullable: true), - Status = table.Column(type: "tinyint", nullable: false), - Foto = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: true), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Funcionario", x => x.Id); - table.ForeignKey( - name: "FK_Funcionario_Endereco_EnderecoId", - column: x => x.EnderecoId, - principalTable: "Endereco", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Manutencao", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - VeiculoId = table.Column(type: "decimal(20,0)", nullable: false), - Setor = table.Column(type: "tinyint", nullable: false), - Descricao = table.Column(type: "varchar(150)", unicode: false, maxLength: 150, nullable: false), - DataInicio = table.Column(type: "date", nullable: false), - DataFim = table.Column(type: "date", nullable: false), - VistoriaVencimento = table.Column(type: "date", nullable: false), - Custo = table.Column(type: "decimal(19,4)", precision: 19, scale: 4, nullable: false), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Manutencao", x => x.Id); - table.ForeignKey( - name: "FK_Manutencao_Veiculo_VeiculoId", - column: x => x.VeiculoId, - principalTable: "Veiculo", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Onibus", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - VeiculoId = table.Column(type: "decimal(20,0)", nullable: false), - Servico = table.Column(type: "tinyint", nullable: false), - MarcaChassi = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), - ModeloChassi = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), - AnoChassi = table.Column(type: "int", nullable: false), - TemPisoBaixo = table.Column(type: "bit", nullable: false), - TemPortasEsquerda = table.Column(type: "bit", nullable: false), - SeguroVencimento = table.Column(type: "date", nullable: false), - DetetizacaoVencimento = table.Column(type: "date", nullable: false), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Onibus", x => x.Id); - table.ForeignKey( - name: "FK_Onibus_Veiculo_VeiculoId", - column: x => x.VeiculoId, - principalTable: "Veiculo", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Garagem", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - EmpresaId = table.Column(type: "decimal(20,0)", nullable: false), - EnderecoId = table.Column(type: "decimal(20,0)", nullable: false), - Nome = table.Column(type: "varchar(80)", unicode: false, maxLength: 80, nullable: false), - Telefone = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: false), - Foto = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: true), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Garagem", x => x.Id); - table.ForeignKey( - name: "FK_Garagem_Empresa_EmpresaId", - column: x => x.EmpresaId, - principalTable: "Empresa", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Garagem_Endereco_EnderecoId", - column: x => x.EnderecoId, - principalTable: "Endereco", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Linha", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - EmpresaId = table.Column(type: "decimal(20,0)", nullable: false), - Numero = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: false), - Nome = table.Column(type: "varchar(80)", unicode: false, maxLength: 80, nullable: false), - Tipo = table.Column(type: "tinyint", nullable: false), - TempoViagem = table.Column(type: "time", nullable: false), - Quilometragem = table.Column(type: "decimal(19,4)", precision: 19, scale: 4, nullable: false), - NumeroMinimoOnibus = table.Column(type: "tinyint", nullable: false), - NumeroMaximoOnibus = table.Column(type: "tinyint", nullable: false), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Linha", x => x.Id); - table.ForeignKey( - name: "FK_Linha_Empresa_EmpresaId", - column: x => x.EmpresaId, - principalTable: "Empresa", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Usuario", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - EmpresaId = table.Column(type: "decimal(20,0)", nullable: false), - Nome = table.Column(type: "varchar(80)", unicode: false, maxLength: 80, nullable: false), - Email = table.Column(type: "varchar(80)", unicode: false, maxLength: 80, nullable: false), - Telefone = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: false), - Senha = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: false), - Sal = table.Column(type: "varchar(25)", unicode: false, maxLength: 25, nullable: false), - Foto = table.Column(type: "varchar(20)", unicode: false, maxLength: 20, nullable: true), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Usuario", x => x.Id); - table.ForeignKey( - name: "FK_Usuario_Empresa_EmpresaId", - column: x => x.EmpresaId, - principalTable: "Empresa", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "FuncionarioHorario", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - FuncionarioId = table.Column(type: "decimal(20,0)", nullable: false), - HoraInicio = table.Column(type: "time", nullable: false), - HoraFim = table.Column(type: "time", nullable: false), - Dia = table.Column(type: "tinyint", nullable: false), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_FuncionarioHorario", x => x.Id); - table.ForeignKey( - name: "FK_FuncionarioHorario_Funcionario_FuncionarioId", - column: x => x.FuncionarioId, - principalTable: "Funcionario", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "OnibusAuditoria", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - FuncionarioId = table.Column(type: "decimal(20,0)", nullable: false), - OnibusId = table.Column(type: "decimal(20,0)", nullable: false), - Data = table.Column(type: "date", nullable: false), - TotalPassageiros = table.Column(type: "decimal(20,0)", nullable: false), - TotalPassageirosDia = table.Column(type: "decimal(20,0)", nullable: false), - TotalQuilometragem = table.Column(type: "decimal(19,4)", precision: 19, scale: 4, nullable: false), - TotalQuilometragemDia = table.Column(type: "decimal(19,4)", precision: 19, scale: 4, nullable: false), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_OnibusAuditoria", x => x.Id); - table.ForeignKey( - name: "FK_OnibusAuditoria_Funcionario_FuncionarioId", - column: x => x.FuncionarioId, - principalTable: "Funcionario", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_OnibusAuditoria_Onibus_OnibusId", - column: x => x.OnibusId, - principalTable: "Onibus", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "FuncionarioGaragem", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - FuncionarioId = table.Column(type: "decimal(20,0)", nullable: false), - GaragemId = table.Column(type: "decimal(20,0)", nullable: false), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_FuncionarioGaragem", x => x.Id); - table.ForeignKey( - name: "FK_FuncionarioGaragem_Funcionario_FuncionarioId", - column: x => x.FuncionarioId, - principalTable: "Funcionario", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_FuncionarioGaragem_Garagem_GaragemId", - column: x => x.GaragemId, - principalTable: "Garagem", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "VeiculoGaragem", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - VeiculoId = table.Column(type: "decimal(20,0)", nullable: false), - GaragemId = table.Column(type: "decimal(20,0)", nullable: false), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_VeiculoGaragem", x => x.Id); - table.ForeignKey( - name: "FK_VeiculoGaragem_Garagem_GaragemId", - column: x => x.GaragemId, - principalTable: "Garagem", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_VeiculoGaragem_Veiculo_VeiculoId", - column: x => x.VeiculoId, - principalTable: "Veiculo", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "LinhaEndereco", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - LinhaId = table.Column(type: "decimal(20,0)", nullable: false), - EnderecoId = table.Column(type: "decimal(20,0)", nullable: false), - SentidoLinha = table.Column(type: "tinyint", nullable: false), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_LinhaEndereco", x => x.Id); - table.ForeignKey( - name: "FK_LinhaEndereco_Endereco_EnderecoId", - column: x => x.EnderecoId, - principalTable: "Endereco", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_LinhaEndereco_Linha_LinhaId", - column: x => x.LinhaId, - principalTable: "Linha", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "LinhaHorario", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - LinhaId = table.Column(type: "decimal(20,0)", nullable: false), - HoraInicio = table.Column(type: "time", nullable: false), - HoraFim = table.Column(type: "time", nullable: false), - Dia = table.Column(type: "tinyint", nullable: false), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_LinhaHorario", x => x.Id); - table.ForeignKey( - name: "FK_LinhaHorario_Linha_LinhaId", - column: x => x.LinhaId, - principalTable: "Linha", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "LinhaTarifa", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - LinhaId = table.Column(type: "decimal(20,0)", nullable: false), - Preco = table.Column(type: "decimal(19,4)", precision: 19, scale: 4, nullable: false), - NumeroBilhetes = table.Column(type: "int", nullable: false), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_LinhaTarifa", x => x.Id); - table.ForeignKey( - name: "FK_LinhaTarifa_Linha_LinhaId", - column: x => x.LinhaId, - principalTable: "Linha", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "VeiculoOperacao", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - FuncionarioHorarioId = table.Column(type: "decimal(20,0)", nullable: false), - VeiculoId = table.Column(type: "decimal(20,0)", nullable: false), - Data = table.Column(type: "date", nullable: false), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_VeiculoOperacao", x => x.Id); - table.ForeignKey( - name: "FK_VeiculoOperacao_FuncionarioHorario_FuncionarioHorarioId", - column: x => x.FuncionarioHorarioId, - principalTable: "FuncionarioHorario", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_VeiculoOperacao_Veiculo_VeiculoId", - column: x => x.VeiculoId, - principalTable: "Veiculo", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Parada", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - LinhaEnderecoId = table.Column(type: "decimal(20,0)", nullable: false), - PontoInicial = table.Column(type: "bit", nullable: false), - PontoFinal = table.Column(type: "bit", nullable: false), - Nome = table.Column(type: "varchar(50)", unicode: false, maxLength: 50, nullable: true), - Latitude = table.Column(type: "decimal(19,4)", precision: 19, scale: 4, nullable: false), - Longitude = table.Column(type: "decimal(19,4)", precision: 19, scale: 4, nullable: false), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Parada", x => x.Id); - table.ForeignKey( - name: "FK_Parada_LinhaEndereco_LinhaEnderecoId", - column: x => x.LinhaEnderecoId, - principalTable: "LinhaEndereco", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "OnibusOperacao", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - LinhaHorarioId = table.Column(type: "decimal(20,0)", nullable: false), - FuncionarioHorarioId = table.Column(type: "decimal(20,0)", nullable: false), - OnibusId = table.Column(type: "decimal(20,0)", nullable: false), - Data = table.Column(type: "date", nullable: false), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_OnibusOperacao", x => x.Id); - table.ForeignKey( - name: "FK_OnibusOperacao_FuncionarioHorario_FuncionarioHorarioId", - column: x => x.FuncionarioHorarioId, - principalTable: "FuncionarioHorario", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_OnibusOperacao_LinhaHorario_LinhaHorarioId", - column: x => x.LinhaHorarioId, - principalTable: "LinhaHorario", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_OnibusOperacao_Onibus_OnibusId", - column: x => x.OnibusId, - principalTable: "Onibus", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "LinhaTarifaAuditoria", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - FuncionarioId = table.Column(type: "decimal(20,0)", nullable: false), - LinhaTarifaId = table.Column(type: "decimal(20,0)", nullable: false), - NumeroRestanteBilhetes = table.Column(type: "int", nullable: false), - Data = table.Column(type: "date", nullable: false), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_LinhaTarifaAuditoria", x => x.Id); - table.ForeignKey( - name: "FK_LinhaTarifaAuditoria_Funcionario_FuncionarioId", - column: x => x.FuncionarioId, - principalTable: "Funcionario", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_LinhaTarifaAuditoria_LinhaTarifa_LinhaTarifaId", - column: x => x.LinhaTarifaId, - principalTable: "LinhaTarifa", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "ParadaHorario", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - ParadaId = table.Column(type: "decimal(20,0)", nullable: false), - Horario = table.Column(type: "varchar(100)", unicode: false, maxLength: 100, nullable: false), - Dia = table.Column(type: "tinyint", nullable: false), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_ParadaHorario", x => x.Id); - table.ForeignKey( - name: "FK_ParadaHorario_Parada_ParadaId", - column: x => x.ParadaId, - principalTable: "Parada", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_Empresa_Cnpj", - table: "Empresa", - column: "Cnpj"); - - migrationBuilder.CreateIndex( - name: "IX_Empresa_Email", - table: "Empresa", - column: "Email"); - - migrationBuilder.CreateIndex( - name: "IX_Empresa_EnderecoId", - table: "Empresa", - column: "EnderecoId"); - - migrationBuilder.CreateIndex( - name: "IX_Endereco_Cep", - table: "Endereco", - column: "Cep"); - - migrationBuilder.CreateIndex( - name: "IX_Funcionario_Codigo", - table: "Funcionario", - column: "Codigo"); - - migrationBuilder.CreateIndex( - name: "IX_Funcionario_Cpf", - table: "Funcionario", - column: "Cpf"); - - migrationBuilder.CreateIndex( - name: "IX_Funcionario_EnderecoId", - table: "Funcionario", - column: "EnderecoId"); - - migrationBuilder.CreateIndex( - name: "IX_Funcionario_NumeroCnh", - table: "Funcionario", - column: "NumeroCnh"); - - migrationBuilder.CreateIndex( - name: "IX_FuncionarioGaragem_FuncionarioId", - table: "FuncionarioGaragem", - column: "FuncionarioId"); - - migrationBuilder.CreateIndex( - name: "IX_FuncionarioGaragem_GaragemId", - table: "FuncionarioGaragem", - column: "GaragemId"); - - migrationBuilder.CreateIndex( - name: "IX_FuncionarioHorario_FuncionarioId", - table: "FuncionarioHorario", - column: "FuncionarioId"); - - migrationBuilder.CreateIndex( - name: "IX_Garagem_EmpresaId", - table: "Garagem", - column: "EmpresaId"); - - migrationBuilder.CreateIndex( - name: "IX_Garagem_EnderecoId", - table: "Garagem", - column: "EnderecoId"); - - migrationBuilder.CreateIndex( - name: "IX_Linha_EmpresaId", - table: "Linha", - column: "EmpresaId"); - - migrationBuilder.CreateIndex( - name: "IX_LinhaEndereco_EnderecoId", - table: "LinhaEndereco", - column: "EnderecoId"); - - migrationBuilder.CreateIndex( - name: "IX_LinhaEndereco_LinhaId", - table: "LinhaEndereco", - column: "LinhaId"); - - migrationBuilder.CreateIndex( - name: "IX_LinhaHorario_LinhaId", - table: "LinhaHorario", - column: "LinhaId"); - - migrationBuilder.CreateIndex( - name: "IX_LinhaTarifa_LinhaId", - table: "LinhaTarifa", - column: "LinhaId"); - - migrationBuilder.CreateIndex( - name: "IX_LinhaTarifaAuditoria_FuncionarioId", - table: "LinhaTarifaAuditoria", - column: "FuncionarioId"); - - migrationBuilder.CreateIndex( - name: "IX_LinhaTarifaAuditoria_LinhaTarifaId", - table: "LinhaTarifaAuditoria", - column: "LinhaTarifaId"); - - migrationBuilder.CreateIndex( - name: "IX_Manutencao_VeiculoId", - table: "Manutencao", - column: "VeiculoId"); - - migrationBuilder.CreateIndex( - name: "IX_Onibus_VeiculoId", - table: "Onibus", - column: "VeiculoId"); - - migrationBuilder.CreateIndex( - name: "IX_OnibusAuditoria_FuncionarioId", - table: "OnibusAuditoria", - column: "FuncionarioId"); - - migrationBuilder.CreateIndex( - name: "IX_OnibusAuditoria_OnibusId", - table: "OnibusAuditoria", - column: "OnibusId"); - - migrationBuilder.CreateIndex( - name: "IX_OnibusOperacao_FuncionarioHorarioId", - table: "OnibusOperacao", - column: "FuncionarioHorarioId"); - - migrationBuilder.CreateIndex( - name: "IX_OnibusOperacao_LinhaHorarioId", - table: "OnibusOperacao", - column: "LinhaHorarioId"); - - migrationBuilder.CreateIndex( - name: "IX_OnibusOperacao_OnibusId", - table: "OnibusOperacao", - column: "OnibusId"); - - migrationBuilder.CreateIndex( - name: "IX_Parada_LinhaEnderecoId", - table: "Parada", - column: "LinhaEnderecoId"); - - migrationBuilder.CreateIndex( - name: "IX_ParadaHorario_ParadaId", - table: "ParadaHorario", - column: "ParadaId"); - - migrationBuilder.CreateIndex( - name: "IX_Usuario_EmpresaId", - table: "Usuario", - column: "EmpresaId"); - - migrationBuilder.CreateIndex( - name: "IX_Veiculo_Placa", - table: "Veiculo", - column: "Placa"); - - migrationBuilder.CreateIndex( - name: "IX_Veiculo_Prefixo", - table: "Veiculo", - column: "Prefixo"); - - migrationBuilder.CreateIndex( - name: "IX_Veiculo_Renavam", - table: "Veiculo", - column: "Renavam"); - - migrationBuilder.CreateIndex( - name: "IX_VeiculoGaragem_GaragemId", - table: "VeiculoGaragem", - column: "GaragemId"); - - migrationBuilder.CreateIndex( - name: "IX_VeiculoGaragem_VeiculoId", - table: "VeiculoGaragem", - column: "VeiculoId"); - - migrationBuilder.CreateIndex( - name: "IX_VeiculoOperacao_FuncionarioHorarioId", - table: "VeiculoOperacao", - column: "FuncionarioHorarioId"); - - migrationBuilder.CreateIndex( - name: "IX_VeiculoOperacao_VeiculoId", - table: "VeiculoOperacao", - column: "VeiculoId"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "FuncionarioGaragem"); - - migrationBuilder.DropTable( - name: "LinhaTarifaAuditoria"); - - migrationBuilder.DropTable( - name: "Manutencao"); - - migrationBuilder.DropTable( - name: "OnibusAuditoria"); - - migrationBuilder.DropTable( - name: "OnibusOperacao"); - - migrationBuilder.DropTable( - name: "ParadaHorario"); - - migrationBuilder.DropTable( - name: "Usuario"); - - migrationBuilder.DropTable( - name: "VeiculoGaragem"); - - migrationBuilder.DropTable( - name: "VeiculoOperacao"); - - migrationBuilder.DropTable( - name: "LinhaTarifa"); - - migrationBuilder.DropTable( - name: "LinhaHorario"); - - migrationBuilder.DropTable( - name: "Onibus"); - - migrationBuilder.DropTable( - name: "Parada"); - - migrationBuilder.DropTable( - name: "Garagem"); - - migrationBuilder.DropTable( - name: "FuncionarioHorario"); - - migrationBuilder.DropTable( - name: "Veiculo"); - - migrationBuilder.DropTable( - name: "LinhaEndereco"); - - migrationBuilder.DropTable( - name: "Funcionario"); - - migrationBuilder.DropTable( - name: "Linha"); - - migrationBuilder.DropTable( - name: "Empresa"); - - migrationBuilder.DropTable( - name: "Endereco"); - } - } -} diff --git a/OneBus.Infra.Data/Migrations/20250502025328_AddUserTypeTables.Designer.cs b/OneBus.Infra.Data/Migrations/20250502025328_AddUserTypeTables.Designer.cs deleted file mode 100644 index e012d13..0000000 --- a/OneBus.Infra.Data/Migrations/20250502025328_AddUserTypeTables.Designer.cs +++ /dev/null @@ -1,1705 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using OneBus.Infra.Data.DbContexts; - -#nullable disable - -namespace OneBus.Infra.Data.Migrations -{ - [DbContext(typeof(OneBusDbContext))] - [Migration("20250502025328_AddUserTypeTables")] - partial class AddUserTypeTables - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("OneBus.Domain.Entities.Address", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Area") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(false) - .HasColumnType("varchar(100)") - .HasColumnName("Logradouro"); - - b.Property("City") - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("Municipio"); - - b.Property("Complement") - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("Complemento"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Number") - .HasMaxLength(30) - .IsUnicode(false) - .HasColumnType("varchar(30)") - .HasColumnName("Numero"); - - b.Property("PostCode") - .IsRequired() - .HasMaxLength(15) - .IsUnicode(false) - .HasColumnType("varchar(15)") - .HasColumnName("Cep"); - - b.Property("State") - .IsRequired() - .HasMaxLength(4) - .IsUnicode(false) - .HasColumnType("varchar(4)") - .HasColumnName("Estado"); - - b.HasKey("Id"); - - b.HasIndex("PostCode"); - - b.ToTable("Endereco", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Bus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ChassisBrand") - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("MarcaChassi"); - - b.Property("ChassisModel") - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("ModeloChassi"); - - b.Property("ChassisYear") - .HasColumnType("int") - .HasColumnName("AnoChassi"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("FumigateExpiration") - .HasColumnType("date") - .HasColumnName("DetetizacaoVencimento"); - - b.Property("HasLeftDoors") - .HasColumnType("bit") - .HasColumnName("TemPortasEsquerda"); - - b.Property("HasLowFloor") - .HasColumnType("bit") - .HasColumnName("TemPisoBaixo"); - - b.Property("InsuranceExpiration") - .HasColumnType("date") - .HasColumnName("SeguroVencimento"); - - b.Property("ServiceType") - .HasColumnType("tinyint") - .HasColumnName("Servico"); - - b.Property("VehicleId") - .HasColumnType("decimal(20,0)") - .HasColumnName("VeiculoId"); - - b.HasKey("Id"); - - b.HasIndex("VehicleId"); - - b.ToTable("Onibus", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.BusAudit", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("BusId") - .HasColumnType("decimal(20,0)") - .HasColumnName("OnibusId"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("Date") - .HasColumnType("date") - .HasColumnName("Data"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EmployeeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionarioId"); - - b.Property("TotalMileage") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)") - .HasColumnName("TotalQuilometragem"); - - b.Property("TotalMileageToday") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)") - .HasColumnName("TotalQuilometragemDia"); - - b.Property("TotalPassengers") - .HasColumnType("decimal(20,0)") - .HasColumnName("TotalPassageiros"); - - b.Property("TotalPassengersToday") - .HasColumnType("decimal(20,0)") - .HasColumnName("TotalPassageirosDia"); - - b.HasKey("Id"); - - b.HasIndex("BusId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("OnibusAuditoria", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.BusOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("BusId") - .HasColumnType("decimal(20,0)") - .HasColumnName("OnibusId"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("Date") - .HasColumnType("date") - .HasColumnName("Data"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EmployeeWorkDayId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionarioHorarioId"); - - b.Property("LineTimeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("LinhaHorarioId"); - - b.HasKey("Id"); - - b.HasIndex("BusId"); - - b.HasIndex("EmployeeWorkDayId"); - - b.HasIndex("LineTimeId"); - - b.ToTable("OnibusOperacao", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Company", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AddressId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EnderecoId"); - - b.Property("Cnpj") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)"); - - b.Property("Image") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Foto"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)") - .HasColumnName("Nome"); - - b.Property("Phone") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Telefone"); - - b.HasKey("Id"); - - b.HasIndex("AddressId"); - - b.HasIndex("Cnpj"); - - b.HasIndex("Email"); - - b.ToTable("Empresa", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AddressId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EnderecoId"); - - b.Property("BloodType") - .HasColumnType("tinyint") - .HasColumnName("TipoSanguineo"); - - b.Property("CnhCategory") - .HasColumnType("tinyint") - .HasColumnName("CategoriaCnh"); - - b.Property("CnhExpiration") - .HasColumnType("date") - .HasColumnName("ValidadeCnh"); - - b.Property("CnhNumber") - .IsUnicode(false) - .HasColumnType("varchar(900)") - .HasColumnName("NumeroCnh"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .IsUnicode(false) - .HasColumnType("varchar(30)") - .HasColumnName("Codigo"); - - b.Property("Cpf") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)"); - - b.Property("HiringDate") - .HasColumnType("date") - .HasColumnName("DataContratacao"); - - b.Property("Image") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Foto"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)") - .HasColumnName("Nome"); - - b.Property("Phone") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Telefone"); - - b.Property("Rg") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)"); - - b.Property("Role") - .HasColumnType("tinyint") - .HasColumnName("Cargo"); - - b.Property("Status") - .HasColumnType("tinyint") - .HasColumnName("Status"); - - b.HasKey("Id"); - - b.HasIndex("AddressId"); - - b.HasIndex("CnhNumber"); - - b.HasIndex("Code"); - - b.HasIndex("Cpf"); - - b.ToTable("Funcionario", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.EmployeeGarage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EmployeeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionarioId"); - - b.Property("GarageId") - .HasColumnType("decimal(20,0)") - .HasColumnName("GaragemId"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("GarageId"); - - b.ToTable("FuncionarioGaragem", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.EmployeeWorkday", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DayType") - .HasColumnType("tinyint") - .HasColumnName("Dia"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EmployeeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionarioId"); - - b.Property("EndTime") - .HasColumnType("time") - .HasColumnName("HoraFim"); - - b.Property("StartTime") - .HasColumnType("time") - .HasColumnName("HoraInicio"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.ToTable("FuncionarioHorario", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Code") - .HasColumnType("tinyint") - .HasColumnName("Codigo"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)") - .HasColumnName("Descricao"); - - b.HasKey("Id"); - - b.HasIndex("Code"); - - b.HasIndex("Description"); - - b.ToTable("Funcionalidade", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Garage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AddressId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EnderecoId"); - - b.Property("CompanyId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EmpresaId"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Image") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Foto"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)") - .HasColumnName("Nome"); - - b.Property("Phone") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Telefone"); - - b.HasKey("Id"); - - b.HasIndex("AddressId"); - - b.HasIndex("CompanyId"); - - b.ToTable("Garagem", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Line", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CompanyId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EmpresaId"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("MaxNumberBuses") - .HasColumnType("tinyint") - .HasColumnName("NumeroMaximoOnibus"); - - b.Property("Mileage") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)") - .HasColumnName("Quilometragem"); - - b.Property("MinNumberBuses") - .HasColumnType("tinyint") - .HasColumnName("NumeroMinimoOnibus"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)") - .HasColumnName("Nome"); - - b.Property("Number") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Numero"); - - b.Property("TravelTime") - .HasColumnType("time") - .HasColumnName("TempoViagem"); - - b.Property("Type") - .HasColumnType("tinyint") - .HasColumnName("Tipo"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.ToTable("Linha", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineAddress", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AddressId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EnderecoId"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("DirectionLine") - .HasColumnType("tinyint") - .HasColumnName("SentidoLinha"); - - b.Property("LineId") - .HasColumnType("decimal(20,0)") - .HasColumnName("LinhaId"); - - b.HasKey("Id"); - - b.HasIndex("AddressId"); - - b.HasIndex("LineId"); - - b.ToTable("LinhaEndereco", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTariff", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("LineId") - .HasColumnType("decimal(20,0)") - .HasColumnName("LinhaId"); - - b.Property("NumberTickets") - .HasColumnType("int") - .HasColumnName("NumeroBilhetes"); - - b.Property("Price") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)") - .HasColumnName("Preco"); - - b.HasKey("Id"); - - b.HasIndex("LineId"); - - b.ToTable("LinhaTarifa", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTariffAudit", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("Date") - .HasColumnType("date") - .HasColumnName("Data"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EmployeeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionarioId"); - - b.Property("LineTariffId") - .HasColumnType("decimal(20,0)") - .HasColumnName("LinhaTarifaId"); - - b.Property("RemainingTicketsNumber") - .HasColumnType("int") - .HasColumnName("NumeroRestanteBilhetes"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LineTariffId"); - - b.ToTable("LinhaTarifaAuditoria", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTime", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DayType") - .HasColumnType("tinyint") - .HasColumnName("Dia"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EndTime") - .HasColumnType("time") - .HasColumnName("HoraFim"); - - b.Property("LineId") - .HasColumnType("decimal(20,0)") - .HasColumnName("LinhaId"); - - b.Property("StartTime") - .HasColumnType("time") - .HasColumnName("HoraInicio"); - - b.HasKey("Id"); - - b.HasIndex("LineId"); - - b.ToTable("LinhaHorario", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Maintenance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cost") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)") - .HasColumnName("Custo"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(150) - .IsUnicode(false) - .HasColumnType("varchar(150)") - .HasColumnName("Descricao"); - - b.Property("EndDate") - .HasColumnType("date") - .HasColumnName("DataFim"); - - b.Property("Sector") - .HasColumnType("tinyint") - .HasColumnName("Setor"); - - b.Property("StartDate") - .HasColumnType("date") - .HasColumnName("DataInicio"); - - b.Property("SurveyExpiration") - .HasColumnType("date") - .HasColumnName("VistoriaVencimento"); - - b.Property("VehicleId") - .HasColumnType("decimal(20,0)") - .HasColumnName("VeiculoId"); - - b.HasKey("Id"); - - b.HasIndex("VehicleId"); - - b.ToTable("Manutencao", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Stop", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("IsFinalStop") - .HasColumnType("bit") - .HasColumnName("PontoFinal"); - - b.Property("IsInitialStop") - .HasColumnType("bit") - .HasColumnName("PontoInicial"); - - b.Property("Latitude") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)"); - - b.Property("LineAddressId") - .HasColumnType("decimal(20,0)") - .HasColumnName("LinhaEnderecoId"); - - b.Property("Longitude") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)"); - - b.Property("Name") - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("Nome"); - - b.HasKey("Id"); - - b.HasIndex("LineAddressId"); - - b.ToTable("Parada", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.StopTime", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DayType") - .HasColumnType("tinyint") - .HasColumnName("Dia"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("StopId") - .HasColumnType("decimal(20,0)") - .HasColumnName("ParadaId"); - - b.Property("Time") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(false) - .HasColumnType("varchar(100)") - .HasColumnName("Horario"); - - b.HasKey("Id"); - - b.HasIndex("StopId"); - - b.ToTable("ParadaHorario", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)"); - - b.Property("Image") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Foto"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)") - .HasColumnName("Nome"); - - b.Property("Password") - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("Senha"); - - b.Property("Phone") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Telefone"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(25) - .IsUnicode(false) - .HasColumnType("varchar(25)") - .HasColumnName("Sal"); - - b.Property("UserTypeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("TipoUsuarioId"); - - b.HasKey("Id"); - - b.HasIndex("UserTypeId"); - - b.ToTable("Usuario", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.UserType", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CompanyId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EmpresaId"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(30) - .IsUnicode(false) - .HasColumnType("varchar(30)") - .HasColumnName("Nome"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.ToTable("TipoUsuario", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.UserTypeFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("FeatureId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionalidadeId"); - - b.Property("HasPermission") - .HasColumnType("bit") - .HasColumnName("TemPermissao"); - - b.Property("UserTypeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("TipoUsuarioId"); - - b.HasKey("Id"); - - b.HasIndex("FeatureId"); - - b.HasIndex("UserTypeId"); - - b.ToTable("TipoUsuarioFuncionalidade", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Vehicle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AcquisitionDate") - .HasColumnType("date") - .HasColumnName("DataAquisicao"); - - b.Property("AxesNumber") - .HasColumnType("tinyint") - .HasColumnName("NumeroEixos"); - - b.Property("BodyworkNumber") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("NumeroCarroceria"); - - b.Property("Brand") - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("Marca"); - - b.Property("Color") - .HasMaxLength(30) - .IsUnicode(false) - .HasColumnType("varchar(30)") - .HasColumnName("Cor"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EngineNumber") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("NumeroMotor"); - - b.Property("FuelType") - .HasColumnType("tinyint") - .HasColumnName("TipoCombustivel"); - - b.Property("HasAccessibility") - .HasColumnType("bit") - .HasColumnName("TemAcessibilidade"); - - b.Property("Image") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Foto"); - - b.Property("IpvaExpiration") - .HasColumnType("date") - .HasColumnName("IpvaVencimento"); - - b.Property("LicensingExpiration") - .HasColumnType("date") - .HasColumnName("LicenciamentoVencimento"); - - b.Property("Model") - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("Modelo"); - - b.Property("NumberChassis") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("NumeroChassi"); - - b.Property("NumberDoors") - .HasColumnType("tinyint") - .HasColumnName("NumeroPortas"); - - b.Property("NumberSeats") - .HasColumnType("tinyint") - .HasColumnName("NumeroAssentos"); - - b.Property("Plate") - .IsRequired() - .HasMaxLength(15) - .IsUnicode(false) - .HasColumnType("varchar(15)") - .HasColumnName("Placa"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(30) - .IsUnicode(false) - .HasColumnType("varchar(30)") - .HasColumnName("Prefixo"); - - b.Property("Renavam") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)"); - - b.Property("Status") - .HasColumnType("tinyint"); - - b.Property("TransmissionType") - .HasColumnType("tinyint") - .HasColumnName("TipoTransmissao"); - - b.Property("Type") - .HasColumnType("tinyint") - .HasColumnName("Tipo"); - - b.Property("Year") - .HasColumnType("int") - .HasColumnName("Ano"); - - b.HasKey("Id"); - - b.HasIndex("Plate"); - - b.HasIndex("Prefix"); - - b.HasIndex("Renavam"); - - b.ToTable("Veiculo", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.VehicleGarage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("GarageId") - .HasColumnType("decimal(20,0)") - .HasColumnName("GaragemId"); - - b.Property("VehicleId") - .HasColumnType("decimal(20,0)") - .HasColumnName("VeiculoId"); - - b.HasKey("Id"); - - b.HasIndex("GarageId"); - - b.HasIndex("VehicleId"); - - b.ToTable("VeiculoGaragem", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.VehicleOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("Date") - .HasColumnType("date") - .HasColumnName("Data"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EmployeeWorkdayId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionarioHorarioId"); - - b.Property("VehicleId") - .HasColumnType("decimal(20,0)") - .HasColumnName("VeiculoId"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeWorkdayId"); - - b.HasIndex("VehicleId"); - - b.ToTable("VeiculoOperacao", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Bus", b => - { - b.HasOne("OneBus.Domain.Entities.Vehicle", "Vehicle") - .WithMany("Buses") - .HasForeignKey("VehicleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Vehicle"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.BusAudit", b => - { - b.HasOne("OneBus.Domain.Entities.Bus", "Bus") - .WithMany("BusAudits") - .HasForeignKey("BusId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.Employee", "Employee") - .WithMany("BusAudits") - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Bus"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.BusOperation", b => - { - b.HasOne("OneBus.Domain.Entities.Bus", "Bus") - .WithMany("BusOperations") - .HasForeignKey("BusId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.EmployeeWorkday", "EmployeeWorkday") - .WithMany("BusOperations") - .HasForeignKey("EmployeeWorkDayId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.LineTime", "LineTime") - .WithMany("BusOperations") - .HasForeignKey("LineTimeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Bus"); - - b.Navigation("EmployeeWorkday"); - - b.Navigation("LineTime"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Company", b => - { - b.HasOne("OneBus.Domain.Entities.Address", "Address") - .WithMany("Companies") - .HasForeignKey("AddressId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Address"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Employee", b => - { - b.HasOne("OneBus.Domain.Entities.Address", "Address") - .WithMany("Employees") - .HasForeignKey("AddressId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Address"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.EmployeeGarage", b => - { - b.HasOne("OneBus.Domain.Entities.Employee", "Employee") - .WithMany("EmployeeGarages") - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.Garage", "Garage") - .WithMany("EmployeeGarages") - .HasForeignKey("GarageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Garage"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.EmployeeWorkday", b => - { - b.HasOne("OneBus.Domain.Entities.Employee", "Employee") - .WithMany("EmployeeWorkdays") - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Garage", b => - { - b.HasOne("OneBus.Domain.Entities.Address", "Address") - .WithMany("Garages") - .HasForeignKey("AddressId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.Company", "Company") - .WithMany("Garages") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Address"); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Line", b => - { - b.HasOne("OneBus.Domain.Entities.Company", "Company") - .WithMany("Lines") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineAddress", b => - { - b.HasOne("OneBus.Domain.Entities.Address", "Address") - .WithMany("LineAddresses") - .HasForeignKey("AddressId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.Line", "Line") - .WithMany("LineAddresses") - .HasForeignKey("LineId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Address"); - - b.Navigation("Line"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTariff", b => - { - b.HasOne("OneBus.Domain.Entities.Line", "Line") - .WithMany("LineTariffs") - .HasForeignKey("LineId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Line"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTariffAudit", b => - { - b.HasOne("OneBus.Domain.Entities.Employee", "Employee") - .WithMany("LineTariffAudits") - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.LineTariff", "LineTariff") - .WithMany("LineTariffAudits") - .HasForeignKey("LineTariffId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LineTariff"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTime", b => - { - b.HasOne("OneBus.Domain.Entities.Line", "Line") - .WithMany("LineTimes") - .HasForeignKey("LineId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Line"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Maintenance", b => - { - b.HasOne("OneBus.Domain.Entities.Vehicle", "Vehicle") - .WithMany("Maintenances") - .HasForeignKey("VehicleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Vehicle"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Stop", b => - { - b.HasOne("OneBus.Domain.Entities.LineAddress", "LineAddress") - .WithMany("Stops") - .HasForeignKey("LineAddressId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("LineAddress"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.StopTime", b => - { - b.HasOne("OneBus.Domain.Entities.Stop", "Stop") - .WithMany("StopTimes") - .HasForeignKey("StopId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Stop"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.User", b => - { - b.HasOne("OneBus.Domain.Entities.UserType", "UserType") - .WithMany("Users") - .HasForeignKey("UserTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("UserType"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.UserType", b => - { - b.HasOne("OneBus.Domain.Entities.Company", "Company") - .WithMany("UserTypes") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.UserTypeFeature", b => - { - b.HasOne("OneBus.Domain.Entities.Feature", "Feature") - .WithMany("UserTypeFeatures") - .HasForeignKey("FeatureId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.UserType", "UserType") - .WithMany("UserTypeFeatures") - .HasForeignKey("UserTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Feature"); - - b.Navigation("UserType"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.VehicleGarage", b => - { - b.HasOne("OneBus.Domain.Entities.Garage", "Garage") - .WithMany("VehicleGarages") - .HasForeignKey("GarageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.Vehicle", "Vehicle") - .WithMany("VehicleGarages") - .HasForeignKey("VehicleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Garage"); - - b.Navigation("Vehicle"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.VehicleOperation", b => - { - b.HasOne("OneBus.Domain.Entities.EmployeeWorkday", "EmployeeWorkday") - .WithMany("VehicleOperations") - .HasForeignKey("EmployeeWorkdayId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.Vehicle", "Vehicle") - .WithMany("VehicleOperations") - .HasForeignKey("VehicleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeWorkday"); - - b.Navigation("Vehicle"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Address", b => - { - b.Navigation("Companies"); - - b.Navigation("Employees"); - - b.Navigation("Garages"); - - b.Navigation("LineAddresses"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Bus", b => - { - b.Navigation("BusAudits"); - - b.Navigation("BusOperations"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Company", b => - { - b.Navigation("Garages"); - - b.Navigation("Lines"); - - b.Navigation("UserTypes"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Employee", b => - { - b.Navigation("BusAudits"); - - b.Navigation("EmployeeGarages"); - - b.Navigation("EmployeeWorkdays"); - - b.Navigation("LineTariffAudits"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.EmployeeWorkday", b => - { - b.Navigation("BusOperations"); - - b.Navigation("VehicleOperations"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Feature", b => - { - b.Navigation("UserTypeFeatures"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Garage", b => - { - b.Navigation("EmployeeGarages"); - - b.Navigation("VehicleGarages"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Line", b => - { - b.Navigation("LineAddresses"); - - b.Navigation("LineTariffs"); - - b.Navigation("LineTimes"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineAddress", b => - { - b.Navigation("Stops"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTariff", b => - { - b.Navigation("LineTariffAudits"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTime", b => - { - b.Navigation("BusOperations"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Stop", b => - { - b.Navigation("StopTimes"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.UserType", b => - { - b.Navigation("UserTypeFeatures"); - - b.Navigation("Users"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Vehicle", b => - { - b.Navigation("Buses"); - - b.Navigation("Maintenances"); - - b.Navigation("VehicleGarages"); - - b.Navigation("VehicleOperations"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/OneBus.Infra.Data/Migrations/20250502025328_AddUserTypeTables.cs b/OneBus.Infra.Data/Migrations/20250502025328_AddUserTypeTables.cs deleted file mode 100644 index af180a0..0000000 --- a/OneBus.Infra.Data/Migrations/20250502025328_AddUserTypeTables.cs +++ /dev/null @@ -1,164 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace OneBus.Infra.Data.Migrations -{ - /// - public partial class AddUserTypeTables : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Usuario_Empresa_EmpresaId", - table: "Usuario"); - - migrationBuilder.RenameColumn( - name: "EmpresaId", - table: "Usuario", - newName: "TipoUsuarioId"); - - migrationBuilder.RenameIndex( - name: "IX_Usuario_EmpresaId", - table: "Usuario", - newName: "IX_Usuario_TipoUsuarioId"); - - migrationBuilder.CreateTable( - name: "Funcionalidade", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - Codigo = table.Column(type: "tinyint", nullable: false), - Descricao = table.Column(type: "varchar(80)", unicode: false, maxLength: 80, nullable: false), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Funcionalidade", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "TipoUsuario", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - EmpresaId = table.Column(type: "decimal(20,0)", nullable: false), - Nome = table.Column(type: "varchar(30)", unicode: false, maxLength: 30, nullable: false), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_TipoUsuario", x => x.Id); - table.ForeignKey( - name: "FK_TipoUsuario_Empresa_EmpresaId", - column: x => x.EmpresaId, - principalTable: "Empresa", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "TipoUsuarioFuncionalidade", - columns: table => new - { - Id = table.Column(type: "decimal(20,0)", nullable: false) - .Annotation("SqlServer:Identity", "1, 1"), - TipoUsuarioId = table.Column(type: "decimal(20,0)", nullable: false), - FuncionalidadeId = table.Column(type: "decimal(20,0)", nullable: false), - TemPermissao = table.Column(type: "bit", nullable: false), - DataCriacao = table.Column(type: "datetime2", nullable: false), - DataExclusao = table.Column(type: "datetime2", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_TipoUsuarioFuncionalidade", x => x.Id); - table.ForeignKey( - name: "FK_TipoUsuarioFuncionalidade_Funcionalidade_FuncionalidadeId", - column: x => x.FuncionalidadeId, - principalTable: "Funcionalidade", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_TipoUsuarioFuncionalidade_TipoUsuario_TipoUsuarioId", - column: x => x.TipoUsuarioId, - principalTable: "TipoUsuario", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_Funcionalidade_Codigo", - table: "Funcionalidade", - column: "Codigo"); - - migrationBuilder.CreateIndex( - name: "IX_Funcionalidade_Descricao", - table: "Funcionalidade", - column: "Descricao"); - - migrationBuilder.CreateIndex( - name: "IX_TipoUsuario_EmpresaId", - table: "TipoUsuario", - column: "EmpresaId"); - - migrationBuilder.CreateIndex( - name: "IX_TipoUsuarioFuncionalidade_FuncionalidadeId", - table: "TipoUsuarioFuncionalidade", - column: "FuncionalidadeId"); - - migrationBuilder.CreateIndex( - name: "IX_TipoUsuarioFuncionalidade_TipoUsuarioId", - table: "TipoUsuarioFuncionalidade", - column: "TipoUsuarioId"); - - migrationBuilder.AddForeignKey( - name: "FK_Usuario_TipoUsuario_TipoUsuarioId", - table: "Usuario", - column: "TipoUsuarioId", - principalTable: "TipoUsuario", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Usuario_TipoUsuario_TipoUsuarioId", - table: "Usuario"); - - migrationBuilder.DropTable( - name: "TipoUsuarioFuncionalidade"); - - migrationBuilder.DropTable( - name: "Funcionalidade"); - - migrationBuilder.DropTable( - name: "TipoUsuario"); - - migrationBuilder.RenameColumn( - name: "TipoUsuarioId", - table: "Usuario", - newName: "EmpresaId"); - - migrationBuilder.RenameIndex( - name: "IX_Usuario_TipoUsuarioId", - table: "Usuario", - newName: "IX_Usuario_EmpresaId"); - - migrationBuilder.AddForeignKey( - name: "FK_Usuario_Empresa_EmpresaId", - table: "Usuario", - column: "EmpresaId", - principalTable: "Empresa", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - } -} diff --git a/OneBus.Infra.Data/Migrations/OneBusDbContextModelSnapshot.cs b/OneBus.Infra.Data/Migrations/OneBusDbContextModelSnapshot.cs deleted file mode 100644 index 3579d8a..0000000 --- a/OneBus.Infra.Data/Migrations/OneBusDbContextModelSnapshot.cs +++ /dev/null @@ -1,1702 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using OneBus.Infra.Data.DbContexts; - -#nullable disable - -namespace OneBus.Infra.Data.Migrations -{ - [DbContext(typeof(OneBusDbContext))] - partial class OneBusDbContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.4") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("OneBus.Domain.Entities.Address", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Area") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(false) - .HasColumnType("varchar(100)") - .HasColumnName("Logradouro"); - - b.Property("City") - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("Municipio"); - - b.Property("Complement") - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("Complemento"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Number") - .HasMaxLength(30) - .IsUnicode(false) - .HasColumnType("varchar(30)") - .HasColumnName("Numero"); - - b.Property("PostCode") - .IsRequired() - .HasMaxLength(15) - .IsUnicode(false) - .HasColumnType("varchar(15)") - .HasColumnName("Cep"); - - b.Property("State") - .IsRequired() - .HasMaxLength(4) - .IsUnicode(false) - .HasColumnType("varchar(4)") - .HasColumnName("Estado"); - - b.HasKey("Id"); - - b.HasIndex("PostCode"); - - b.ToTable("Endereco", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Bus", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("ChassisBrand") - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("MarcaChassi"); - - b.Property("ChassisModel") - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("ModeloChassi"); - - b.Property("ChassisYear") - .HasColumnType("int") - .HasColumnName("AnoChassi"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("FumigateExpiration") - .HasColumnType("date") - .HasColumnName("DetetizacaoVencimento"); - - b.Property("HasLeftDoors") - .HasColumnType("bit") - .HasColumnName("TemPortasEsquerda"); - - b.Property("HasLowFloor") - .HasColumnType("bit") - .HasColumnName("TemPisoBaixo"); - - b.Property("InsuranceExpiration") - .HasColumnType("date") - .HasColumnName("SeguroVencimento"); - - b.Property("ServiceType") - .HasColumnType("tinyint") - .HasColumnName("Servico"); - - b.Property("VehicleId") - .HasColumnType("decimal(20,0)") - .HasColumnName("VeiculoId"); - - b.HasKey("Id"); - - b.HasIndex("VehicleId"); - - b.ToTable("Onibus", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.BusAudit", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("BusId") - .HasColumnType("decimal(20,0)") - .HasColumnName("OnibusId"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("Date") - .HasColumnType("date") - .HasColumnName("Data"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EmployeeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionarioId"); - - b.Property("TotalMileage") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)") - .HasColumnName("TotalQuilometragem"); - - b.Property("TotalMileageToday") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)") - .HasColumnName("TotalQuilometragemDia"); - - b.Property("TotalPassengers") - .HasColumnType("decimal(20,0)") - .HasColumnName("TotalPassageiros"); - - b.Property("TotalPassengersToday") - .HasColumnType("decimal(20,0)") - .HasColumnName("TotalPassageirosDia"); - - b.HasKey("Id"); - - b.HasIndex("BusId"); - - b.HasIndex("EmployeeId"); - - b.ToTable("OnibusAuditoria", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.BusOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("BusId") - .HasColumnType("decimal(20,0)") - .HasColumnName("OnibusId"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("Date") - .HasColumnType("date") - .HasColumnName("Data"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EmployeeWorkDayId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionarioHorarioId"); - - b.Property("LineTimeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("LinhaHorarioId"); - - b.HasKey("Id"); - - b.HasIndex("BusId"); - - b.HasIndex("EmployeeWorkDayId"); - - b.HasIndex("LineTimeId"); - - b.ToTable("OnibusOperacao", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Company", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AddressId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EnderecoId"); - - b.Property("Cnpj") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)"); - - b.Property("Image") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Foto"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)") - .HasColumnName("Nome"); - - b.Property("Phone") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Telefone"); - - b.HasKey("Id"); - - b.HasIndex("AddressId"); - - b.HasIndex("Cnpj"); - - b.HasIndex("Email"); - - b.ToTable("Empresa", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Employee", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AddressId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EnderecoId"); - - b.Property("BloodType") - .HasColumnType("tinyint") - .HasColumnName("TipoSanguineo"); - - b.Property("CnhCategory") - .HasColumnType("tinyint") - .HasColumnName("CategoriaCnh"); - - b.Property("CnhExpiration") - .HasColumnType("date") - .HasColumnName("ValidadeCnh"); - - b.Property("CnhNumber") - .IsUnicode(false) - .HasColumnType("varchar(900)") - .HasColumnName("NumeroCnh"); - - b.Property("Code") - .IsRequired() - .HasMaxLength(30) - .IsUnicode(false) - .HasColumnType("varchar(30)") - .HasColumnName("Codigo"); - - b.Property("Cpf") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)"); - - b.Property("HiringDate") - .HasColumnType("date") - .HasColumnName("DataContratacao"); - - b.Property("Image") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Foto"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)") - .HasColumnName("Nome"); - - b.Property("Phone") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Telefone"); - - b.Property("Rg") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)"); - - b.Property("Role") - .HasColumnType("tinyint") - .HasColumnName("Cargo"); - - b.Property("Status") - .HasColumnType("tinyint") - .HasColumnName("Status"); - - b.HasKey("Id"); - - b.HasIndex("AddressId"); - - b.HasIndex("CnhNumber"); - - b.HasIndex("Code"); - - b.HasIndex("Cpf"); - - b.ToTable("Funcionario", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.EmployeeGarage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EmployeeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionarioId"); - - b.Property("GarageId") - .HasColumnType("decimal(20,0)") - .HasColumnName("GaragemId"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("GarageId"); - - b.ToTable("FuncionarioGaragem", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.EmployeeWorkday", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DayType") - .HasColumnType("tinyint") - .HasColumnName("Dia"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EmployeeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionarioId"); - - b.Property("EndTime") - .HasColumnType("time") - .HasColumnName("HoraFim"); - - b.Property("StartTime") - .HasColumnType("time") - .HasColumnName("HoraInicio"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.ToTable("FuncionarioHorario", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Feature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Code") - .HasColumnType("tinyint") - .HasColumnName("Codigo"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)") - .HasColumnName("Descricao"); - - b.HasKey("Id"); - - b.HasIndex("Code"); - - b.HasIndex("Description"); - - b.ToTable("Funcionalidade", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Garage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AddressId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EnderecoId"); - - b.Property("CompanyId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EmpresaId"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Image") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Foto"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)") - .HasColumnName("Nome"); - - b.Property("Phone") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Telefone"); - - b.HasKey("Id"); - - b.HasIndex("AddressId"); - - b.HasIndex("CompanyId"); - - b.ToTable("Garagem", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Line", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CompanyId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EmpresaId"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("MaxNumberBuses") - .HasColumnType("tinyint") - .HasColumnName("NumeroMaximoOnibus"); - - b.Property("Mileage") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)") - .HasColumnName("Quilometragem"); - - b.Property("MinNumberBuses") - .HasColumnType("tinyint") - .HasColumnName("NumeroMinimoOnibus"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)") - .HasColumnName("Nome"); - - b.Property("Number") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Numero"); - - b.Property("TravelTime") - .HasColumnType("time") - .HasColumnName("TempoViagem"); - - b.Property("Type") - .HasColumnType("tinyint") - .HasColumnName("Tipo"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.ToTable("Linha", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineAddress", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AddressId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EnderecoId"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("DirectionLine") - .HasColumnType("tinyint") - .HasColumnName("SentidoLinha"); - - b.Property("LineId") - .HasColumnType("decimal(20,0)") - .HasColumnName("LinhaId"); - - b.HasKey("Id"); - - b.HasIndex("AddressId"); - - b.HasIndex("LineId"); - - b.ToTable("LinhaEndereco", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTariff", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("LineId") - .HasColumnType("decimal(20,0)") - .HasColumnName("LinhaId"); - - b.Property("NumberTickets") - .HasColumnType("int") - .HasColumnName("NumeroBilhetes"); - - b.Property("Price") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)") - .HasColumnName("Preco"); - - b.HasKey("Id"); - - b.HasIndex("LineId"); - - b.ToTable("LinhaTarifa", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTariffAudit", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("Date") - .HasColumnType("date") - .HasColumnName("Data"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EmployeeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionarioId"); - - b.Property("LineTariffId") - .HasColumnType("decimal(20,0)") - .HasColumnName("LinhaTarifaId"); - - b.Property("RemainingTicketsNumber") - .HasColumnType("int") - .HasColumnName("NumeroRestanteBilhetes"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeId"); - - b.HasIndex("LineTariffId"); - - b.ToTable("LinhaTarifaAuditoria", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTime", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DayType") - .HasColumnType("tinyint") - .HasColumnName("Dia"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EndTime") - .HasColumnType("time") - .HasColumnName("HoraFim"); - - b.Property("LineId") - .HasColumnType("decimal(20,0)") - .HasColumnName("LinhaId"); - - b.Property("StartTime") - .HasColumnType("time") - .HasColumnName("HoraInicio"); - - b.HasKey("Id"); - - b.HasIndex("LineId"); - - b.ToTable("LinhaHorario", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Maintenance", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("Cost") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)") - .HasColumnName("Custo"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(150) - .IsUnicode(false) - .HasColumnType("varchar(150)") - .HasColumnName("Descricao"); - - b.Property("EndDate") - .HasColumnType("date") - .HasColumnName("DataFim"); - - b.Property("Sector") - .HasColumnType("tinyint") - .HasColumnName("Setor"); - - b.Property("StartDate") - .HasColumnType("date") - .HasColumnName("DataInicio"); - - b.Property("SurveyExpiration") - .HasColumnType("date") - .HasColumnName("VistoriaVencimento"); - - b.Property("VehicleId") - .HasColumnType("decimal(20,0)") - .HasColumnName("VeiculoId"); - - b.HasKey("Id"); - - b.HasIndex("VehicleId"); - - b.ToTable("Manutencao", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Stop", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("IsFinalStop") - .HasColumnType("bit") - .HasColumnName("PontoFinal"); - - b.Property("IsInitialStop") - .HasColumnType("bit") - .HasColumnName("PontoInicial"); - - b.Property("Latitude") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)"); - - b.Property("LineAddressId") - .HasColumnType("decimal(20,0)") - .HasColumnName("LinhaEnderecoId"); - - b.Property("Longitude") - .HasPrecision(19, 4) - .HasColumnType("decimal(19,4)"); - - b.Property("Name") - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("Nome"); - - b.HasKey("Id"); - - b.HasIndex("LineAddressId"); - - b.ToTable("Parada", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.StopTime", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DayType") - .HasColumnType("tinyint") - .HasColumnName("Dia"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("StopId") - .HasColumnType("decimal(20,0)") - .HasColumnName("ParadaId"); - - b.Property("Time") - .IsRequired() - .HasMaxLength(100) - .IsUnicode(false) - .HasColumnType("varchar(100)") - .HasColumnName("Horario"); - - b.HasKey("Id"); - - b.HasIndex("StopId"); - - b.ToTable("ParadaHorario", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.User", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)"); - - b.Property("Image") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Foto"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(80) - .IsUnicode(false) - .HasColumnType("varchar(80)") - .HasColumnName("Nome"); - - b.Property("Password") - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("Senha"); - - b.Property("Phone") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Telefone"); - - b.Property("Salt") - .IsRequired() - .HasMaxLength(25) - .IsUnicode(false) - .HasColumnType("varchar(25)") - .HasColumnName("Sal"); - - b.Property("UserTypeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("TipoUsuarioId"); - - b.HasKey("Id"); - - b.HasIndex("UserTypeId"); - - b.ToTable("Usuario", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.UserType", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CompanyId") - .HasColumnType("decimal(20,0)") - .HasColumnName("EmpresaId"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(30) - .IsUnicode(false) - .HasColumnType("varchar(30)") - .HasColumnName("Nome"); - - b.HasKey("Id"); - - b.HasIndex("CompanyId"); - - b.ToTable("TipoUsuario", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.UserTypeFeature", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("FeatureId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionalidadeId"); - - b.Property("HasPermission") - .HasColumnType("bit") - .HasColumnName("TemPermissao"); - - b.Property("UserTypeId") - .HasColumnType("decimal(20,0)") - .HasColumnName("TipoUsuarioId"); - - b.HasKey("Id"); - - b.HasIndex("FeatureId"); - - b.HasIndex("UserTypeId"); - - b.ToTable("TipoUsuarioFuncionalidade", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Vehicle", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("AcquisitionDate") - .HasColumnType("date") - .HasColumnName("DataAquisicao"); - - b.Property("AxesNumber") - .HasColumnType("tinyint") - .HasColumnName("NumeroEixos"); - - b.Property("BodyworkNumber") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("NumeroCarroceria"); - - b.Property("Brand") - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("Marca"); - - b.Property("Color") - .HasMaxLength(30) - .IsUnicode(false) - .HasColumnType("varchar(30)") - .HasColumnName("Cor"); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EngineNumber") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("NumeroMotor"); - - b.Property("FuelType") - .HasColumnType("tinyint") - .HasColumnName("TipoCombustivel"); - - b.Property("HasAccessibility") - .HasColumnType("bit") - .HasColumnName("TemAcessibilidade"); - - b.Property("Image") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("Foto"); - - b.Property("IpvaExpiration") - .HasColumnType("date") - .HasColumnName("IpvaVencimento"); - - b.Property("LicensingExpiration") - .HasColumnType("date") - .HasColumnName("LicenciamentoVencimento"); - - b.Property("Model") - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasColumnType("varchar(50)") - .HasColumnName("Modelo"); - - b.Property("NumberChassis") - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)") - .HasColumnName("NumeroChassi"); - - b.Property("NumberDoors") - .HasColumnType("tinyint") - .HasColumnName("NumeroPortas"); - - b.Property("NumberSeats") - .HasColumnType("tinyint") - .HasColumnName("NumeroAssentos"); - - b.Property("Plate") - .IsRequired() - .HasMaxLength(15) - .IsUnicode(false) - .HasColumnType("varchar(15)") - .HasColumnName("Placa"); - - b.Property("Prefix") - .IsRequired() - .HasMaxLength(30) - .IsUnicode(false) - .HasColumnType("varchar(30)") - .HasColumnName("Prefixo"); - - b.Property("Renavam") - .IsRequired() - .HasMaxLength(20) - .IsUnicode(false) - .HasColumnType("varchar(20)"); - - b.Property("Status") - .HasColumnType("tinyint"); - - b.Property("TransmissionType") - .HasColumnType("tinyint") - .HasColumnName("TipoTransmissao"); - - b.Property("Type") - .HasColumnType("tinyint") - .HasColumnName("Tipo"); - - b.Property("Year") - .HasColumnType("int") - .HasColumnName("Ano"); - - b.HasKey("Id"); - - b.HasIndex("Plate"); - - b.HasIndex("Prefix"); - - b.HasIndex("Renavam"); - - b.ToTable("Veiculo", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.VehicleGarage", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("GarageId") - .HasColumnType("decimal(20,0)") - .HasColumnName("GaragemId"); - - b.Property("VehicleId") - .HasColumnType("decimal(20,0)") - .HasColumnName("VeiculoId"); - - b.HasKey("Id"); - - b.HasIndex("GarageId"); - - b.HasIndex("VehicleId"); - - b.ToTable("VeiculoGaragem", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.VehicleOperation", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("decimal(20,0)"); - - SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); - - b.Property("CreatedAt") - .HasColumnType("datetime2") - .HasColumnName("DataCriacao"); - - b.Property("Date") - .HasColumnType("date") - .HasColumnName("Data"); - - b.Property("DeletedAt") - .HasColumnType("datetime2") - .HasColumnName("DataExclusao"); - - b.Property("EmployeeWorkdayId") - .HasColumnType("decimal(20,0)") - .HasColumnName("FuncionarioHorarioId"); - - b.Property("VehicleId") - .HasColumnType("decimal(20,0)") - .HasColumnName("VeiculoId"); - - b.HasKey("Id"); - - b.HasIndex("EmployeeWorkdayId"); - - b.HasIndex("VehicleId"); - - b.ToTable("VeiculoOperacao", (string)null); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Bus", b => - { - b.HasOne("OneBus.Domain.Entities.Vehicle", "Vehicle") - .WithMany("Buses") - .HasForeignKey("VehicleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Vehicle"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.BusAudit", b => - { - b.HasOne("OneBus.Domain.Entities.Bus", "Bus") - .WithMany("BusAudits") - .HasForeignKey("BusId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.Employee", "Employee") - .WithMany("BusAudits") - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Bus"); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.BusOperation", b => - { - b.HasOne("OneBus.Domain.Entities.Bus", "Bus") - .WithMany("BusOperations") - .HasForeignKey("BusId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.EmployeeWorkday", "EmployeeWorkday") - .WithMany("BusOperations") - .HasForeignKey("EmployeeWorkDayId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.LineTime", "LineTime") - .WithMany("BusOperations") - .HasForeignKey("LineTimeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Bus"); - - b.Navigation("EmployeeWorkday"); - - b.Navigation("LineTime"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Company", b => - { - b.HasOne("OneBus.Domain.Entities.Address", "Address") - .WithMany("Companies") - .HasForeignKey("AddressId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Address"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Employee", b => - { - b.HasOne("OneBus.Domain.Entities.Address", "Address") - .WithMany("Employees") - .HasForeignKey("AddressId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Address"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.EmployeeGarage", b => - { - b.HasOne("OneBus.Domain.Entities.Employee", "Employee") - .WithMany("EmployeeGarages") - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.Garage", "Garage") - .WithMany("EmployeeGarages") - .HasForeignKey("GarageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("Garage"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.EmployeeWorkday", b => - { - b.HasOne("OneBus.Domain.Entities.Employee", "Employee") - .WithMany("EmployeeWorkdays") - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Garage", b => - { - b.HasOne("OneBus.Domain.Entities.Address", "Address") - .WithMany("Garages") - .HasForeignKey("AddressId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.Company", "Company") - .WithMany("Garages") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Address"); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Line", b => - { - b.HasOne("OneBus.Domain.Entities.Company", "Company") - .WithMany("Lines") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineAddress", b => - { - b.HasOne("OneBus.Domain.Entities.Address", "Address") - .WithMany("LineAddresses") - .HasForeignKey("AddressId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.Line", "Line") - .WithMany("LineAddresses") - .HasForeignKey("LineId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Address"); - - b.Navigation("Line"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTariff", b => - { - b.HasOne("OneBus.Domain.Entities.Line", "Line") - .WithMany("LineTariffs") - .HasForeignKey("LineId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Line"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTariffAudit", b => - { - b.HasOne("OneBus.Domain.Entities.Employee", "Employee") - .WithMany("LineTariffAudits") - .HasForeignKey("EmployeeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.LineTariff", "LineTariff") - .WithMany("LineTariffAudits") - .HasForeignKey("LineTariffId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Employee"); - - b.Navigation("LineTariff"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTime", b => - { - b.HasOne("OneBus.Domain.Entities.Line", "Line") - .WithMany("LineTimes") - .HasForeignKey("LineId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Line"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Maintenance", b => - { - b.HasOne("OneBus.Domain.Entities.Vehicle", "Vehicle") - .WithMany("Maintenances") - .HasForeignKey("VehicleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Vehicle"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Stop", b => - { - b.HasOne("OneBus.Domain.Entities.LineAddress", "LineAddress") - .WithMany("Stops") - .HasForeignKey("LineAddressId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("LineAddress"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.StopTime", b => - { - b.HasOne("OneBus.Domain.Entities.Stop", "Stop") - .WithMany("StopTimes") - .HasForeignKey("StopId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Stop"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.User", b => - { - b.HasOne("OneBus.Domain.Entities.UserType", "UserType") - .WithMany("Users") - .HasForeignKey("UserTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("UserType"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.UserType", b => - { - b.HasOne("OneBus.Domain.Entities.Company", "Company") - .WithMany("UserTypes") - .HasForeignKey("CompanyId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Company"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.UserTypeFeature", b => - { - b.HasOne("OneBus.Domain.Entities.Feature", "Feature") - .WithMany("UserTypeFeatures") - .HasForeignKey("FeatureId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.UserType", "UserType") - .WithMany("UserTypeFeatures") - .HasForeignKey("UserTypeId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Feature"); - - b.Navigation("UserType"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.VehicleGarage", b => - { - b.HasOne("OneBus.Domain.Entities.Garage", "Garage") - .WithMany("VehicleGarages") - .HasForeignKey("GarageId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.Vehicle", "Vehicle") - .WithMany("VehicleGarages") - .HasForeignKey("VehicleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Garage"); - - b.Navigation("Vehicle"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.VehicleOperation", b => - { - b.HasOne("OneBus.Domain.Entities.EmployeeWorkday", "EmployeeWorkday") - .WithMany("VehicleOperations") - .HasForeignKey("EmployeeWorkdayId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("OneBus.Domain.Entities.Vehicle", "Vehicle") - .WithMany("VehicleOperations") - .HasForeignKey("VehicleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("EmployeeWorkday"); - - b.Navigation("Vehicle"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Address", b => - { - b.Navigation("Companies"); - - b.Navigation("Employees"); - - b.Navigation("Garages"); - - b.Navigation("LineAddresses"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Bus", b => - { - b.Navigation("BusAudits"); - - b.Navigation("BusOperations"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Company", b => - { - b.Navigation("Garages"); - - b.Navigation("Lines"); - - b.Navigation("UserTypes"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Employee", b => - { - b.Navigation("BusAudits"); - - b.Navigation("EmployeeGarages"); - - b.Navigation("EmployeeWorkdays"); - - b.Navigation("LineTariffAudits"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.EmployeeWorkday", b => - { - b.Navigation("BusOperations"); - - b.Navigation("VehicleOperations"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Feature", b => - { - b.Navigation("UserTypeFeatures"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Garage", b => - { - b.Navigation("EmployeeGarages"); - - b.Navigation("VehicleGarages"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Line", b => - { - b.Navigation("LineAddresses"); - - b.Navigation("LineTariffs"); - - b.Navigation("LineTimes"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineAddress", b => - { - b.Navigation("Stops"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTariff", b => - { - b.Navigation("LineTariffAudits"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.LineTime", b => - { - b.Navigation("BusOperations"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Stop", b => - { - b.Navigation("StopTimes"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.UserType", b => - { - b.Navigation("UserTypeFeatures"); - - b.Navigation("Users"); - }); - - modelBuilder.Entity("OneBus.Domain.Entities.Vehicle", b => - { - b.Navigation("Buses"); - - b.Navigation("Maintenances"); - - b.Navigation("VehicleGarages"); - - b.Navigation("VehicleOperations"); - }); -#pragma warning restore 612, 618 - } - } -} From 287bf9a413968ec75010c762e51b1addd29b095c Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 13:47:07 -0300 Subject: [PATCH 03/41] =?UTF-8?q?=E2=9E=96build:=20Remove=20nuget=20packag?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing Microsoft.EntityFrameworkCore.SqlServer package --- OneBus.Infra.Data/OneBus.Infra.Data.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/OneBus.Infra.Data/OneBus.Infra.Data.csproj b/OneBus.Infra.Data/OneBus.Infra.Data.csproj index d55d5ab..22e09b5 100644 --- a/OneBus.Infra.Data/OneBus.Infra.Data.csproj +++ b/OneBus.Infra.Data/OneBus.Infra.Data.csproj @@ -11,7 +11,6 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive - all runtime; build; native; contentfiles; analyzers; buildtransitive From a6bd96883cd004f87df2ff196dc9cd3973cac3f0 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 13:48:28 -0300 Subject: [PATCH 04/41] =?UTF-8?q?=E2=9E=95build:=20Add=20nuget=20package?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding Npgsql.EntityFrameworkCore.PostgreSQL package --- OneBus.Infra.Data/OneBus.Infra.Data.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/OneBus.Infra.Data/OneBus.Infra.Data.csproj b/OneBus.Infra.Data/OneBus.Infra.Data.csproj index 22e09b5..ab0ba4b 100644 --- a/OneBus.Infra.Data/OneBus.Infra.Data.csproj +++ b/OneBus.Infra.Data/OneBus.Infra.Data.csproj @@ -15,6 +15,7 @@ all runtime; build; native; contentfiles; analyzers; buildtransitive + From 09d7d23143af89cf1dda19520319ff24c7fb8034 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 13:59:33 -0300 Subject: [PATCH 05/41] =?UTF-8?q?=F0=9F=93=A6build:=20Update=20nuget=20pac?= =?UTF-8?q?kages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating OneBus.Infra.Data packages --- OneBus.Infra.Data/OneBus.Infra.Data.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OneBus.Infra.Data/OneBus.Infra.Data.csproj b/OneBus.Infra.Data/OneBus.Infra.Data.csproj index ab0ba4b..00869b2 100644 --- a/OneBus.Infra.Data/OneBus.Infra.Data.csproj +++ b/OneBus.Infra.Data/OneBus.Infra.Data.csproj @@ -7,16 +7,16 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive - + From 92814dfaabb9b2c17a9e0d2694de9f0237bc1372 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 14:01:44 -0300 Subject: [PATCH 06/41] =?UTF-8?q?=F0=9F=93=A6build:=20Update=20nuget=20pac?= =?UTF-8?q?kages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating OneBus.Application packages --- OneBus.Application/OneBus.Application.csproj | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OneBus.Application/OneBus.Application.csproj b/OneBus.Application/OneBus.Application.csproj index b41426a..f44ee7b 100644 --- a/OneBus.Application/OneBus.Application.csproj +++ b/OneBus.Application/OneBus.Application.csproj @@ -7,11 +7,11 @@ - + - - + + From 4b009ed9c416169ad62acfe7d7ff0dcd7c068a6a Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 14:05:58 -0300 Subject: [PATCH 07/41] =?UTF-8?q?=F0=9F=93=A6build:=20Update=20nuget=20pac?= =?UTF-8?q?kages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating OneBus.Infra.Ioc packages and adding Scrutor library for Dependency injection --- OneBus.Infra.Ioc/OneBus.Infra.Ioc.csproj | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/OneBus.Infra.Ioc/OneBus.Infra.Ioc.csproj b/OneBus.Infra.Ioc/OneBus.Infra.Ioc.csproj index 8f286c4..e317c8d 100644 --- a/OneBus.Infra.Ioc/OneBus.Infra.Ioc.csproj +++ b/OneBus.Infra.Ioc/OneBus.Infra.Ioc.csproj @@ -7,7 +7,8 @@ - + + From ea0c6173cb6a0873ccff16408e669da007f6f365 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 14:06:58 -0300 Subject: [PATCH 08/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20De?= =?UTF-8?q?pendency=20Injection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding Scrutor code for the DI container --- OneBus.Infra.Ioc/DependencyInjection.cs | 59 ++----------------------- 1 file changed, 3 insertions(+), 56 deletions(-) diff --git a/OneBus.Infra.Ioc/DependencyInjection.cs b/OneBus.Infra.Ioc/DependencyInjection.cs index 63a046b..948fb4d 100644 --- a/OneBus.Infra.Ioc/DependencyInjection.cs +++ b/OneBus.Infra.Ioc/DependencyInjection.cs @@ -2,71 +2,18 @@ using Microsoft.Extensions.DependencyInjection; using OneBus.Application.Interfaces.Services; using OneBus.Application.Services; -using OneBus.Domain.Interfaces.Repositories; using OneBus.Infra.Data.Repositories; -using System.Reflection; namespace OneBus.Infra.Ioc { public static class DependencyInjection { public static IServiceCollection AddInfrastructure(this IServiceCollection services) - { - services.AddGenericRepositories(typeof(BaseReadOnlyRepository<,>).Assembly); - - services.AddValidatorsFromAssembly(typeof(IBaseReadOnlyService<,,>).Assembly); - - services.AddGenericServices(typeof(IBaseReadOnlyService<,,>).Assembly); - - return services; - } - - private static IServiceCollection AddGenericRepositories(this IServiceCollection services, Assembly assembly) { - var types = assembly.GetTypes() - .Where(t => t is { IsClass: true, IsAbstract: false }) // Apenas classes concretas - .ToList(); - - foreach (var type in types) - { - var interfaces = type.GetInterfaces() - .Where(i => i.IsGenericType && - (i.GetGenericTypeDefinition() == typeof(IBaseReadOnlyRepository<,>) || - i.GetGenericTypeDefinition() == typeof(IBaseRepository<,>))) - .ToList(); - - foreach (var @interface in interfaces) - { - services.AddScoped(@interface, type); - } - } - + services.Scan(c => c.FromAssemblyOf().AddClasses()); + services.Scan(c => c.FromAssemblyOf().AddClasses()); + services.AddValidatorsFromAssembly(typeof(IBaseReadOnlyService<,,>).Assembly); return services; } - - private static IServiceCollection AddGenericServices(this IServiceCollection services, Assembly assembly) - { - services.AddScoped(); - - var types = assembly.GetTypes() - .Where(t => t is { IsClass: true, IsAbstract: false }) // Apenas classes concretas - .ToList(); - - foreach (var type in types) - { - var interfaces = type.GetInterfaces() - .Where(i => i.IsGenericType && - (i.GetGenericTypeDefinition() == typeof(IBaseReadOnlyService<,,>) || - i.GetGenericTypeDefinition() == typeof(IBaseService<,,,,>))) - .ToList(); - - foreach (var @interface in interfaces) - { - services.AddScoped(@interface, type); - } - } - - return services; - } } } From 31c77712088e4ac7c103f1303311464c41aad448 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 14:08:16 -0300 Subject: [PATCH 09/41] =?UTF-8?q?=F0=9F=93=A6build:=20Update=20nuget=20pac?= =?UTF-8?q?kages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating OneBus.Test packages --- OneBus.Test/OneBus.Test.csproj | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/OneBus.Test/OneBus.Test.csproj b/OneBus.Test/OneBus.Test.csproj index 1d24554..5f947dd 100644 --- a/OneBus.Test/OneBus.Test.csproj +++ b/OneBus.Test/OneBus.Test.csproj @@ -8,10 +8,16 @@ - - - - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + From ca78f2665fe4c80870df607d5ad22c409817b2e0 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 14:09:40 -0300 Subject: [PATCH 10/41] =?UTF-8?q?=F0=9F=93=A6build:=20Update=20nuget=20pac?= =?UTF-8?q?kages?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating OneBus.API packages --- OneBus.API/OneBus.API.csproj | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/OneBus.API/OneBus.API.csproj b/OneBus.API/OneBus.API.csproj index ace8e86..fccf323 100644 --- a/OneBus.API/OneBus.API.csproj +++ b/OneBus.API/OneBus.API.csproj @@ -11,17 +11,17 @@ - - - + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + + + + + From c35516d071fa70af011561ac8077903c6edc60ca Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 14:11:41 -0300 Subject: [PATCH 11/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Pr?= =?UTF-8?q?ogram?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating EF Core database provider --- OneBus.API/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OneBus.API/Program.cs b/OneBus.API/Program.cs index 4917fef..bee52da 100644 --- a/OneBus.API/Program.cs +++ b/OneBus.API/Program.cs @@ -164,7 +164,7 @@ // Add DbContext Service builder.Services.AddDbContext(options => { - options.UseSqlServer(builder.Configuration.GetConnectionString("DbConnection"), + options.UseNpgsql(builder.Configuration.GetConnectionString("DbConnection"), sqlServerOpts => { sqlServerOpts.MigrationsAssembly(typeof(OneBusDbContext).Assembly); From 50d84fee34a0df2f319012db872b7c7eb00edc75 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 14:20:07 -0300 Subject: [PATCH 12/41] =?UTF-8?q?=F0=9F=A7=B9cleanup:=20Remove=20DateTimeE?= =?UTF-8?q?xtensions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing all references to DateTime extensions class because it's not necessary --- OneBus.Application/Services/TokenService.cs | 3 +-- OneBus.Domain/Entities/BaseEntity.cs | 8 +++----- OneBus.Domain/Extensions/DateTimeExtensions.cs | 11 ----------- 3 files changed, 4 insertions(+), 18 deletions(-) delete mode 100644 OneBus.Domain/Extensions/DateTimeExtensions.cs diff --git a/OneBus.Application/Services/TokenService.cs b/OneBus.Application/Services/TokenService.cs index 77df905..f32be05 100644 --- a/OneBus.Application/Services/TokenService.cs +++ b/OneBus.Application/Services/TokenService.cs @@ -2,7 +2,6 @@ using OneBus.Domain.Models; using OneBus.Domain.Settings; using System.Security.Claims; -using OneBus.Domain.Extensions; using System.Security.Principal; using Microsoft.Extensions.Options; using OneBus.Application.DTOs.User; @@ -33,7 +32,7 @@ public TokenModel Generate(ReadUserDTO user) ClaimsIdentity identity = new(new GenericIdentity(user.Email, "login"), claims); - DateTime createdAt = DateTime.UtcNow.ToBrazilianDateTime(); + DateTime createdAt = DateTime.UtcNow; DateTime expiresAt = createdAt.AddDays(_tokenSettings.DaysUntilExpires); return new TokenModel(Create( diff --git a/OneBus.Domain/Entities/BaseEntity.cs b/OneBus.Domain/Entities/BaseEntity.cs index 101b0be..c3ff294 100644 --- a/OneBus.Domain/Entities/BaseEntity.cs +++ b/OneBus.Domain/Entities/BaseEntity.cs @@ -1,12 +1,10 @@ -using OneBus.Domain.Extensions; - -namespace OneBus.Domain.Entities +namespace OneBus.Domain.Entities { public abstract class BaseEntity { protected BaseEntity() { - CreatedAt = DateTime.UtcNow.ToBrazilianDateTime(); + CreatedAt = DateTime.UtcNow; } public ulong Id { get; set; } @@ -17,7 +15,7 @@ protected BaseEntity() public void Disable() { - DeletedAt = DateTime.UtcNow.ToBrazilianDateTime(); + DeletedAt = DateTime.UtcNow; } public void Enable() diff --git a/OneBus.Domain/Extensions/DateTimeExtensions.cs b/OneBus.Domain/Extensions/DateTimeExtensions.cs deleted file mode 100644 index 9951811..0000000 --- a/OneBus.Domain/Extensions/DateTimeExtensions.cs +++ /dev/null @@ -1,11 +0,0 @@ -namespace OneBus.Domain.Extensions -{ - public static class DateTimeExtensions - { - public static DateTime ToBrazilianDateTime(this DateTime dateTime) - { - TimeZoneInfo brazilTimeZone = TimeZoneInfo.FindSystemTimeZoneById("E. South America Standard Time"); - return TimeZoneInfo.ConvertTimeFromUtc(dateTime.ToUniversalTime(), brazilTimeZone); - } - } -} From 6368bcf4b40d738d097c0d830ac7ac772f34463b Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 14:21:55 -0300 Subject: [PATCH 13/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Ba?= =?UTF-8?q?seFilter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding Value property to filter by any field when applicable --- OneBus.Domain/Filters/BaseFilter.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OneBus.Domain/Filters/BaseFilter.cs b/OneBus.Domain/Filters/BaseFilter.cs index ae59ef3..ccdd515 100644 --- a/OneBus.Domain/Filters/BaseFilter.cs +++ b/OneBus.Domain/Filters/BaseFilter.cs @@ -14,6 +14,8 @@ protected BaseFilter() OrderType = OrderType.Desc; } + public string? Value { get; set; } + [DefaultValue(true)] public bool? IsEnabled { get; set; } @@ -31,6 +33,6 @@ protected BaseFilter() public string OrderField { get; set; } [DefaultValue(OrderType.Desc)] - public OrderType OrderType { get; set; } + public OrderType OrderType { get; set; } } } From 33b09a55cbf54e5a6727d746cf89453e8a0dfeda Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 14:35:07 -0300 Subject: [PATCH 14/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Ba?= =?UTF-8?q?seFilter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing some base filtering fields because it's not applicable --- OneBus.Domain/Filters/BaseFilter.cs | 10 +--------- .../Repositories/BaseReadOnlyRepository.cs | 4 +--- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/OneBus.Domain/Filters/BaseFilter.cs b/OneBus.Domain/Filters/BaseFilter.cs index ccdd515..5c40220 100644 --- a/OneBus.Domain/Filters/BaseFilter.cs +++ b/OneBus.Domain/Filters/BaseFilter.cs @@ -7,21 +7,13 @@ public abstract class BaseFilter { protected BaseFilter() { - IsEnabled = true; CurrentPage = 1; PageSize = 15; OrderField = "id"; OrderType = OrderType.Desc; } - public string? Value { get; set; } - - [DefaultValue(true)] - public bool? IsEnabled { get; set; } - - public DateTime? StartDateTime { get; set; } - - public DateTime? EndDateTime { get; set; } + public string? Value { get; set; } [DefaultValue(1)] public uint CurrentPage { get; set; } diff --git a/OneBus.Infra.Data/Repositories/BaseReadOnlyRepository.cs b/OneBus.Infra.Data/Repositories/BaseReadOnlyRepository.cs index c7f84f2..a4b212a 100644 --- a/OneBus.Infra.Data/Repositories/BaseReadOnlyRepository.cs +++ b/OneBus.Infra.Data/Repositories/BaseReadOnlyRepository.cs @@ -94,9 +94,7 @@ protected virtual IQueryable ApplyDbQueryOptions(DbQueryOptions? dbQuer protected virtual Predicate ApplyFilter(TFilter filter) { - return c - => (filter.IsEnabled == null || (filter.IsEnabled.Value ? c.DeletedAt == null : c.DeletedAt != null)) && - (filter.StartDateTime == null || filter.EndDateTime == null || (c.CreatedAt >= filter.StartDateTime && c.CreatedAt <= filter.EndDateTime)); + return c => true; } } } From e1403eabdd6e3262dbf6e51f0e85f3c6b205bfa2 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 16:25:00 -0300 Subject: [PATCH 15/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Ba?= =?UTF-8?q?seEntity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding IsDeleted field and removing DeletedAt --- OneBus.Domain/Entities/BaseEntity.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/OneBus.Domain/Entities/BaseEntity.cs b/OneBus.Domain/Entities/BaseEntity.cs index c3ff294..289af9b 100644 --- a/OneBus.Domain/Entities/BaseEntity.cs +++ b/OneBus.Domain/Entities/BaseEntity.cs @@ -11,16 +11,11 @@ protected BaseEntity() public DateTime CreatedAt { get; set; } - public DateTime? DeletedAt { get; set; } + public bool IsDeleted { get; set; } - public void Disable() + public void Delete() { - DeletedAt = DateTime.UtcNow; - } - - public void Enable() - { - DeletedAt = null; + IsDeleted = true; } } } From d40430acb53bbcbd2cc0c82e52790256f0d60b3a Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 16:25:56 -0300 Subject: [PATCH 16/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Ba?= =?UTF-8?q?seEntityMapping?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating HasQueryFilter method with IsDeleted --- OneBus.Infra.Data/Mappings/BaseEntityMapping.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/OneBus.Infra.Data/Mappings/BaseEntityMapping.cs b/OneBus.Infra.Data/Mappings/BaseEntityMapping.cs index 3ae9109..4345bd6 100644 --- a/OneBus.Infra.Data/Mappings/BaseEntityMapping.cs +++ b/OneBus.Infra.Data/Mappings/BaseEntityMapping.cs @@ -12,11 +12,8 @@ public virtual void Configure(EntityTypeBuilder builder) builder.HasKey(c => c.Id); builder.Property(c => c.Id).UseIdentityColumn(); - builder.Property(c => c.CreatedAt).HasColumnName("DataCriacao"); - builder.Property(c => c.DeletedAt).HasColumnName("DataExclusao"); - //Sempre obter por padrão registros ativos em consultas - builder.HasQueryFilter(c => c.DeletedAt == null); + builder.HasQueryFilter(c => !c.IsDeleted); } } } From ba126760fb71d8649f50f23da9163e52100f747a Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 16:27:12 -0300 Subject: [PATCH 17/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Ba?= =?UTF-8?q?seService?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing Enable and Disable methods and adding Delete method --- .../Interfaces/Services/IBaseService.cs | 4 +--- OneBus.Application/Services/BaseService.cs | 24 ++++--------------- 2 files changed, 6 insertions(+), 22 deletions(-) diff --git a/OneBus.Application/Interfaces/Services/IBaseService.cs b/OneBus.Application/Interfaces/Services/IBaseService.cs index a987890..4bede10 100644 --- a/OneBus.Application/Interfaces/Services/IBaseService.cs +++ b/OneBus.Application/Interfaces/Services/IBaseService.cs @@ -16,8 +16,6 @@ public interface IBaseService> UpdateAsync(TUpdateDTO updateDTO, CancellationToken cancellationToken = default); - Task> EnableAsync(ulong id, CancellationToken cancellationToken = default); - - Task> DisableAsync(ulong id, CancellationToken cancellationToken = default); + Task> DeleteAsync(ulong id, CancellationToken cancellationToken = default); } } diff --git a/OneBus.Application/Services/BaseService.cs b/OneBus.Application/Services/BaseService.cs index 3e6af9b..65a951c 100644 --- a/OneBus.Application/Services/BaseService.cs +++ b/OneBus.Application/Services/BaseService.cs @@ -29,7 +29,7 @@ protected BaseService( IValidator createValidator, IValidator updateValidator) : base(baseRepository) { - _baseRepository = baseRepository; + _baseRepository = baseRepository; _createValidator = createValidator; _updateValidator = updateValidator; } @@ -64,30 +64,16 @@ public virtual async Task> UpdateAsync(TUpdateDTO updateDTO, Ca return SuccessResult.Create(entity.Adapt()); } - - public virtual async Task> DisableAsync(ulong id, CancellationToken cancellationToken = default) - { - TEntity? entity = await _baseReadOnlyRepository.GetOneAsync(c => c.Id == id, dbQueryOptions: null, cancellationToken); - - if (entity is null) - return NotFoundResult.Create(ErrorUtils.EntityNotFound()); - - entity.Disable(); - await _baseRepository.UpdateAsync(entity, cancellationToken); - - return SuccessResult.Create(true); - } - public virtual async Task> EnableAsync(ulong id, CancellationToken cancellationToken = default) + public virtual async Task> DeleteAsync(ulong id, CancellationToken cancellationToken = default) { - TEntity? entity = await _baseReadOnlyRepository.GetOneAsync(c => c.Id == id && c.DeletedAt != null, - DbQueryOptions.Create(ignoreQueryFilter: true), - cancellationToken); + TEntity? entity = await _baseReadOnlyRepository.GetOneAsync(c => c.Id == id, + cancellationToken: cancellationToken); if (entity is null) return NotFoundResult.Create(ErrorUtils.EntityNotFound()); - entity.Enable(); + entity.Delete(); await _baseRepository.UpdateAsync(entity, cancellationToken); return SuccessResult.Create(true); From 7bfb31f189a68ebfd3dafddab303ed74fb92b06a Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 16:28:03 -0300 Subject: [PATCH 18/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Co?= =?UTF-8?q?ntrollers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing Enable endpoints and updating Delete endpoints --- OneBus.API/Controllers/AddressController.cs | 26 +++------------- OneBus.API/Controllers/BaseController.cs | 30 +++++++------------ OneBus.API/Controllers/BusAuditController.cs | 26 +++------------- OneBus.API/Controllers/BusController.cs | 26 +++------------- .../Controllers/BusOperationController.cs | 26 +++------------- OneBus.API/Controllers/CompanyController.cs | 26 +++------------- OneBus.API/Controllers/EmployeeController.cs | 26 +++------------- .../Controllers/EmployeeGarageController.cs | 26 +++------------- .../Controllers/EmployeeWorkdayController.cs | 24 ++------------- OneBus.API/Controllers/GarageController.cs | 26 +++------------- .../Controllers/LineAddressController.cs | 26 +++------------- OneBus.API/Controllers/LineController.cs | 24 ++------------- .../Controllers/LineTariffAuditController.cs | 26 +++------------- .../Controllers/LineTariffController.cs | 26 +++------------- OneBus.API/Controllers/LineTimeController.cs | 26 +++------------- .../Controllers/MaintenanceController.cs | 26 +++------------- OneBus.API/Controllers/StopController.cs | 26 +++------------- OneBus.API/Controllers/StopTimeController.cs | 26 +++------------- OneBus.API/Controllers/UserController.cs | 26 +++------------- OneBus.API/Controllers/UserTypeController.cs | 26 +++------------- .../Controllers/UserTypeFeatureController.cs | 26 +++------------- OneBus.API/Controllers/VehicleController.cs | 26 +++------------- .../Controllers/VehicleGarageController.cs | 24 ++------------- .../Controllers/VehicleOperationController.cs | 26 +++------------- 24 files changed, 100 insertions(+), 522 deletions(-) diff --git a/OneBus.API/Controllers/AddressController.cs b/OneBus.API/Controllers/AddressController.cs index dbef9e2..1cdc048 100644 --- a/OneBus.API/Controllers/AddressController.cs +++ b/OneBus.API/Controllers/AddressController.cs @@ -58,27 +58,9 @@ public override Task UpdateAsync([FromRoute] ulong id, [FromBody] { return base.UpdateAsync(id, updateDTO, cancellationToken); } - - /// - /// Habilitar endereço - /// - /// - /// PUT para habilitar endereço - /// - /// Id do endereço - /// - /// Endereço habilitado - /// Endereço habilitado com sucesso - /// Endereço não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } - + /// - /// Desabilitar endereço + /// Deletar endereço /// /// /// DELETE de Endereço @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Endereço não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/BaseController.cs b/OneBus.API/Controllers/BaseController.cs index f06c8cc..9490e4a 100644 --- a/OneBus.API/Controllers/BaseController.cs +++ b/OneBus.API/Controllers/BaseController.cs @@ -8,7 +8,7 @@ using OneBus.Domain.Commons.Result; namespace OneBus.API.Controllers -{ +{ public abstract class BaseController : BaseReadOnlyController where TEntity : BaseEntity where TCreateDTO : BaseCreateDTO @@ -18,15 +18,15 @@ public abstract class BaseController _baseService; - protected BaseController(IBaseService baseService) + protected BaseController(IBaseService baseService) : base(baseService) { _baseService = baseService; } - + [HttpPost] public async virtual Task CreateAsync( - [FromBody] TCreateDTO createDTO, + [FromBody] TCreateDTO createDTO, CancellationToken cancellationToken = default) { return (await _baseService.CreateAsync(createDTO, cancellationToken)).ToActionResult(); @@ -34,30 +34,22 @@ public async virtual Task CreateAsync( [HttpPut("{id}")] public async virtual Task UpdateAsync( - [FromRoute] ulong id, - [FromBody] TUpdateDTO updateDTO, + [FromRoute] ulong id, + [FromBody] TUpdateDTO updateDTO, CancellationToken cancellationToken = default) { - if (id != updateDTO.Id) - return ConflictResult.Create(ErrorUtils.IdConflict()).ToActionResult(); + if (id != updateDTO.Id) + return ConflictResult.Create(ErrorUtils.IdConflict()).ToActionResult(); return (await _baseService.UpdateAsync(updateDTO, cancellationToken)).ToActionResult(); } - + [HttpDelete("{id}")] - public async virtual Task DisableAsync( - [FromRoute] ulong id, - CancellationToken cancellationToken = default) - { - return (await _baseService.DisableAsync(id, cancellationToken)).ToActionResult(); - } - - [HttpPut("{id}/enablements")] - public async virtual Task EnableAsync( + public async virtual Task DeleteAsync( [FromRoute] ulong id, CancellationToken cancellationToken = default) { - return (await _baseService.EnableAsync(id, cancellationToken)).ToActionResult(); + return (await _baseService.DeleteAsync(id, cancellationToken)).ToActionResult(); } } } diff --git a/OneBus.API/Controllers/BusAuditController.cs b/OneBus.API/Controllers/BusAuditController.cs index 6d85e86..7383ea3 100644 --- a/OneBus.API/Controllers/BusAuditController.cs +++ b/OneBus.API/Controllers/BusAuditController.cs @@ -57,28 +57,10 @@ public override Task CreateAsync([FromBody] CreateBusAuditDTO cre public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateBusAuditDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Habilitar auditoria de ônibus - /// - /// - /// PUT para habilitar auditoria de ônibus - /// - /// Id da auditoria de ônibus - /// - /// Auditoria de Ônibus habilitada - /// Auditoria de Ônibus habilitada com sucesso - /// Auditoria de Ônibus não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } + } /// - /// Desabilitar auditoria de ônibus + /// Deletar auditoria de ônibus /// /// /// DELETE de Auditoria de Ônibus @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Auditoria de Ônibus não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/BusController.cs b/OneBus.API/Controllers/BusController.cs index 6468fdf..f482822 100644 --- a/OneBus.API/Controllers/BusController.cs +++ b/OneBus.API/Controllers/BusController.cs @@ -57,28 +57,10 @@ public override Task CreateAsync([FromBody] CreateBusDTO createDT public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateBusDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Habilitar ônibus - /// - /// - /// PUT para habilitar ônibus - /// - /// Id do ônibus - /// - /// Ônibus habilitado - /// Ônibus habilitado com sucesso - /// Ônibus não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } + } /// - /// Desabilitar ônibus + /// Deletar ônibus /// /// /// DELETE de Ônibus @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Ônibus não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/BusOperationController.cs b/OneBus.API/Controllers/BusOperationController.cs index 671720a..8127f12 100644 --- a/OneBus.API/Controllers/BusOperationController.cs +++ b/OneBus.API/Controllers/BusOperationController.cs @@ -57,28 +57,10 @@ public override Task CreateAsync([FromBody] CreateBusOperationDTO public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateBusOperationDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Habilitar operação de ônibus - /// - /// - /// PUT para habilitar operação de ônibus - /// - /// Id da operação de ônibus - /// - /// Operação de Ônibus habilitada - /// Operação de Ônibus habilitada com sucesso - /// Operação de Ônibus não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } + } /// - /// Desabilitar operação de ônibus + /// Deletar operação de ônibus /// /// /// DELETE de Operação de Ônibus @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Operação de Ônibus não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/CompanyController.cs b/OneBus.API/Controllers/CompanyController.cs index 50d8be3..d24af48 100644 --- a/OneBus.API/Controllers/CompanyController.cs +++ b/OneBus.API/Controllers/CompanyController.cs @@ -61,28 +61,10 @@ public override Task CreateAsync([FromBody] CreateCompanyDTO crea public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateCompanyDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Habilitar empresa - /// - /// - /// PUT para habilitar empresa - /// - /// Id da empresa - /// - /// Empresa habilitada - /// Empresa habilitada com sucesso - /// Empresa não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } + } /// - /// Desabilitar empresa + /// Deletar empresa /// /// /// DELETE de Empresa @@ -94,9 +76,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Empresa não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/EmployeeController.cs b/OneBus.API/Controllers/EmployeeController.cs index 99ddc39..54ee15e 100644 --- a/OneBus.API/Controllers/EmployeeController.cs +++ b/OneBus.API/Controllers/EmployeeController.cs @@ -57,28 +57,10 @@ public override Task CreateAsync([FromBody] CreateEmployeeDTO cre public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateEmployeeDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Habilitar funcionário - /// - /// - /// PUT para habilitar funcionário - /// - /// Id do funcionário - /// - /// Funcionário habilitado - /// Funcionário habilitado com sucesso - /// Funcionário não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } + } /// - /// Desabilitar funcionário + /// Deletar funcionário /// /// /// DELETE de Funcionário @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Funcionário não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/EmployeeGarageController.cs b/OneBus.API/Controllers/EmployeeGarageController.cs index 9833bec..4d7ff2c 100644 --- a/OneBus.API/Controllers/EmployeeGarageController.cs +++ b/OneBus.API/Controllers/EmployeeGarageController.cs @@ -57,28 +57,10 @@ public override Task CreateAsync([FromBody] CreateEmployeeGarageD public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateEmployeeGarageDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Habilitar garagem do funcionário - /// - /// - /// PUT para habilitar garagem do funcionário - /// - /// Id da garagem do funcionário - /// - /// Garagem do Funcionário habilitada - /// Garagem do Funcionário habilitada com sucesso - /// Garagem do Funcionário não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } + } /// - /// Desabilitar garagem do funcionário + /// Deletar garagem do funcionário /// /// /// DELETE de Garagem do Funcionário @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Garagem do Funcionário não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/EmployeeWorkdayController.cs b/OneBus.API/Controllers/EmployeeWorkdayController.cs index a2b13c3..c4e388e 100644 --- a/OneBus.API/Controllers/EmployeeWorkdayController.cs +++ b/OneBus.API/Controllers/EmployeeWorkdayController.cs @@ -60,25 +60,7 @@ public override Task UpdateAsync([FromRoute] ulong id, [FromBody] } /// - /// Habilitar horário do funcionário - /// - /// - /// PUT para habilitar horário do funcionário - /// - /// Id do horário do funcionário - /// - /// Horário do Funcionário habilitado - /// Horário do Funcionário habilitado com sucesso - /// Horário do Funcionário não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } - - /// - /// Desabilitar horário do funcionário + /// Deletar horário do funcionário /// /// /// DELETE de Horário do Funcionário @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Horário do Funcionário não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/GarageController.cs b/OneBus.API/Controllers/GarageController.cs index 94e560d..dab359c 100644 --- a/OneBus.API/Controllers/GarageController.cs +++ b/OneBus.API/Controllers/GarageController.cs @@ -57,28 +57,10 @@ public override Task CreateAsync([FromBody] CreateGarageDTO creat public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateGarageDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Habilitar garagem - /// - /// - /// PUT para habilitar garagem - /// - /// Id da garagem - /// - /// Garagem habilitada - /// Garagem habilitada com sucesso - /// Garagem não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } + } /// - /// Desabilitar garagem + /// Deletar garagem /// /// /// DELETE de Garagem @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Garagem não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/LineAddressController.cs b/OneBus.API/Controllers/LineAddressController.cs index de8593a..40c962f 100644 --- a/OneBus.API/Controllers/LineAddressController.cs +++ b/OneBus.API/Controllers/LineAddressController.cs @@ -57,28 +57,10 @@ public override Task CreateAsync([FromBody] CreateLineAddressDTO public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateLineAddressDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Habilitar endereço de linha - /// - /// - /// PUT para habilitar endereço de linha - /// - /// Id de endereço de linha - /// - /// Endereço de Linha habilitado - /// Endereço de Linha habilitado com sucesso - /// Endereço de Linha não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } + } /// - /// Desabilitar endereço de linha + /// Deletar endereço de linha /// /// /// DELETE de Endereço Linha @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Endereço de Linha não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/LineController.cs b/OneBus.API/Controllers/LineController.cs index dac4dcb..36c3807 100644 --- a/OneBus.API/Controllers/LineController.cs +++ b/OneBus.API/Controllers/LineController.cs @@ -60,25 +60,7 @@ public override Task UpdateAsync([FromRoute] ulong id, [FromBody] } /// - /// Habilitar linha - /// - /// - /// PUT para habilitar linha - /// - /// Id da linha - /// - /// Linha habilitada - /// Linha habilitada com sucesso - /// Linha não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } - - /// - /// Desabilitar linha + /// Deletar linha /// /// /// DELETE de Linha @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Linha não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/LineTariffAuditController.cs b/OneBus.API/Controllers/LineTariffAuditController.cs index c5419dd..04ef350 100644 --- a/OneBus.API/Controllers/LineTariffAuditController.cs +++ b/OneBus.API/Controllers/LineTariffAuditController.cs @@ -57,28 +57,10 @@ public override Task CreateAsync([FromBody] CreateLineTariffAudit public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateLineTariffAuditDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Habilitar auditoria de tarifa de linha - /// - /// - /// PUT para habilitar auditoria de tarifa de linha - /// - /// Id da auditoria de tarifa de linha - /// - /// Auditoria de Tarifa de Linha habilitada - /// Auditoria de Tarifa de Linha habilitada com sucesso - /// Auditoria de Tarifa de Linha não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } + } /// - /// Desabilitar auditoria de tarifa de linha + /// Deletar auditoria de tarifa de linha /// /// /// DELETE de Auditoria de Tarifa de Linha @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Auditoria de Tarifa de Linha não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/LineTariffController.cs b/OneBus.API/Controllers/LineTariffController.cs index e9e094e..141ba31 100644 --- a/OneBus.API/Controllers/LineTariffController.cs +++ b/OneBus.API/Controllers/LineTariffController.cs @@ -57,28 +57,10 @@ public override Task CreateAsync([FromBody] CreateLineTariffDTO c public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateLineTariffDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Habilitar tarifa de linha - /// - /// - /// PUT para habilitar tarifa de linha - /// - /// Id da tarifa de linha - /// - /// Tarifa de Linha habilitada - /// Tarifa de Linha habilitada com sucesso - /// Tarifa de Linha não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } + } /// - /// Desabilitar tarifa de linha + /// Deletar tarifa de linha /// /// /// DELETE de Tarifa de Linha @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Tarifa de Linha não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/LineTimeController.cs b/OneBus.API/Controllers/LineTimeController.cs index 1f38ae1..8ae402f 100644 --- a/OneBus.API/Controllers/LineTimeController.cs +++ b/OneBus.API/Controllers/LineTimeController.cs @@ -57,28 +57,10 @@ public override Task CreateAsync([FromBody] CreateLineTimeDTO cre public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateLineTimeDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Habilitar horário de linha - /// - /// - /// PUT para habilitar horário de linha - /// - /// Id do horário de linha - /// - /// Horário de Linha habilitado - /// Horário de Linha habilitado com sucesso - /// Horário de Linha não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } + } /// - /// Desabilitar horário de linha + /// Deletar horário de linha /// /// /// DELETE de Horário de Linha @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Horário de Linha não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/MaintenanceController.cs b/OneBus.API/Controllers/MaintenanceController.cs index eac1847..7518ce6 100644 --- a/OneBus.API/Controllers/MaintenanceController.cs +++ b/OneBus.API/Controllers/MaintenanceController.cs @@ -57,28 +57,10 @@ public override Task CreateAsync([FromBody] CreateMaintenanceDTO public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateMaintenanceDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Habilitar manutenção - /// - /// - /// PUT para habilitar manutenção - /// - /// Id da manutenção - /// - /// Manutenção habilitada - /// Manutenção habilitada com sucesso - /// Manutenção não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } + } /// - /// Desabilitar manutenção + /// Deletar manutenção /// /// /// DELETE de Manutenção @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Manutenção não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/StopController.cs b/OneBus.API/Controllers/StopController.cs index f5395fb..e192499 100644 --- a/OneBus.API/Controllers/StopController.cs +++ b/OneBus.API/Controllers/StopController.cs @@ -13,7 +13,7 @@ namespace OneBus.API.Controllers public class StopController : BaseController { public StopController( - IBaseService baseService) + IBaseService baseService) : base(baseService) { } @@ -60,25 +60,7 @@ public override Task UpdateAsync([FromRoute] ulong id, [FromBody] } /// - /// Habilitar parada - /// - /// - /// PUT para habilitar parada - /// - /// Id da parada - /// - /// Parada habilitada - /// Parada habilitada com sucesso - /// Parada não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } - - /// - /// Desabilitar parada + /// Deletar parada /// /// /// DELETE de Parada @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Parada não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/StopTimeController.cs b/OneBus.API/Controllers/StopTimeController.cs index bd06f9b..bbf0330 100644 --- a/OneBus.API/Controllers/StopTimeController.cs +++ b/OneBus.API/Controllers/StopTimeController.cs @@ -57,28 +57,10 @@ public override Task CreateAsync([FromBody] CreateStopTimeDTO cre public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateStopTimeDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Habilitar horário de parada - /// - /// - /// PUT para habilitar horário de parada - /// - /// Id do horário de parada - /// - /// Horário de Parada habilitado - /// Horário de Parada habilitado com sucesso - /// Horário de Parada não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } + } /// - /// Desabilitar horário de parada + /// Deletar horário de parada /// /// /// DELETE de Horário de Parada @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Horário de Parada não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/UserController.cs b/OneBus.API/Controllers/UserController.cs index 5022cbf..23428ab 100644 --- a/OneBus.API/Controllers/UserController.cs +++ b/OneBus.API/Controllers/UserController.cs @@ -77,28 +77,10 @@ public override Task CreateAsync([FromBody] CreateUserDTO createD public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateUserDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Habilitar usuário - /// - /// - /// PUT para habilitar usuário - /// - /// Id do usuário - /// - /// Usuário habilitado - /// Usuário habilitado com sucesso - /// Usuário não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } + } /// - /// Desabilitar usuário + /// Deletar usuário /// /// /// DELETE de Usuário @@ -110,9 +92,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Usuário não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/UserTypeController.cs b/OneBus.API/Controllers/UserTypeController.cs index 86e1648..aeebff4 100644 --- a/OneBus.API/Controllers/UserTypeController.cs +++ b/OneBus.API/Controllers/UserTypeController.cs @@ -56,28 +56,10 @@ public override Task CreateAsync([FromBody] CreateUserTypeDTO cre public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateUserTypeDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Habilitar tipo de usuário - /// - /// - /// PUT para habilitar tipo de usuário - /// - /// Id do tipo de usuário - /// - /// Tipo de Usuário habilitado - /// Tipo de Usuário habilitado com sucesso - /// Tipo de Usuário não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } + } /// - /// Desabilitar tipo de usuário + /// Deletar tipo de usuário /// /// /// DELETE de Tipo de Usuário @@ -89,9 +71,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Tipo de Usuário não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/UserTypeFeatureController.cs b/OneBus.API/Controllers/UserTypeFeatureController.cs index a5fda32..f6ba8b5 100644 --- a/OneBus.API/Controllers/UserTypeFeatureController.cs +++ b/OneBus.API/Controllers/UserTypeFeatureController.cs @@ -12,7 +12,7 @@ namespace OneBus.API.Controllers [SwaggerTag("Controlador responsável por gerenciar Funcionalidades de Tipos de Usuários")] public class UserTypeFeatureController : BaseController { - public UserTypeFeatureController(IBaseService baseService) + public UserTypeFeatureController(IBaseService baseService) : base(baseService) { } @@ -59,25 +59,7 @@ public override Task UpdateAsync([FromRoute] ulong id, [FromBody] } /// - /// Habilitar funcionalidade de tipo de usuário - /// - /// - /// PUT para habilitar funcionalidade de tipo de usuário - /// - /// Id da funcionalidade de tipo de usuário - /// - /// Funcionalidade de Tipo de Usuário habilitada - /// Funcionalidade de Tipo de Usuário habilitada com sucesso - /// Funcionalidade de Tipo de Usuário não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } - - /// - /// Desabilitar funcionalidade de tipo de usuário + /// Deletar funcionalidade de tipo de usuário /// /// /// DELETE de Funcionalidade de Tipo de Usuário @@ -89,9 +71,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Funcionalidade de Tipo de Usuário não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/VehicleController.cs b/OneBus.API/Controllers/VehicleController.cs index a561f49..36d73b8 100644 --- a/OneBus.API/Controllers/VehicleController.cs +++ b/OneBus.API/Controllers/VehicleController.cs @@ -57,28 +57,10 @@ public override Task CreateAsync([FromBody] CreateVehicleDTO crea public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateVehicleDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Habilitar veículo - /// - /// - /// PUT para habilitar veículo - /// - /// Id do veículo - /// - /// Veículo habilitado - /// Veículo habilitado com sucesso - /// Veículo não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } + } /// - /// Desabilitar veículo + /// Deletar veículo /// /// /// DELETE de Veículo @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Veículo não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/VehicleGarageController.cs b/OneBus.API/Controllers/VehicleGarageController.cs index 363504e..df5ff67 100644 --- a/OneBus.API/Controllers/VehicleGarageController.cs +++ b/OneBus.API/Controllers/VehicleGarageController.cs @@ -60,25 +60,7 @@ public override Task UpdateAsync([FromRoute] ulong id, [FromBody] } /// - /// Habilitar garagem de veículo - /// - /// - /// PUT para habilitar garagem de veículo - /// - /// Id da garagem de veículo - /// - /// Garagem de Veículo habilitada - /// Garagem de Veículo habilitada com sucesso - /// Garagem de Veículo não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } - - /// - /// Desabilitar garagem de veículo + /// Deletar garagem de veículo /// /// /// DELETE de Garagem de Veículo @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Garagem de Veículo não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// diff --git a/OneBus.API/Controllers/VehicleOperationController.cs b/OneBus.API/Controllers/VehicleOperationController.cs index 8bab7c5..7c41001 100644 --- a/OneBus.API/Controllers/VehicleOperationController.cs +++ b/OneBus.API/Controllers/VehicleOperationController.cs @@ -57,28 +57,10 @@ public override Task CreateAsync([FromBody] CreateVehicleOperatio public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateVehicleOperationDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Habilitar operação de veículo - /// - /// - /// PUT para habilitar operação de veículo - /// - /// Id da operação de veículo - /// - /// Operação de Veículo habilitada - /// Operação de Veículo habilitada com sucesso - /// Operação de Veículo não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task EnableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.EnableAsync(id, cancellationToken); - } + } /// - /// Desabilitar operação de veículo + /// Deletar operação de veículo /// /// /// DELETE de Operação de Veículo @@ -90,9 +72,9 @@ public override Task EnableAsync([FromRoute] ulong id, Cancellati /// Operação de Veículo não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DisableAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) { - return base.DisableAsync(id, cancellationToken); + return base.DeleteAsync(id, cancellationToken); } /// From d286fe956d49498dda5db0228d4aefd0d97c2005 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 16:33:53 -0300 Subject: [PATCH 19/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Us?= =?UTF-8?q?er=20Entity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing some fields because it's not necessary for the moment like UserTypeId, Image and Phone --- OneBus.Domain/Entities/User.cs | 9 --------- OneBus.Domain/Entities/UserType.cs | 5 ++++- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/OneBus.Domain/Entities/User.cs b/OneBus.Domain/Entities/User.cs index 416ba08..7d40759 100644 --- a/OneBus.Domain/Entities/User.cs +++ b/OneBus.Domain/Entities/User.cs @@ -8,23 +8,14 @@ public User() Email = string.Empty; Password = string.Empty; Salt = string.Empty; - Phone = string.Empty; } - public ulong UserTypeId { get; set; } - public string Name { get; set; } public string Email { get; set; } - public string Phone { get; set; } - public string Password { get; set; } public string Salt { get; set; } - - public string? Image { get; set; } - - public UserType? UserType { get; set; } } } diff --git a/OneBus.Domain/Entities/UserType.cs b/OneBus.Domain/Entities/UserType.cs index 70ca7d2..713d3f6 100644 --- a/OneBus.Domain/Entities/UserType.cs +++ b/OneBus.Domain/Entities/UserType.cs @@ -1,5 +1,8 @@ -namespace OneBus.Domain.Entities +using System.ComponentModel.DataAnnotations.Schema; + +namespace OneBus.Domain.Entities { + [NotMapped] public class UserType : BaseEntity { public UserType() From 469bd30952fe7746d5d77ce7300daf33da2f2e81 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 16:34:54 -0300 Subject: [PATCH 20/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20En?= =?UTF-8?q?tities?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding [NotMapped] attribute because it's not necessary add all entities to the database --- OneBus.Domain/Entities/Address.cs | 5 ++++- OneBus.Domain/Entities/Bus.cs | 2 ++ OneBus.Domain/Entities/BusAudit.cs | 5 ++++- OneBus.Domain/Entities/BusOperation.cs | 5 ++++- OneBus.Domain/Entities/Company.cs | 5 ++++- OneBus.Domain/Entities/Employee.cs | 2 ++ OneBus.Domain/Entities/EmployeeGarage.cs | 5 ++++- OneBus.Domain/Entities/EmployeeWorkday.cs | 2 ++ OneBus.Domain/Entities/Feature.cs | 5 ++++- OneBus.Domain/Entities/Garage.cs | 5 ++++- OneBus.Domain/Entities/Line.cs | 2 ++ OneBus.Domain/Entities/LineAddress.cs | 4 +++- OneBus.Domain/Entities/LineTariff.cs | 5 ++++- OneBus.Domain/Entities/LineTariffAudit.cs | 5 ++++- OneBus.Domain/Entities/LineTime.cs | 2 ++ OneBus.Domain/Entities/Maintenance.cs | 2 ++ OneBus.Domain/Entities/Stop.cs | 5 ++++- OneBus.Domain/Entities/StopTime.cs | 2 ++ OneBus.Domain/Entities/UserTypeFeature.cs | 5 ++++- OneBus.Domain/Entities/Vehicle.cs | 2 ++ OneBus.Domain/Entities/VehicleGarage.cs | 5 ++++- OneBus.Domain/Entities/VehicleOperation.cs | 5 ++++- 22 files changed, 71 insertions(+), 14 deletions(-) diff --git a/OneBus.Domain/Entities/Address.cs b/OneBus.Domain/Entities/Address.cs index 95ee7f6..26c25c8 100644 --- a/OneBus.Domain/Entities/Address.cs +++ b/OneBus.Domain/Entities/Address.cs @@ -1,5 +1,8 @@ -namespace OneBus.Domain.Entities +using System.ComponentModel.DataAnnotations.Schema; + +namespace OneBus.Domain.Entities { + [NotMapped] public class Address : BaseEntity { public Address() diff --git a/OneBus.Domain/Entities/Bus.cs b/OneBus.Domain/Entities/Bus.cs index 1d34c14..644ab40 100644 --- a/OneBus.Domain/Entities/Bus.cs +++ b/OneBus.Domain/Entities/Bus.cs @@ -1,7 +1,9 @@ using OneBus.Domain.Enums.Bus; +using System.ComponentModel.DataAnnotations.Schema; namespace OneBus.Domain.Entities { + [NotMapped] public class Bus : BaseEntity { public Bus() diff --git a/OneBus.Domain/Entities/BusAudit.cs b/OneBus.Domain/Entities/BusAudit.cs index 4775c44..5ccc3e8 100644 --- a/OneBus.Domain/Entities/BusAudit.cs +++ b/OneBus.Domain/Entities/BusAudit.cs @@ -1,5 +1,8 @@ -namespace OneBus.Domain.Entities +using System.ComponentModel.DataAnnotations.Schema; + +namespace OneBus.Domain.Entities { + [NotMapped] public class BusAudit : BaseEntity { public ulong EmployeeId { get; set; } diff --git a/OneBus.Domain/Entities/BusOperation.cs b/OneBus.Domain/Entities/BusOperation.cs index 3603918..5851c59 100644 --- a/OneBus.Domain/Entities/BusOperation.cs +++ b/OneBus.Domain/Entities/BusOperation.cs @@ -1,5 +1,8 @@ -namespace OneBus.Domain.Entities +using System.ComponentModel.DataAnnotations.Schema; + +namespace OneBus.Domain.Entities { + [NotMapped] public class BusOperation : BaseEntity { public ulong LineTimeId { get; set; } diff --git a/OneBus.Domain/Entities/Company.cs b/OneBus.Domain/Entities/Company.cs index 0a271e3..09449aa 100644 --- a/OneBus.Domain/Entities/Company.cs +++ b/OneBus.Domain/Entities/Company.cs @@ -1,5 +1,8 @@ -namespace OneBus.Domain.Entities +using System.ComponentModel.DataAnnotations.Schema; + +namespace OneBus.Domain.Entities { + [NotMapped] public class Company : BaseEntity { public Company() diff --git a/OneBus.Domain/Entities/Employee.cs b/OneBus.Domain/Entities/Employee.cs index 3154989..9960c51 100644 --- a/OneBus.Domain/Entities/Employee.cs +++ b/OneBus.Domain/Entities/Employee.cs @@ -1,7 +1,9 @@ using OneBus.Domain.Enums.Employee; +using System.ComponentModel.DataAnnotations.Schema; namespace OneBus.Domain.Entities { + [NotMapped] public class Employee : BaseEntity { public Employee() diff --git a/OneBus.Domain/Entities/EmployeeGarage.cs b/OneBus.Domain/Entities/EmployeeGarage.cs index 4f7caad..12237f0 100644 --- a/OneBus.Domain/Entities/EmployeeGarage.cs +++ b/OneBus.Domain/Entities/EmployeeGarage.cs @@ -1,5 +1,8 @@ -namespace OneBus.Domain.Entities +using System.ComponentModel.DataAnnotations.Schema; + +namespace OneBus.Domain.Entities { + [NotMapped] public class EmployeeGarage : BaseEntity { public ulong EmployeeId { get; set; } diff --git a/OneBus.Domain/Entities/EmployeeWorkday.cs b/OneBus.Domain/Entities/EmployeeWorkday.cs index 52b2c10..7587120 100644 --- a/OneBus.Domain/Entities/EmployeeWorkday.cs +++ b/OneBus.Domain/Entities/EmployeeWorkday.cs @@ -1,7 +1,9 @@ using OneBus.Domain.Enums.StopTime; +using System.ComponentModel.DataAnnotations.Schema; namespace OneBus.Domain.Entities { + [NotMapped] public class EmployeeWorkday : BaseEntity { public ulong EmployeeId { get; set; } diff --git a/OneBus.Domain/Entities/Feature.cs b/OneBus.Domain/Entities/Feature.cs index 2eb4ea2..07f1553 100644 --- a/OneBus.Domain/Entities/Feature.cs +++ b/OneBus.Domain/Entities/Feature.cs @@ -1,5 +1,8 @@ -namespace OneBus.Domain.Entities +using System.ComponentModel.DataAnnotations.Schema; + +namespace OneBus.Domain.Entities { + [NotMapped] public class Feature : BaseEntity { public Feature() diff --git a/OneBus.Domain/Entities/Garage.cs b/OneBus.Domain/Entities/Garage.cs index 12a9b4a..cf6a007 100644 --- a/OneBus.Domain/Entities/Garage.cs +++ b/OneBus.Domain/Entities/Garage.cs @@ -1,5 +1,8 @@ -namespace OneBus.Domain.Entities +using System.ComponentModel.DataAnnotations.Schema; + +namespace OneBus.Domain.Entities { + [NotMapped] public class Garage : BaseEntity { public Garage() diff --git a/OneBus.Domain/Entities/Line.cs b/OneBus.Domain/Entities/Line.cs index 912505c..a6561d7 100644 --- a/OneBus.Domain/Entities/Line.cs +++ b/OneBus.Domain/Entities/Line.cs @@ -1,7 +1,9 @@ using OneBus.Domain.Enums.Line; +using System.ComponentModel.DataAnnotations.Schema; namespace OneBus.Domain.Entities { + [NotMapped] public class Line : BaseEntity { public Line() diff --git a/OneBus.Domain/Entities/LineAddress.cs b/OneBus.Domain/Entities/LineAddress.cs index c3d1928..2e28644 100644 --- a/OneBus.Domain/Entities/LineAddress.cs +++ b/OneBus.Domain/Entities/LineAddress.cs @@ -1,7 +1,9 @@ using OneBus.Domain.Enums.LineAddress; +using System.ComponentModel.DataAnnotations.Schema; namespace OneBus.Domain.Entities -{ +{ + [NotMapped] public class LineAddress : BaseEntity { public ulong LineId { get; set; } diff --git a/OneBus.Domain/Entities/LineTariff.cs b/OneBus.Domain/Entities/LineTariff.cs index 7e9c62b..3729572 100644 --- a/OneBus.Domain/Entities/LineTariff.cs +++ b/OneBus.Domain/Entities/LineTariff.cs @@ -1,5 +1,8 @@ -namespace OneBus.Domain.Entities +using System.ComponentModel.DataAnnotations.Schema; + +namespace OneBus.Domain.Entities { + [NotMapped] public class LineTariff : BaseEntity { public ulong LineId { get; set; } diff --git a/OneBus.Domain/Entities/LineTariffAudit.cs b/OneBus.Domain/Entities/LineTariffAudit.cs index 3169a5c..bdd62a2 100644 --- a/OneBus.Domain/Entities/LineTariffAudit.cs +++ b/OneBus.Domain/Entities/LineTariffAudit.cs @@ -1,5 +1,8 @@ -namespace OneBus.Domain.Entities +using System.ComponentModel.DataAnnotations.Schema; + +namespace OneBus.Domain.Entities { + [NotMapped] public class LineTariffAudit : BaseEntity { public ulong EmployeeId { get; set; } diff --git a/OneBus.Domain/Entities/LineTime.cs b/OneBus.Domain/Entities/LineTime.cs index 65bb3bb..a2e03a1 100644 --- a/OneBus.Domain/Entities/LineTime.cs +++ b/OneBus.Domain/Entities/LineTime.cs @@ -1,7 +1,9 @@ using OneBus.Domain.Enums.StopTime; +using System.ComponentModel.DataAnnotations.Schema; namespace OneBus.Domain.Entities { + [NotMapped] public class LineTime : BaseEntity { public ulong LineId { get; set; } diff --git a/OneBus.Domain/Entities/Maintenance.cs b/OneBus.Domain/Entities/Maintenance.cs index f641181..113463d 100644 --- a/OneBus.Domain/Entities/Maintenance.cs +++ b/OneBus.Domain/Entities/Maintenance.cs @@ -1,7 +1,9 @@ using OneBus.Domain.Enums.Maintenance; +using System.ComponentModel.DataAnnotations.Schema; namespace OneBus.Domain.Entities { + [NotMapped] public class Maintenance : BaseEntity { public Maintenance() diff --git a/OneBus.Domain/Entities/Stop.cs b/OneBus.Domain/Entities/Stop.cs index 7d639f2..82df64f 100644 --- a/OneBus.Domain/Entities/Stop.cs +++ b/OneBus.Domain/Entities/Stop.cs @@ -1,5 +1,8 @@ -namespace OneBus.Domain.Entities +using System.ComponentModel.DataAnnotations.Schema; + +namespace OneBus.Domain.Entities { + [NotMapped] public class Stop : BaseEntity { public ulong LineAddressId { get; set; } diff --git a/OneBus.Domain/Entities/StopTime.cs b/OneBus.Domain/Entities/StopTime.cs index 755a3c4..5e0c9b2 100644 --- a/OneBus.Domain/Entities/StopTime.cs +++ b/OneBus.Domain/Entities/StopTime.cs @@ -1,7 +1,9 @@ using OneBus.Domain.Enums.StopTime; +using System.ComponentModel.DataAnnotations.Schema; namespace OneBus.Domain.Entities { + [NotMapped] public class StopTime : BaseEntity { public StopTime() diff --git a/OneBus.Domain/Entities/UserTypeFeature.cs b/OneBus.Domain/Entities/UserTypeFeature.cs index 902da9f..9c2d51b 100644 --- a/OneBus.Domain/Entities/UserTypeFeature.cs +++ b/OneBus.Domain/Entities/UserTypeFeature.cs @@ -1,5 +1,8 @@ -namespace OneBus.Domain.Entities +using System.ComponentModel.DataAnnotations.Schema; + +namespace OneBus.Domain.Entities { + [NotMapped] public class UserTypeFeature : BaseEntity { public ulong UserTypeId { get; set; } diff --git a/OneBus.Domain/Entities/Vehicle.cs b/OneBus.Domain/Entities/Vehicle.cs index 60a4d18..6dcc62b 100644 --- a/OneBus.Domain/Entities/Vehicle.cs +++ b/OneBus.Domain/Entities/Vehicle.cs @@ -1,7 +1,9 @@ using OneBus.Domain.Enums.Vehicle; +using System.ComponentModel.DataAnnotations.Schema; namespace OneBus.Domain.Entities { + [NotMapped] public class Vehicle : BaseEntity { public Vehicle() diff --git a/OneBus.Domain/Entities/VehicleGarage.cs b/OneBus.Domain/Entities/VehicleGarage.cs index ebeecf6..e43ff4f 100644 --- a/OneBus.Domain/Entities/VehicleGarage.cs +++ b/OneBus.Domain/Entities/VehicleGarage.cs @@ -1,5 +1,8 @@ -namespace OneBus.Domain.Entities +using System.ComponentModel.DataAnnotations.Schema; + +namespace OneBus.Domain.Entities { + [NotMapped] public class VehicleGarage : BaseEntity { public ulong VehicleId { get; set; } diff --git a/OneBus.Domain/Entities/VehicleOperation.cs b/OneBus.Domain/Entities/VehicleOperation.cs index bf7299d..a5c1506 100644 --- a/OneBus.Domain/Entities/VehicleOperation.cs +++ b/OneBus.Domain/Entities/VehicleOperation.cs @@ -1,5 +1,8 @@ -namespace OneBus.Domain.Entities +using System.ComponentModel.DataAnnotations.Schema; + +namespace OneBus.Domain.Entities { + [NotMapped] public class VehicleOperation : BaseEntity { public ulong EmployeeWorkdayId { get; set; } From 25d602cff23c43285d250355b78fc339a67b4643 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 16:35:27 -0300 Subject: [PATCH 21/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Us?= =?UTF-8?q?er=20Mapping?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating User Mapping properties --- OneBus.Infra.Data/Mappings/UserMapping.cs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/OneBus.Infra.Data/Mappings/UserMapping.cs b/OneBus.Infra.Data/Mappings/UserMapping.cs index 29e509d..bdd7136 100644 --- a/OneBus.Infra.Data/Mappings/UserMapping.cs +++ b/OneBus.Infra.Data/Mappings/UserMapping.cs @@ -1,5 +1,4 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.EntityFrameworkCore.Metadata.Builders; using OneBus.Domain.Entities; namespace OneBus.Infra.Data.Mappings @@ -8,21 +7,12 @@ public class UserMapping : BaseEntityMapping { public override void Configure(EntityTypeBuilder builder) { - builder.ToTable("Usuario"); base.Configure(builder); builder.Property(c => c.Email).HasMaxLength(80); - builder.Property(c => c.UserTypeId).HasColumnName("TipoUsuarioId"); - builder.Property(c => c.Salt).HasColumnName("Sal").HasMaxLength(25); - builder.Property(c => c.Name).HasColumnName("Nome").HasMaxLength(80); - builder.Property(c => c.Image).HasColumnName("Foto").HasMaxLength(20); - builder.Property(c => c.Phone).HasColumnName("Telefone").HasMaxLength(20); - builder.Property(c => c.Password).HasColumnName("Senha").HasMaxLength(50); - - builder - .HasOne(c => c.UserType) - .WithMany(c => c.Users) - .HasForeignKey(c => c.UserTypeId); + builder.Property(c => c.Salt).HasMaxLength(25); + builder.Property(c => c.Name).HasMaxLength(80); + builder.Property(c => c.Password).HasMaxLength(50); } } } From eb785090ced15948ac91a4b8fcf46794a16215f8 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sat, 23 Aug 2025 16:43:46 -0300 Subject: [PATCH 22/41] =?UTF-8?q?=E2=9C=A8feat:=20Add=20EncryptExtensions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding EncryptExtensions class to handle Hashing --- .../Extensions/EncryptExtensions.cs | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 OneBus.Application/Extensions/EncryptExtensions.cs diff --git a/OneBus.Application/Extensions/EncryptExtensions.cs b/OneBus.Application/Extensions/EncryptExtensions.cs new file mode 100644 index 0000000..f81180e --- /dev/null +++ b/OneBus.Application/Extensions/EncryptExtensions.cs @@ -0,0 +1,33 @@ +using Konscious.Security.Cryptography; +using System.Security.Cryptography; +using System.Text; + +namespace OneBus.Application.Extensions +{ + public static class EncryptExtensions + { + public static string Hash(this string value, string salt) + { + var argon2 = new Argon2id(Encoding.UTF8.GetBytes(value)) + { + Salt = Encoding.UTF8.GetBytes(salt), + DegreeOfParallelism = 8, // How many threads + MemorySize = 65536, // Memory (KB) + Iterations = 4 // Iterations + }; + + const int hashLength = 32; // Hash size (in bytes) + return Convert.ToBase64String(argon2.GetBytes(hashLength)); + } + + public static bool Verify(this string value, string input, string salt) + { + byte[] savedHash = Convert.FromBase64String(value); + + byte[] newHash = Convert.FromBase64String(input.Hash(salt)); + + // Secure comparison (prevents timing attacks) + return CryptographicOperations.FixedTimeEquals(savedHash, newHash); + } + } +} From eaac0a8db8db8e0c42360bc2de5700bd56766133 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 00:22:23 -0300 Subject: [PATCH 23/41] =?UTF-8?q?=F0=9F=97=91=EF=B8=8Fremove:=20Remove=20u?= =?UTF-8?q?nnecessary=20entities?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing unnecessary entities and related classes --- OneBus.API/Authorizations/FeatureHandler.cs | 28 -- .../Authorizations/FeatureRequirement.cs | 14 - OneBus.API/Controllers/AddressController.cs | 114 -------- OneBus.API/Controllers/BusAuditController.cs | 114 -------- OneBus.API/Controllers/CompanyController.cs | 118 -------- .../Controllers/EmployeeGarageController.cs | 114 -------- OneBus.API/Controllers/FeatureController.cs | 54 ---- OneBus.API/Controllers/GarageController.cs | 114 -------- .../Controllers/LineAddressController.cs | 114 -------- .../Controllers/LineTariffAuditController.cs | 114 -------- .../Controllers/LineTariffController.cs | 114 -------- OneBus.API/Controllers/StopController.cs | 114 -------- OneBus.API/Controllers/StopTimeController.cs | 114 -------- OneBus.API/Controllers/UserTypeController.cs | 113 -------- .../Controllers/UserTypeFeatureController.cs | 113 -------- .../Controllers/VehicleGarageController.cs | 114 -------- .../DTOs/Address/CreateAddressDTO.cs | 6 - .../DTOs/Address/ReadAddressDTO.cs | 6 - .../DTOs/Address/UpdateAddressDTO.cs | 6 - .../DTOs/BusAudit/CreateBusAuditDTO.cs | 6 - .../DTOs/BusAudit/ReadBusAuditDTO.cs | 6 - .../DTOs/BusAudit/UpdateBusAuditDTO.cs | 6 - .../DTOs/Company/CreateCompanyDTO.cs | 23 -- .../DTOs/Company/ReadCompanyDTO.cs | 6 - .../DTOs/Company/UpdateCompanyDTO.cs | 6 - .../EmployeeGarage/CreateEmployeeGarageDTO.cs | 6 - .../EmployeeGarage/ReadEmployeeGarageDTO.cs | 6 - .../EmployeeGarage/UpdateEmployeeGarageDTO.cs | 6 - .../DTOs/Feature/ReadFeatureDTO.cs | 6 - .../DTOs/Garage/CreateGarageDTO.cs | 6 - .../DTOs/Garage/ReadGarageDTO.cs | 6 - .../DTOs/Garage/UpdateGarageDTO.cs | 6 - .../DTOs/LineAddress/CreateLineAddressDTO.cs | 6 - .../DTOs/LineAddress/ReadLineAddressDTO.cs | 6 - .../DTOs/LineAddress/UpdateLineAddressDTO.cs | 6 - .../DTOs/LineTariff/CreateLineTariffDTO.cs | 6 - .../DTOs/LineTariff/ReadLineTariffDTO.cs | 6 - .../DTOs/LineTariff/UpdateLineTariffDTO.cs | 6 - .../CreateLineTariffAuditDTO.cs | 6 - .../LineTariffAudit/ReadLineTariffAuditDTO.cs | 6 - .../UpdateLineTariffAuditDTO.cs | 6 - OneBus.Application/DTOs/Stop/CreateStopDTO.cs | 6 - OneBus.Application/DTOs/Stop/ReadStopDTO.cs | 6 - OneBus.Application/DTOs/Stop/UpdateStopDTO.cs | 6 - .../DTOs/StopTime/CreateStopTimeDTO.cs | 6 - .../DTOs/StopTime/ReadStopTimeDTO.cs | 6 - .../DTOs/StopTime/UpdateStopTimeDTO.cs | 6 - .../DTOs/UserType/CreateUserTypeDTO.cs | 6 - .../DTOs/UserType/ReadUserTypeDTO.cs | 6 - .../DTOs/UserType/UpdateUserTypeDTO.cs | 6 - .../CreateUserTypeFeatureDTO.cs | 6 - .../UserTypeFeature/ReadUserTypeFeatureDTO.cs | 6 - .../UpdateUserTypeFeatureDTO.cs | 6 - .../VehicleGarage/CreateVehicleGarageDTO.cs | 6 - .../VehicleGarage/ReadVehicleGarageDTO.cs | 6 - .../VehicleGarage/UpdateVehicleGarageDTO.cs | 6 - .../Interfaces/Services/IAddressService.cs | 11 - .../Interfaces/Services/IBusAuditService.cs | 11 - .../Interfaces/Services/ICompanyService.cs | 11 - .../Interfaces/Services/IEmailService.cs | 10 - .../Services/IEmployeeGarageService.cs | 11 - .../Interfaces/Services/IFeatureService.cs | 10 - .../Interfaces/Services/IGarageService.cs | 11 - .../Services/ILineAddressService.cs | 11 - .../Services/ILineTariffAuditService.cs | 11 - .../Interfaces/Services/ILineTariffService.cs | 11 - .../Interfaces/Services/IStopService.cs | 11 - .../Interfaces/Services/IStopTimeService.cs | 11 - .../Services/IUserTypeFeatureService.cs | 11 - .../Interfaces/Services/IUserTypeService.cs | 10 - .../Services/IVehicleGarageService.cs | 11 - OneBus.Application/Services/AddressService.cs | 26 -- .../Services/BusAuditService.cs | 26 -- OneBus.Application/Services/CompanyService.cs | 26 -- OneBus.Application/Services/EmailService.cs | 141 ---------- .../Services/EmployeeGarageService.cs | 26 -- OneBus.Application/Services/FeatureService.cs | 15 - OneBus.Application/Services/GarageService.cs | 26 -- .../Services/LineAddressService.cs | 26 -- .../Services/LineTariffAuditService.cs | 26 -- .../Services/LineTariffService.cs | 26 -- OneBus.Application/Services/StopService.cs | 26 -- .../Services/StopTimeService.cs | 26 -- .../Services/UserTypeFeatureService.cs | 31 -- .../Services/UserTypeService.cs | 26 -- .../Services/VehicleGarageService.cs | 26 -- .../Address/CreateAddressDTOValidator.cs | 9 - .../Address/UpdateAddressDTOValidator.cs | 9 - .../BusAudit/CreateBusAuditDTOValidator.cs | 9 - .../BusAudit/UpdateBusAuditDTOValidator.cs | 9 - .../Company/CreateCompanyDTOValidator.cs | 9 - .../Company/UpdateCompanyDTOValidator.cs | 9 - .../Validators/Email/EmailValidator.cs | 13 - .../CreateEmployeeGarageDTOValidator.cs | 9 - .../UpdateEmployeeGarageDTOValidator.cs | 9 - .../Garage/CreateGarageDTOValidator.cs | 9 - .../Garage/UpdateGarageDTOValidator.cs | 9 - .../CreateLineAddressDTOValidator.cs | 9 - .../UpdateLineAddressDTOValidator.cs | 9 - .../CreateLineTariffDTOValidator.cs | 9 - .../UpdateLineTariffDTOValidator.cs | 9 - .../CreateLineTariffAuditDTOValidator.cs | 9 - .../UpdateLineTariffAuditDTOValidator.cs | 9 - .../Validators/Stop/CreateStopDTOValidator.cs | 9 - .../Validators/Stop/UpdateStopDTOValidator.cs | 9 - .../StopTime/CreateStopTimeDTOValidator.cs | 9 - .../StopTime/UpdateStopTimeDTOValidator.cs | 9 - .../UserType/CreateUserTypeDTOValidator.cs | 9 - .../UserType/UpdateUserTypeDTOValidator.cs | 9 - .../CreateUserTypeFeatureDTOValidator.cs | 9 - .../UpdateUserTypeFeatureDTOValidator.cs | 9 - .../CreateVehicleGarageDTOValidator.cs | 9 - .../UpdateVehicleGarageDTOValidator.cs | 9 - OneBus.Domain/Constants/FeaturesCode.cs | 7 - OneBus.Domain/Constants/PolicyConstants.cs | 7 - OneBus.Domain/Entities/Address.cs | 37 --- OneBus.Domain/Entities/BusAudit.cs | 26 -- OneBus.Domain/Entities/Company.cs | 36 --- OneBus.Domain/Entities/EmployeeGarage.cs | 16 -- OneBus.Domain/Entities/Entities.cd | 265 ------------------ OneBus.Domain/Entities/Feature.cs | 19 -- OneBus.Domain/Entities/Garage.cs | 32 --- OneBus.Domain/Entities/LineAddress.cs | 21 -- OneBus.Domain/Entities/LineTariff.cs | 18 -- OneBus.Domain/Entities/LineTariffAudit.cs | 20 -- OneBus.Domain/Entities/Stop.cs | 24 -- OneBus.Domain/Entities/StopTime.cs | 22 -- OneBus.Domain/Entities/UserType.cs | 23 -- OneBus.Domain/Entities/UserTypeFeature.cs | 18 -- OneBus.Domain/Entities/VehicleGarage.cs | 16 -- OneBus.Domain/Enums/Address/AreaType.cs | 15 - .../Enums/LineAddress/DirectionLine.cs | 9 - OneBus.Domain/Enums/StopTime/DayType.cs | 10 - OneBus.Domain/Filters/AddressFilter.cs | 9 - .../Repositories/IAddressRepository.cs | 9 - .../Repositories/IBusAuditRepository.cs | 9 - .../Repositories/ICompanyRepository.cs | 9 - .../Repositories/IEmployeeGarageRepository.cs | 9 - .../Repositories/IFeatureRepository.cs | 9 - .../Repositories/IGarageRepository.cs | 9 - .../Repositories/ILineAddressRepository.cs | 9 - .../ILineTariffAuditRepository.cs | 9 - .../Repositories/ILineTariffRepository.cs | 9 - .../Repositories/IStopRepository.cs | 9 - .../Repositories/IStopTimeRepository.cs | 9 - .../IUserTypeFeatureRepository.cs | 9 - .../Repositories/IUserTypeRepository.cs | 9 - .../Repositories/IVehicleGarageRepository.cs | 9 - OneBus.Domain/Models/EmailModel.cs | 40 --- OneBus.Domain/Settings/EmailSettings.cs | 25 -- .../Extensions/PredicateExtensions.cs | 13 - OneBus.Infra.Data/Mappings/AddressMapping.cs | 24 -- OneBus.Infra.Data/Mappings/BusAuditMapping.cs | 33 --- OneBus.Infra.Data/Mappings/CompanyMapping.cs | 30 -- .../Mappings/EmployeeGarageMapping.cs | 28 -- OneBus.Infra.Data/Mappings/FeatureMapping.cs | 21 -- OneBus.Infra.Data/Mappings/GarageMapping.cs | 31 -- .../Mappings/LineAddressMapping.cs | 29 -- .../Mappings/LineTariffAuditMapping.cs | 25 -- .../Mappings/LineTariffMapping.cs | 24 -- OneBus.Infra.Data/Mappings/StopMapping.cs | 25 -- OneBus.Infra.Data/Mappings/StopTimeMapping.cs | 24 -- .../Mappings/UserTypeFeatureMapping.cs | 29 -- OneBus.Infra.Data/Mappings/UserTypeMapping.cs | 23 -- .../Mappings/VehicleGarageMapping.cs | 28 -- .../Repositories/AddressRepository.cs | 20 -- .../Repositories/BusAuditRepository.cs | 14 - .../Repositories/CompanyRepository.cs | 14 - .../Repositories/EmployeeGarageRepository.cs | 14 - .../Repositories/FeatureRepository.cs | 14 - .../Repositories/GarageRepository.cs | 14 - .../Repositories/LineAddressRepository.cs | 14 - .../Repositories/LineTariffAuditRepository.cs | 14 - .../Repositories/LineTariffRepository.cs | 14 - .../Repositories/StopRepository.cs | 14 - .../Repositories/StopTimeRepository.cs | 14 - .../Repositories/UserTypeFeatureRepository.cs | 14 - .../Repositories/UserTypeRepository.cs | 14 - .../Repositories/VehicleGarageRepository.cs | 14 - 179 files changed, 4175 deletions(-) delete mode 100644 OneBus.API/Authorizations/FeatureHandler.cs delete mode 100644 OneBus.API/Authorizations/FeatureRequirement.cs delete mode 100644 OneBus.API/Controllers/AddressController.cs delete mode 100644 OneBus.API/Controllers/BusAuditController.cs delete mode 100644 OneBus.API/Controllers/CompanyController.cs delete mode 100644 OneBus.API/Controllers/EmployeeGarageController.cs delete mode 100644 OneBus.API/Controllers/FeatureController.cs delete mode 100644 OneBus.API/Controllers/GarageController.cs delete mode 100644 OneBus.API/Controllers/LineAddressController.cs delete mode 100644 OneBus.API/Controllers/LineTariffAuditController.cs delete mode 100644 OneBus.API/Controllers/LineTariffController.cs delete mode 100644 OneBus.API/Controllers/StopController.cs delete mode 100644 OneBus.API/Controllers/StopTimeController.cs delete mode 100644 OneBus.API/Controllers/UserTypeController.cs delete mode 100644 OneBus.API/Controllers/UserTypeFeatureController.cs delete mode 100644 OneBus.API/Controllers/VehicleGarageController.cs delete mode 100644 OneBus.Application/DTOs/Address/CreateAddressDTO.cs delete mode 100644 OneBus.Application/DTOs/Address/ReadAddressDTO.cs delete mode 100644 OneBus.Application/DTOs/Address/UpdateAddressDTO.cs delete mode 100644 OneBus.Application/DTOs/BusAudit/CreateBusAuditDTO.cs delete mode 100644 OneBus.Application/DTOs/BusAudit/ReadBusAuditDTO.cs delete mode 100644 OneBus.Application/DTOs/BusAudit/UpdateBusAuditDTO.cs delete mode 100644 OneBus.Application/DTOs/Company/CreateCompanyDTO.cs delete mode 100644 OneBus.Application/DTOs/Company/ReadCompanyDTO.cs delete mode 100644 OneBus.Application/DTOs/Company/UpdateCompanyDTO.cs delete mode 100644 OneBus.Application/DTOs/EmployeeGarage/CreateEmployeeGarageDTO.cs delete mode 100644 OneBus.Application/DTOs/EmployeeGarage/ReadEmployeeGarageDTO.cs delete mode 100644 OneBus.Application/DTOs/EmployeeGarage/UpdateEmployeeGarageDTO.cs delete mode 100644 OneBus.Application/DTOs/Feature/ReadFeatureDTO.cs delete mode 100644 OneBus.Application/DTOs/Garage/CreateGarageDTO.cs delete mode 100644 OneBus.Application/DTOs/Garage/ReadGarageDTO.cs delete mode 100644 OneBus.Application/DTOs/Garage/UpdateGarageDTO.cs delete mode 100644 OneBus.Application/DTOs/LineAddress/CreateLineAddressDTO.cs delete mode 100644 OneBus.Application/DTOs/LineAddress/ReadLineAddressDTO.cs delete mode 100644 OneBus.Application/DTOs/LineAddress/UpdateLineAddressDTO.cs delete mode 100644 OneBus.Application/DTOs/LineTariff/CreateLineTariffDTO.cs delete mode 100644 OneBus.Application/DTOs/LineTariff/ReadLineTariffDTO.cs delete mode 100644 OneBus.Application/DTOs/LineTariff/UpdateLineTariffDTO.cs delete mode 100644 OneBus.Application/DTOs/LineTariffAudit/CreateLineTariffAuditDTO.cs delete mode 100644 OneBus.Application/DTOs/LineTariffAudit/ReadLineTariffAuditDTO.cs delete mode 100644 OneBus.Application/DTOs/LineTariffAudit/UpdateLineTariffAuditDTO.cs delete mode 100644 OneBus.Application/DTOs/Stop/CreateStopDTO.cs delete mode 100644 OneBus.Application/DTOs/Stop/ReadStopDTO.cs delete mode 100644 OneBus.Application/DTOs/Stop/UpdateStopDTO.cs delete mode 100644 OneBus.Application/DTOs/StopTime/CreateStopTimeDTO.cs delete mode 100644 OneBus.Application/DTOs/StopTime/ReadStopTimeDTO.cs delete mode 100644 OneBus.Application/DTOs/StopTime/UpdateStopTimeDTO.cs delete mode 100644 OneBus.Application/DTOs/UserType/CreateUserTypeDTO.cs delete mode 100644 OneBus.Application/DTOs/UserType/ReadUserTypeDTO.cs delete mode 100644 OneBus.Application/DTOs/UserType/UpdateUserTypeDTO.cs delete mode 100644 OneBus.Application/DTOs/UserTypeFeature/CreateUserTypeFeatureDTO.cs delete mode 100644 OneBus.Application/DTOs/UserTypeFeature/ReadUserTypeFeatureDTO.cs delete mode 100644 OneBus.Application/DTOs/UserTypeFeature/UpdateUserTypeFeatureDTO.cs delete mode 100644 OneBus.Application/DTOs/VehicleGarage/CreateVehicleGarageDTO.cs delete mode 100644 OneBus.Application/DTOs/VehicleGarage/ReadVehicleGarageDTO.cs delete mode 100644 OneBus.Application/DTOs/VehicleGarage/UpdateVehicleGarageDTO.cs delete mode 100644 OneBus.Application/Interfaces/Services/IAddressService.cs delete mode 100644 OneBus.Application/Interfaces/Services/IBusAuditService.cs delete mode 100644 OneBus.Application/Interfaces/Services/ICompanyService.cs delete mode 100644 OneBus.Application/Interfaces/Services/IEmailService.cs delete mode 100644 OneBus.Application/Interfaces/Services/IEmployeeGarageService.cs delete mode 100644 OneBus.Application/Interfaces/Services/IFeatureService.cs delete mode 100644 OneBus.Application/Interfaces/Services/IGarageService.cs delete mode 100644 OneBus.Application/Interfaces/Services/ILineAddressService.cs delete mode 100644 OneBus.Application/Interfaces/Services/ILineTariffAuditService.cs delete mode 100644 OneBus.Application/Interfaces/Services/ILineTariffService.cs delete mode 100644 OneBus.Application/Interfaces/Services/IStopService.cs delete mode 100644 OneBus.Application/Interfaces/Services/IStopTimeService.cs delete mode 100644 OneBus.Application/Interfaces/Services/IUserTypeFeatureService.cs delete mode 100644 OneBus.Application/Interfaces/Services/IUserTypeService.cs delete mode 100644 OneBus.Application/Interfaces/Services/IVehicleGarageService.cs delete mode 100644 OneBus.Application/Services/AddressService.cs delete mode 100644 OneBus.Application/Services/BusAuditService.cs delete mode 100644 OneBus.Application/Services/CompanyService.cs delete mode 100644 OneBus.Application/Services/EmailService.cs delete mode 100644 OneBus.Application/Services/EmployeeGarageService.cs delete mode 100644 OneBus.Application/Services/FeatureService.cs delete mode 100644 OneBus.Application/Services/GarageService.cs delete mode 100644 OneBus.Application/Services/LineAddressService.cs delete mode 100644 OneBus.Application/Services/LineTariffAuditService.cs delete mode 100644 OneBus.Application/Services/LineTariffService.cs delete mode 100644 OneBus.Application/Services/StopService.cs delete mode 100644 OneBus.Application/Services/StopTimeService.cs delete mode 100644 OneBus.Application/Services/UserTypeFeatureService.cs delete mode 100644 OneBus.Application/Services/UserTypeService.cs delete mode 100644 OneBus.Application/Services/VehicleGarageService.cs delete mode 100644 OneBus.Application/Validators/Address/CreateAddressDTOValidator.cs delete mode 100644 OneBus.Application/Validators/Address/UpdateAddressDTOValidator.cs delete mode 100644 OneBus.Application/Validators/BusAudit/CreateBusAuditDTOValidator.cs delete mode 100644 OneBus.Application/Validators/BusAudit/UpdateBusAuditDTOValidator.cs delete mode 100644 OneBus.Application/Validators/Company/CreateCompanyDTOValidator.cs delete mode 100644 OneBus.Application/Validators/Company/UpdateCompanyDTOValidator.cs delete mode 100644 OneBus.Application/Validators/Email/EmailValidator.cs delete mode 100644 OneBus.Application/Validators/EmployeeGarage/CreateEmployeeGarageDTOValidator.cs delete mode 100644 OneBus.Application/Validators/EmployeeGarage/UpdateEmployeeGarageDTOValidator.cs delete mode 100644 OneBus.Application/Validators/Garage/CreateGarageDTOValidator.cs delete mode 100644 OneBus.Application/Validators/Garage/UpdateGarageDTOValidator.cs delete mode 100644 OneBus.Application/Validators/LineAddress/CreateLineAddressDTOValidator.cs delete mode 100644 OneBus.Application/Validators/LineAddress/UpdateLineAddressDTOValidator.cs delete mode 100644 OneBus.Application/Validators/LineTariff/CreateLineTariffDTOValidator.cs delete mode 100644 OneBus.Application/Validators/LineTariff/UpdateLineTariffDTOValidator.cs delete mode 100644 OneBus.Application/Validators/LineTariffAudit/CreateLineTariffAuditDTOValidator.cs delete mode 100644 OneBus.Application/Validators/LineTariffAudit/UpdateLineTariffAuditDTOValidator.cs delete mode 100644 OneBus.Application/Validators/Stop/CreateStopDTOValidator.cs delete mode 100644 OneBus.Application/Validators/Stop/UpdateStopDTOValidator.cs delete mode 100644 OneBus.Application/Validators/StopTime/CreateStopTimeDTOValidator.cs delete mode 100644 OneBus.Application/Validators/StopTime/UpdateStopTimeDTOValidator.cs delete mode 100644 OneBus.Application/Validators/UserType/CreateUserTypeDTOValidator.cs delete mode 100644 OneBus.Application/Validators/UserType/UpdateUserTypeDTOValidator.cs delete mode 100644 OneBus.Application/Validators/UserTypeFeature/CreateUserTypeFeatureDTOValidator.cs delete mode 100644 OneBus.Application/Validators/UserTypeFeature/UpdateUserTypeFeatureDTOValidator.cs delete mode 100644 OneBus.Application/Validators/VehicleGarage/CreateVehicleGarageDTOValidator.cs delete mode 100644 OneBus.Application/Validators/VehicleGarage/UpdateVehicleGarageDTOValidator.cs delete mode 100644 OneBus.Domain/Constants/FeaturesCode.cs delete mode 100644 OneBus.Domain/Constants/PolicyConstants.cs delete mode 100644 OneBus.Domain/Entities/Address.cs delete mode 100644 OneBus.Domain/Entities/BusAudit.cs delete mode 100644 OneBus.Domain/Entities/Company.cs delete mode 100644 OneBus.Domain/Entities/EmployeeGarage.cs delete mode 100644 OneBus.Domain/Entities/Entities.cd delete mode 100644 OneBus.Domain/Entities/Feature.cs delete mode 100644 OneBus.Domain/Entities/Garage.cs delete mode 100644 OneBus.Domain/Entities/LineAddress.cs delete mode 100644 OneBus.Domain/Entities/LineTariff.cs delete mode 100644 OneBus.Domain/Entities/LineTariffAudit.cs delete mode 100644 OneBus.Domain/Entities/Stop.cs delete mode 100644 OneBus.Domain/Entities/StopTime.cs delete mode 100644 OneBus.Domain/Entities/UserType.cs delete mode 100644 OneBus.Domain/Entities/UserTypeFeature.cs delete mode 100644 OneBus.Domain/Entities/VehicleGarage.cs delete mode 100644 OneBus.Domain/Enums/Address/AreaType.cs delete mode 100644 OneBus.Domain/Enums/LineAddress/DirectionLine.cs delete mode 100644 OneBus.Domain/Enums/StopTime/DayType.cs delete mode 100644 OneBus.Domain/Filters/AddressFilter.cs delete mode 100644 OneBus.Domain/Interfaces/Repositories/IAddressRepository.cs delete mode 100644 OneBus.Domain/Interfaces/Repositories/IBusAuditRepository.cs delete mode 100644 OneBus.Domain/Interfaces/Repositories/ICompanyRepository.cs delete mode 100644 OneBus.Domain/Interfaces/Repositories/IEmployeeGarageRepository.cs delete mode 100644 OneBus.Domain/Interfaces/Repositories/IFeatureRepository.cs delete mode 100644 OneBus.Domain/Interfaces/Repositories/IGarageRepository.cs delete mode 100644 OneBus.Domain/Interfaces/Repositories/ILineAddressRepository.cs delete mode 100644 OneBus.Domain/Interfaces/Repositories/ILineTariffAuditRepository.cs delete mode 100644 OneBus.Domain/Interfaces/Repositories/ILineTariffRepository.cs delete mode 100644 OneBus.Domain/Interfaces/Repositories/IStopRepository.cs delete mode 100644 OneBus.Domain/Interfaces/Repositories/IStopTimeRepository.cs delete mode 100644 OneBus.Domain/Interfaces/Repositories/IUserTypeFeatureRepository.cs delete mode 100644 OneBus.Domain/Interfaces/Repositories/IUserTypeRepository.cs delete mode 100644 OneBus.Domain/Interfaces/Repositories/IVehicleGarageRepository.cs delete mode 100644 OneBus.Domain/Models/EmailModel.cs delete mode 100644 OneBus.Domain/Settings/EmailSettings.cs delete mode 100644 OneBus.Infra.Data/Extensions/PredicateExtensions.cs delete mode 100644 OneBus.Infra.Data/Mappings/AddressMapping.cs delete mode 100644 OneBus.Infra.Data/Mappings/BusAuditMapping.cs delete mode 100644 OneBus.Infra.Data/Mappings/CompanyMapping.cs delete mode 100644 OneBus.Infra.Data/Mappings/EmployeeGarageMapping.cs delete mode 100644 OneBus.Infra.Data/Mappings/FeatureMapping.cs delete mode 100644 OneBus.Infra.Data/Mappings/GarageMapping.cs delete mode 100644 OneBus.Infra.Data/Mappings/LineAddressMapping.cs delete mode 100644 OneBus.Infra.Data/Mappings/LineTariffAuditMapping.cs delete mode 100644 OneBus.Infra.Data/Mappings/LineTariffMapping.cs delete mode 100644 OneBus.Infra.Data/Mappings/StopMapping.cs delete mode 100644 OneBus.Infra.Data/Mappings/StopTimeMapping.cs delete mode 100644 OneBus.Infra.Data/Mappings/UserTypeFeatureMapping.cs delete mode 100644 OneBus.Infra.Data/Mappings/UserTypeMapping.cs delete mode 100644 OneBus.Infra.Data/Mappings/VehicleGarageMapping.cs delete mode 100644 OneBus.Infra.Data/Repositories/AddressRepository.cs delete mode 100644 OneBus.Infra.Data/Repositories/BusAuditRepository.cs delete mode 100644 OneBus.Infra.Data/Repositories/CompanyRepository.cs delete mode 100644 OneBus.Infra.Data/Repositories/EmployeeGarageRepository.cs delete mode 100644 OneBus.Infra.Data/Repositories/FeatureRepository.cs delete mode 100644 OneBus.Infra.Data/Repositories/GarageRepository.cs delete mode 100644 OneBus.Infra.Data/Repositories/LineAddressRepository.cs delete mode 100644 OneBus.Infra.Data/Repositories/LineTariffAuditRepository.cs delete mode 100644 OneBus.Infra.Data/Repositories/LineTariffRepository.cs delete mode 100644 OneBus.Infra.Data/Repositories/StopRepository.cs delete mode 100644 OneBus.Infra.Data/Repositories/StopTimeRepository.cs delete mode 100644 OneBus.Infra.Data/Repositories/UserTypeFeatureRepository.cs delete mode 100644 OneBus.Infra.Data/Repositories/UserTypeRepository.cs delete mode 100644 OneBus.Infra.Data/Repositories/VehicleGarageRepository.cs diff --git a/OneBus.API/Authorizations/FeatureHandler.cs b/OneBus.API/Authorizations/FeatureHandler.cs deleted file mode 100644 index d660e1e..0000000 --- a/OneBus.API/Authorizations/FeatureHandler.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using OneBus.Application.Interfaces.Services; -using System.Security.Claims; - -namespace OneBus.API.Authorizations -{ - public class FeatureHandler : AuthorizationHandler - { - private readonly IUserTypeFeatureService _userTypeFeatureService; - - public FeatureHandler(IUserTypeFeatureService userTypeFeatureService) - { - _userTypeFeatureService = userTypeFeatureService; - } - - protected override async Task HandleRequirementAsync( - AuthorizationHandlerContext context, - FeatureRequirement requirement) - { - var success = ulong.TryParse(context.User.FindFirst(ClaimTypes.NameIdentifier)?.Value, out ulong userId); - - if (success && await _userTypeFeatureService.HasPermissionAsync(userId, requirement.FeatureCode)) - { - context.Succeed(requirement); - } - } - } -} diff --git a/OneBus.API/Authorizations/FeatureRequirement.cs b/OneBus.API/Authorizations/FeatureRequirement.cs deleted file mode 100644 index dba41c6..0000000 --- a/OneBus.API/Authorizations/FeatureRequirement.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Microsoft.AspNetCore.Authorization; - -namespace OneBus.API.Authorizations -{ - public class FeatureRequirement : IAuthorizationRequirement - { - public FeatureRequirement(byte featureCode) - { - FeatureCode = featureCode; - } - - public byte FeatureCode { get; } - } -} diff --git a/OneBus.API/Controllers/AddressController.cs b/OneBus.API/Controllers/AddressController.cs deleted file mode 100644 index 1cdc048..0000000 --- a/OneBus.API/Controllers/AddressController.cs +++ /dev/null @@ -1,114 +0,0 @@ -using OneBus.Domain.Commons; -using OneBus.Domain.Filters; -using OneBus.Domain.Entities; -using Microsoft.AspNetCore.Mvc; -using OneBus.Domain.Commons.Result; -using OneBus.Application.DTOs.Address; -using Swashbuckle.AspNetCore.Annotations; -using OneBus.Application.Interfaces.Services; - -namespace OneBus.API.Controllers -{ - [SwaggerTag("Controlador responsável por gerenciar Endereços")] - public class AddressController : BaseController - { - public AddressController( - IBaseService baseService) - : base(baseService) - { - } - - /// - /// Cadastrar novo endereço - /// - /// - /// POST de Endereço - /// - /// Campos para cadastrar endereço - /// - /// Endereço cadastrado - /// Endereço cadastrado com sucesso - /// Validação encontrou erros - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateAddressDTO createDTO, CancellationToken cancellationToken = default) - { - return base.CreateAsync(createDTO, cancellationToken); - } - - /// - /// Atualizar endereço - /// - /// - /// PUT de Endereço - /// - /// Id do endereço - /// Campos para atualizar endereço - /// - /// Endereço atualizado - /// Endereço atualizado com sucesso - /// Validação encontrou erros - /// Endereço não encontrado - /// Conflito entre ids - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateAddressDTO updateDTO, CancellationToken cancellationToken = default) - { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Deletar endereço - /// - /// - /// DELETE de Endereço - /// - /// Id do endereço - /// - /// Endereço deletado - /// Endereço deletado com sucesso - /// Endereço não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.DeleteAsync(id, cancellationToken); - } - - /// - /// Obter endereços paginados e filtrados - /// - /// - /// GET de Endereços - /// - /// Filtros para aplicar - /// - /// Endereços paginados e filtrados - /// Endereços paginados e filtrados com sucesso - [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] AddressFilter filter, CancellationToken cancellationToken = default) - { - return base.GetPaginedAsync(filter, cancellationToken); - } - - /// - /// Obter endereço por id - /// - /// - /// GET pelo id de endereço - /// - /// Id do endereço - /// - /// Endereço encontrado - /// Endereço encontrado com sucesso - /// Endereço não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.GetByIdAsync(id, cancellationToken); - } - } -} diff --git a/OneBus.API/Controllers/BusAuditController.cs b/OneBus.API/Controllers/BusAuditController.cs deleted file mode 100644 index 7383ea3..0000000 --- a/OneBus.API/Controllers/BusAuditController.cs +++ /dev/null @@ -1,114 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using OneBus.Application.DTOs.BusAudit; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Commons; -using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using Swashbuckle.AspNetCore.Annotations; - -namespace OneBus.API.Controllers -{ - [SwaggerTag("Controlador responsável por gerenciar Auditorias de Ônibus")] - public class BusAuditController : BaseController - { - public BusAuditController( - IBaseService baseService) - : base(baseService) - { - } - - /// - /// Cadastrar nova auditoria de ônibus - /// - /// - /// POST de Auditoria de Ônibus - /// - /// Campos para cadastrar auditoria de ônibus - /// - /// Auditoria de Ônibus cadastrada - /// Auditoria de Ônibus cadastrada com sucesso - /// Validação encontrou erros - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateBusAuditDTO createDTO, CancellationToken cancellationToken = default) - { - return base.CreateAsync(createDTO, cancellationToken); - } - - /// - /// Atualizar auditoria de ônibus - /// - /// - /// PUT de Auditoria de Ônibus - /// - /// Id da auditoria de ônibus - /// Campos para atualizar auditoria de ônibus - /// - /// Auditoria de Ônibus atualizada - /// Auditoria de Ônibus atualizada com sucesso - /// Validação encontrou erros - /// Auditoria de Ônibus não encontrada - /// Conflito entre ids - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateBusAuditDTO updateDTO, CancellationToken cancellationToken = default) - { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Deletar auditoria de ônibus - /// - /// - /// DELETE de Auditoria de Ônibus - /// - /// Id da auditoria de ônibus - /// - /// Auditoria de Ônibus deletada - /// Auditoria de Ônibus deletada com sucesso - /// Auditoria de Ônibus não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.DeleteAsync(id, cancellationToken); - } - - /// - /// Obter auditorias de ônibus paginadas e filtradas - /// - /// - /// GET de Auditorias de Ônibus - /// - /// Filtros para aplicar - /// - /// Auditorias de Ônibus paginadas e filtradas - /// Auditorias de Ônibus paginadas e filtradas com sucesso - [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) - { - return base.GetPaginedAsync(filter, cancellationToken); - } - - /// - /// Obter auditoria de ônibus por id - /// - /// - /// GET pelo id da auditoria de ônibus - /// - /// Id da auditoria de ônibus - /// - /// Auditoria de Ônibus encontrada - /// Auditoria de Ônibus encontrada com sucesso - /// Auditoria de Ônibus não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.GetByIdAsync(id, cancellationToken); - } - } -} diff --git a/OneBus.API/Controllers/CompanyController.cs b/OneBus.API/Controllers/CompanyController.cs deleted file mode 100644 index d24af48..0000000 --- a/OneBus.API/Controllers/CompanyController.cs +++ /dev/null @@ -1,118 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.RateLimiting; -using OneBus.Application.DTOs.Company; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Commons; -using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using Swashbuckle.AspNetCore.Annotations; - -namespace OneBus.API.Controllers -{ - [SwaggerTag("Controlador responsável por gerenciar Empresas")] - public class CompanyController : BaseController - { - public CompanyController( - IBaseService baseService) - : base(baseService) - { - } - - /// - /// Cadastrar nova empresa - /// - /// - /// POST de Empresa - /// - /// Campos para cadastrar empresa - /// - /// Empresa cadastrada - /// Empresa cadastrada com sucesso - /// Validação encontrou erros - [AllowAnonymous] - [EnableRateLimiting("create_company")] - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateCompanyDTO createDTO, CancellationToken cancellationToken = default) - { - return base.CreateAsync(createDTO, cancellationToken); - } - - /// - /// Atualizar empresa - /// - /// - /// PUT de Empresa - /// - /// Id da empresa - /// Campos para atualizar empresa - /// - /// Empresa atualizada - /// Empresa atualizada com sucesso - /// Validação encontrou erros - /// Empresa não encontrada - /// Conflito entre ids - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateCompanyDTO updateDTO, CancellationToken cancellationToken = default) - { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Deletar empresa - /// - /// - /// DELETE de Empresa - /// - /// Id da empresa - /// - /// Empresa deletada - /// Empresa deletada com sucesso - /// Empresa não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.DeleteAsync(id, cancellationToken); - } - - /// - /// Obter empresas paginadas e filtradas - /// - /// - /// GET de Empresas - /// - /// Filtros para aplicar - /// - /// Empresas paginadas e filtradas - /// Empresas paginadas e filtradas com sucesso - [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) - { - return base.GetPaginedAsync(filter, cancellationToken); - } - - /// - /// Obter empresa por id - /// - /// - /// GET pelo id da empresa - /// - /// Id da empresa - /// - /// Empresa encontrada - /// Empresa encontrada com sucesso - /// Empresa não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.GetByIdAsync(id, cancellationToken); - } - } -} diff --git a/OneBus.API/Controllers/EmployeeGarageController.cs b/OneBus.API/Controllers/EmployeeGarageController.cs deleted file mode 100644 index 4d7ff2c..0000000 --- a/OneBus.API/Controllers/EmployeeGarageController.cs +++ /dev/null @@ -1,114 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using OneBus.Application.DTOs.EmployeeGarage; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Commons; -using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using Swashbuckle.AspNetCore.Annotations; - -namespace OneBus.API.Controllers -{ - [SwaggerTag("Controlador responsável por gerenciar Garagens dos Funcionários")] - public class EmployeeGarageController : BaseController - { - public EmployeeGarageController( - IBaseService baseService) - : base(baseService) - { - } - - /// - /// Cadastrar nova garagem do funcionário - /// - /// - /// POST de Garagem do Funcionário - /// - /// Campos para cadastrar garagem do funcionário - /// - /// Garagem do Funcionário cadastrada - /// Garagem do Funcionário cadastrada com sucesso - /// Validação encontrou erros - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateEmployeeGarageDTO createDTO, CancellationToken cancellationToken = default) - { - return base.CreateAsync(createDTO, cancellationToken); - } - - /// - /// Atualizar garagem do funcionário - /// - /// - /// PUT de Garagem do Funcionário - /// - /// Id da garagem do funcionário - /// Campos para atualizar garagem do funcionário - /// - /// Garagem do Funcionário atualizada - /// Garagem do Funcionário atualizada com sucesso - /// Validação encontrou erros - /// Garagem do Funcionário não encontrada - /// Conflito entre ids - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateEmployeeGarageDTO updateDTO, CancellationToken cancellationToken = default) - { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Deletar garagem do funcionário - /// - /// - /// DELETE de Garagem do Funcionário - /// - /// Id da garagem do funcionário - /// - /// Garagem do Funcionário deletada - /// Garagem do Funcionário deletada com sucesso - /// Garagem do Funcionário não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.DeleteAsync(id, cancellationToken); - } - - /// - /// Obter garagens dos funcionários paginadas e filtradas - /// - /// - /// GET de Garagens dos Funcionários - /// - /// Filtros para aplicar - /// - /// Garagens dos Funcionários paginadas e filtradas - /// Garagens dos Funcionários paginadas e filtradas com sucesso - [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) - { - return base.GetPaginedAsync(filter, cancellationToken); - } - - /// - /// Obter garagem do funcionário por id - /// - /// - /// GET pelo id da garagem do funcionário - /// - /// Id da garagem do funcionário - /// - /// Garagem do Funcionário encontrada - /// Garagem do Funcionário encontrada com sucesso - /// Garagem do Funcionário não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.GetByIdAsync(id, cancellationToken); - } - } -} diff --git a/OneBus.API/Controllers/FeatureController.cs b/OneBus.API/Controllers/FeatureController.cs deleted file mode 100644 index d57c50e..0000000 --- a/OneBus.API/Controllers/FeatureController.cs +++ /dev/null @@ -1,54 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using OneBus.Application.DTOs.Feature; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Commons.Result; -using OneBus.Domain.Commons; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using Swashbuckle.AspNetCore.Annotations; - -namespace OneBus.API.Controllers -{ - [SwaggerTag("Controlador responsável por gerenciar Funcionalidades")] - public class FeatureController : BaseReadOnlyController - { - public FeatureController(IBaseReadOnlyService baseReadOnlyService) - : base(baseReadOnlyService) - { - } - - /// - /// Obter funcionalidades paginadas e filtradas - /// - /// - /// GET de Funcionalidades - /// - /// Filtros para aplicar - /// - /// Funcionalidades paginadas e filtradas - /// Funcionalidades paginadas e filtradas com sucesso - [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) - { - return base.GetPaginedAsync(filter, cancellationToken); - } - - /// - /// Obter funcionalidade por id - /// - /// - /// GET pelo id da funcionalidade - /// - /// Id da funcionalidade - /// - /// Funcionalidade encontrada - /// Funcionalidade encontrada com sucesso - /// Funcionalidade não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.GetByIdAsync(id, cancellationToken); - } - } -} diff --git a/OneBus.API/Controllers/GarageController.cs b/OneBus.API/Controllers/GarageController.cs deleted file mode 100644 index dab359c..0000000 --- a/OneBus.API/Controllers/GarageController.cs +++ /dev/null @@ -1,114 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using OneBus.Application.DTOs.Garage; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Commons; -using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using Swashbuckle.AspNetCore.Annotations; - -namespace OneBus.API.Controllers -{ - [SwaggerTag("Controlador responsável por gerenciar Garagens")] - public class GarageController : BaseController - { - public GarageController( - IBaseService baseService) - : base(baseService) - { - } - - /// - /// Cadastrar nova garagem - /// - /// - /// POST de Garagem - /// - /// Campos para cadastrar garagem - /// - /// Garagem cadastrada - /// Garagem cadastrada com sucesso - /// Validação encontrou erros - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateGarageDTO createDTO, CancellationToken cancellationToken = default) - { - return base.CreateAsync(createDTO, cancellationToken); - } - - /// - /// Atualizar garagem - /// - /// - /// PUT de Garagem - /// - /// Id da garagem - /// Campos para atualizar garagem - /// - /// Garagem atualizada - /// Garagem atualizada com sucesso - /// Validação encontrou erros - /// Garagem não encontrada - /// Conflito entre ids - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateGarageDTO updateDTO, CancellationToken cancellationToken = default) - { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Deletar garagem - /// - /// - /// DELETE de Garagem - /// - /// Id da garagem - /// - /// Garagem deletada - /// Garagem deletada com sucesso - /// Garagem não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.DeleteAsync(id, cancellationToken); - } - - /// - /// Obter garagens paginadas e filtradas - /// - /// - /// GET de Garagens - /// - /// Filtros para aplicar - /// - /// Garagens paginadas e filtradas - /// Garagens paginadas e filtradas com sucesso - [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) - { - return base.GetPaginedAsync(filter, cancellationToken); - } - - /// - /// Obter garagem por id - /// - /// - /// GET pelo id da garagem - /// - /// Id da garagem - /// - /// Garagem encontrada - /// Garagem encontrada com sucesso - /// Garagem não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.GetByIdAsync(id, cancellationToken); - } - } -} diff --git a/OneBus.API/Controllers/LineAddressController.cs b/OneBus.API/Controllers/LineAddressController.cs deleted file mode 100644 index 40c962f..0000000 --- a/OneBus.API/Controllers/LineAddressController.cs +++ /dev/null @@ -1,114 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using OneBus.Application.DTOs.LineAddress; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Commons; -using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using Swashbuckle.AspNetCore.Annotations; - -namespace OneBus.API.Controllers -{ - [SwaggerTag("Controlador responsável por gerenciar Endereços da Linha")] - public class LineAddressController : BaseController - { - public LineAddressController( - IBaseService baseService) - : base(baseService) - { - } - - /// - /// Cadastrar novo endereço de linha - /// - /// - /// POST de Endereço Linha - /// - /// Campos para cadastrar endereço de linha - /// - /// Endereço de Linha cadastrado - /// Endereço de Linha cadastrado com sucesso - /// Validação encontrou erros - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateLineAddressDTO createDTO, CancellationToken cancellationToken = default) - { - return base.CreateAsync(createDTO, cancellationToken); - } - - /// - /// Atualizar endereço de linha - /// - /// - /// PUT de Endereço Linha - /// - /// Id de endereço de linha - /// Campos para atualizar endereço de linha - /// - /// Endereço de Linha atualizado - /// Endereço de Linha atualizado com sucesso - /// Validação encontrou erros - /// Endereço de Linha não encontrado - /// Conflito entre ids - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateLineAddressDTO updateDTO, CancellationToken cancellationToken = default) - { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Deletar endereço de linha - /// - /// - /// DELETE de Endereço Linha - /// - /// Id de endereço de linha - /// - /// Endereço de Linha deletado - /// Endereço de Linha deletado com sucesso - /// Endereço de Linha não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.DeleteAsync(id, cancellationToken); - } - - /// - /// Obter endereços de linha paginados e filtrados - /// - /// - /// GET de Endereços Linha - /// - /// Filtros para aplicar - /// - /// Endereços de Linha paginados e filtrados - /// Endereços de Linha paginados e filtrados com sucesso - [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) - { - return base.GetPaginedAsync(filter, cancellationToken); - } - - /// - /// Obter endereço de linha por id - /// - /// - /// GET pelo id de endereço de linha - /// - /// Id de endereço de linha - /// - /// Endereço de Linha encontrado - /// Endereço de Linha encontrado com sucesso - /// Endereço de Linha não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.GetByIdAsync(id, cancellationToken); - } - } -} diff --git a/OneBus.API/Controllers/LineTariffAuditController.cs b/OneBus.API/Controllers/LineTariffAuditController.cs deleted file mode 100644 index 04ef350..0000000 --- a/OneBus.API/Controllers/LineTariffAuditController.cs +++ /dev/null @@ -1,114 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using OneBus.Application.DTOs.LineTariffAudit; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Commons; -using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using Swashbuckle.AspNetCore.Annotations; - -namespace OneBus.API.Controllers -{ - [SwaggerTag("Controlador responsável por gerenciar Auditoria de Tarifas da Linha")] - public class LineTariffAuditController : BaseController - { - public LineTariffAuditController( - IBaseService baseService) - : base(baseService) - { - } - - /// - /// Cadastrar nova auditoria de tarifa de linha - /// - /// - /// POST de Auditoria de Tarifa de Linha - /// - /// Campos para cadastrar auditoria de tarifa de linha - /// - /// Auditoria de Tarifa de Linha cadastrada - /// Auditoria de Tarifa de Linha cadastrada com sucesso - /// Validação encontrou erros - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateLineTariffAuditDTO createDTO, CancellationToken cancellationToken = default) - { - return base.CreateAsync(createDTO, cancellationToken); - } - - /// - /// Atualizar auditoria de tarifa de linha - /// - /// - /// PUT de Auditoria de Tarifa de Linha - /// - /// Id da auditoria de tarifa de linha - /// Campos para atualizar auditoria de tarifa de linha - /// - /// Auditoria de Tarifa de Linha atualizada - /// Auditoria de Tarifa de Linha atualizada com sucesso - /// Validação encontrou erros - /// Auditoria de Tarifa de Linha não encontrada - /// Conflito entre ids - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateLineTariffAuditDTO updateDTO, CancellationToken cancellationToken = default) - { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Deletar auditoria de tarifa de linha - /// - /// - /// DELETE de Auditoria de Tarifa de Linha - /// - /// Id da auditoria de tarifa de linha - /// - /// Auditoria de Tarifa de Linha deletada - /// Auditoria de Tarifa de Linha deletada com sucesso - /// Auditoria de Tarifa de Linha não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.DeleteAsync(id, cancellationToken); - } - - /// - /// Obter auditoria de tarifas de linha paginadas e filtradas - /// - /// - /// GET de Auditoria de Tarifas de Linha - /// - /// Filtros para aplicar - /// - /// Auditoria de Tarifas de Linha paginadas e filtradas - /// Auditoria de Tarifas de Linha paginadas e filtradas com sucesso - [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) - { - return base.GetPaginedAsync(filter, cancellationToken); - } - - /// - /// Obter auditoria de tarifa de linha por id - /// - /// - /// GET pelo id da auditoria de tarifa de linha - /// - /// Id da auditoria de tarifa de linha - /// - /// Auditoria de Tarifa de Linha encontrada - /// Auditoria de Tarifa de Linha encontrada com sucesso - /// Auditoria de Tarifa de Linha não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.GetByIdAsync(id, cancellationToken); - } - } -} diff --git a/OneBus.API/Controllers/LineTariffController.cs b/OneBus.API/Controllers/LineTariffController.cs deleted file mode 100644 index 141ba31..0000000 --- a/OneBus.API/Controllers/LineTariffController.cs +++ /dev/null @@ -1,114 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using OneBus.Application.DTOs.LineTariff; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Commons; -using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using Swashbuckle.AspNetCore.Annotations; - -namespace OneBus.API.Controllers -{ - [SwaggerTag("Controlador responsável por gerenciar Tarifas da Linha")] - public class LineTariffController : BaseController - { - public LineTariffController( - IBaseService baseService) - : base(baseService) - { - } - - /// - /// Cadastrar nova tarifa de linha - /// - /// - /// POST de Tarifa de Linha - /// - /// Campos para cadastrar tarifa de linha - /// - /// Tarifa de Linha cadastrada - /// Tarifa de Linha cadastrada com sucesso - /// Validação encontrou erros - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateLineTariffDTO createDTO, CancellationToken cancellationToken = default) - { - return base.CreateAsync(createDTO, cancellationToken); - } - - /// - /// Atualizar tarifa de linha - /// - /// - /// PUT de Tarifa de Linha - /// - /// Id da tarifa de linha - /// Campos para atualizar tarifa de linha - /// - /// Tarifa de Linha atualizada - /// Tarifa de Linha atualizada com sucesso - /// Validação encontrou erros - /// Tarifa de Linha não encontrada - /// Conflito entre ids - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateLineTariffDTO updateDTO, CancellationToken cancellationToken = default) - { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Deletar tarifa de linha - /// - /// - /// DELETE de Tarifa de Linha - /// - /// Id da tarifa de linha - /// - /// Tarifa de Linha deletada - /// Tarifa de Linha deletada com sucesso - /// Tarifa de Linha não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.DeleteAsync(id, cancellationToken); - } - - /// - /// Obter tarifas de linha paginadas e filtradas - /// - /// - /// GET de Tarifas de Linha - /// - /// Filtros para aplicar - /// - /// Tarifas de Linha paginadas e filtradas - /// Tarifas de Linha paginadas e filtradas com sucesso - [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) - { - return base.GetPaginedAsync(filter, cancellationToken); - } - - /// - /// Obter tarifa de linha por id - /// - /// - /// GET pelo id da tarifa de linha - /// - /// Id da tarifa de linha - /// - /// Tarifa de Linha encontrada - /// Tarifa de Linha encontrada com sucesso - /// Tarifa de Linha não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.GetByIdAsync(id, cancellationToken); - } - } -} diff --git a/OneBus.API/Controllers/StopController.cs b/OneBus.API/Controllers/StopController.cs deleted file mode 100644 index e192499..0000000 --- a/OneBus.API/Controllers/StopController.cs +++ /dev/null @@ -1,114 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using OneBus.Application.DTOs.Stop; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Commons; -using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using Swashbuckle.AspNetCore.Annotations; - -namespace OneBus.API.Controllers -{ - [SwaggerTag("Controlador responsável por gerenciar Paradas")] - public class StopController : BaseController - { - public StopController( - IBaseService baseService) - : base(baseService) - { - } - - /// - /// Cadastrar nova parada - /// - /// - /// POST de Parada - /// - /// Campos para cadastrar parada - /// - /// Parada cadastrada - /// Parada cadastrada com sucesso - /// Validação encontrou erros - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateStopDTO createDTO, CancellationToken cancellationToken = default) - { - return base.CreateAsync(createDTO, cancellationToken); - } - - /// - /// Atualizar parada - /// - /// - /// PUT de Parada - /// - /// Id da parada - /// Campos para atualizar parada - /// - /// Parada atualizada - /// Parada atualizada com sucesso - /// Validação encontrou erros - /// Parada não encontrada - /// Conflito entre ids - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateStopDTO updateDTO, CancellationToken cancellationToken = default) - { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Deletar parada - /// - /// - /// DELETE de Parada - /// - /// Id da parada - /// - /// Parada deletada - /// Parada deletada com sucesso - /// Parada não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.DeleteAsync(id, cancellationToken); - } - - /// - /// Obter paradas paginadas e filtradas - /// - /// - /// GET de Paradas - /// - /// Filtros para aplicar - /// - /// Paradas paginadas e filtradas - /// Paradas paginadas e filtradas com sucesso - [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) - { - return base.GetPaginedAsync(filter, cancellationToken); - } - - /// - /// Obter parada por id - /// - /// - /// GET pelo id da parada - /// - /// Id da parada - /// - /// Parada encontrada - /// Parada encontrada com sucesso - /// Parada não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.GetByIdAsync(id, cancellationToken); - } - } -} diff --git a/OneBus.API/Controllers/StopTimeController.cs b/OneBus.API/Controllers/StopTimeController.cs deleted file mode 100644 index bbf0330..0000000 --- a/OneBus.API/Controllers/StopTimeController.cs +++ /dev/null @@ -1,114 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using OneBus.Application.DTOs.StopTime; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Commons; -using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using Swashbuckle.AspNetCore.Annotations; - -namespace OneBus.API.Controllers -{ - [SwaggerTag("Controlador responsável por gerenciar Horários da Parada")] - public class StopTimeController : BaseController - { - public StopTimeController( - IBaseService baseService) - : base(baseService) - { - } - - /// - /// Cadastrar novo horário de parada - /// - /// - /// POST de Horário de Parada - /// - /// Campos para cadastrar horário de parada - /// - /// Horário de Parada cadastrado - /// Horário de Parada cadastrado com sucesso - /// Validação encontrou erros - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateStopTimeDTO createDTO, CancellationToken cancellationToken = default) - { - return base.CreateAsync(createDTO, cancellationToken); - } - - /// - /// Atualizar horário de parada - /// - /// - /// PUT de Horário de Parada - /// - /// Id do horário de parada - /// Campos para atualizar horário de parada - /// - /// Horário de Parada atualizado - /// Horário de Parada atualizado com sucesso - /// Validação encontrou erros - /// Horário de Parada não encontrado - /// Conflito entre ids - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateStopTimeDTO updateDTO, CancellationToken cancellationToken = default) - { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Deletar horário de parada - /// - /// - /// DELETE de Horário de Parada - /// - /// Id do horário de parada - /// - /// Horário de Parada deletado - /// Horário de Parada deletado com sucesso - /// Horário de Parada não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.DeleteAsync(id, cancellationToken); - } - - /// - /// Obter horários de parada paginados e filtrados - /// - /// - /// GET de Horários de Parada - /// - /// Filtros para aplicar - /// - /// Horários de Parada paginados e filtrados - /// Horários de Parada paginados e filtrados com sucesso - [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) - { - return base.GetPaginedAsync(filter, cancellationToken); - } - - /// - /// Obter horário de parada por id - /// - /// - /// GET pelo id do horário de parada - /// - /// Id do horário de parada - /// - /// Horário de Parada encontrado - /// Horário de Parada encontrado com sucesso - /// Horário de Parada não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.GetByIdAsync(id, cancellationToken); - } - } -} diff --git a/OneBus.API/Controllers/UserTypeController.cs b/OneBus.API/Controllers/UserTypeController.cs deleted file mode 100644 index aeebff4..0000000 --- a/OneBus.API/Controllers/UserTypeController.cs +++ /dev/null @@ -1,113 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using OneBus.Application.DTOs.UserType; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Commons; -using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using Swashbuckle.AspNetCore.Annotations; - -namespace OneBus.API.Controllers -{ - [SwaggerTag("Controlador responsável por gerenciar Tipos de Usuários")] - public class UserTypeController : BaseController - { - public UserTypeController(IBaseService baseService) - : base(baseService) - { - } - - /// - /// Cadastrar novo tipo de usuário - /// - /// - /// POST de Tipo de Usuário - /// - /// Campos para cadastrar tipo de usuário - /// - /// Tipo de Usuário cadastrado - /// Tipo de Usuário cadastrado com sucesso - /// Validação encontrou erros - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateUserTypeDTO createDTO, CancellationToken cancellationToken = default) - { - return base.CreateAsync(createDTO, cancellationToken); - } - - /// - /// Atualizar tipo de usuário - /// - /// - /// PUT de Tipo de Usuário - /// - /// Id do tipo de usuário - /// Campos para atualizar tipo de usuário - /// - /// Tipo de Usuário atualizado - /// Tipo de Usuário atualizado com sucesso - /// Validação encontrou erros - /// Tipo de Usuário não encontrado - /// Conflito entre ids - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateUserTypeDTO updateDTO, CancellationToken cancellationToken = default) - { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Deletar tipo de usuário - /// - /// - /// DELETE de Tipo de Usuário - /// - /// Id do tipo de usuário - /// - /// Tipo de Usuário deletado - /// Tipo de Usuário deletado com sucesso - /// Tipo de Usuário não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.DeleteAsync(id, cancellationToken); - } - - /// - /// Obter tipos de usuários paginados e filtrados - /// - /// - /// GET de Tipos de Usuários - /// - /// Filtros para aplicar - /// - /// Tipos de Usuários paginados e filtrados - /// Tipos de Usuários paginados e filtrados com sucesso - [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) - { - return base.GetPaginedAsync(filter, cancellationToken); - } - - /// - /// Obter tipo de usuário por id - /// - /// - /// GET pelo id de tipo de usuário - /// - /// Id do tipo de usuário - /// - /// Tipo de Usuário encontrado - /// Tipo de Usuário encontrado com sucesso - /// Tipo de Usuário não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.GetByIdAsync(id, cancellationToken); - } - } -} diff --git a/OneBus.API/Controllers/UserTypeFeatureController.cs b/OneBus.API/Controllers/UserTypeFeatureController.cs deleted file mode 100644 index f6ba8b5..0000000 --- a/OneBus.API/Controllers/UserTypeFeatureController.cs +++ /dev/null @@ -1,113 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using OneBus.Application.DTOs.UserTypeFeature; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Commons; -using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using Swashbuckle.AspNetCore.Annotations; - -namespace OneBus.API.Controllers -{ - [SwaggerTag("Controlador responsável por gerenciar Funcionalidades de Tipos de Usuários")] - public class UserTypeFeatureController : BaseController - { - public UserTypeFeatureController(IBaseService baseService) - : base(baseService) - { - } - - /// - /// Cadastrar nova funcionalidade de tipo de usuário - /// - /// - /// POST de Funcionalidade de Tipo de Usuário - /// - /// Campos para cadastrar funcionalidade de tipo de usuário - /// - /// Funcionalidade de Tipo de Usuário cadastrado - /// Funcionalidade de Tipo de Usuário cadastrado com sucesso - /// Validação encontrou erros - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateUserTypeFeatureDTO createDTO, CancellationToken cancellationToken = default) - { - return base.CreateAsync(createDTO, cancellationToken); - } - - /// - /// Atualizar funcionalidade de tipo de usuário - /// - /// - /// PUT de Funcionalidade de Tipo de Usuário - /// - /// Id da funcionalidade de tipo de usuário - /// Campos para atualizar funcionalidade de tipo de usuário - /// - /// Funcionalidade de Tipo de Usuário atualizada - /// Funcionalidade de Tipo de Usuário atualizada com sucesso - /// Validação encontrou erros - /// Funcionalidade de Tipo de Usuário não encontrada - /// Conflito entre ids - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateUserTypeFeatureDTO updateDTO, CancellationToken cancellationToken = default) - { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Deletar funcionalidade de tipo de usuário - /// - /// - /// DELETE de Funcionalidade de Tipo de Usuário - /// - /// Id da funcionalidade de tipo de usuário - /// - /// Funcionalidade de Tipo de Usuário deletada - /// Funcionalidade de Tipo de Usuário deletada com sucesso - /// Funcionalidade de Tipo de Usuário não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.DeleteAsync(id, cancellationToken); - } - - /// - /// Obter funcionalidades de tipos de usuários paginados e filtrados - /// - /// - /// GET de Funcionalidades de Tipos de Usuários - /// - /// Filtros para aplicar - /// - /// Funcionalidades de Tipos de Usuários paginados e filtrados - /// Funcionalidades de Tipos de Usuários paginados e filtrados com sucesso - [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) - { - return base.GetPaginedAsync(filter, cancellationToken); - } - - /// - /// Obter funcionalidade de tipo de usuário por id - /// - /// - /// GET pelo id de funcionalidade de tipo de usuário - /// - /// Id da funcionalidade de tipo de usuário - /// - /// Funcionalidade de Tipo de Usuário encontrada - /// Funcionalidade de Tipo de Usuário encontrada com sucesso - /// Funcionalidade de Tipo de Usuário não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.GetByIdAsync(id, cancellationToken); - } - } -} diff --git a/OneBus.API/Controllers/VehicleGarageController.cs b/OneBus.API/Controllers/VehicleGarageController.cs deleted file mode 100644 index df5ff67..0000000 --- a/OneBus.API/Controllers/VehicleGarageController.cs +++ /dev/null @@ -1,114 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using OneBus.Application.DTOs.VehicleGarage; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Commons; -using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using Swashbuckle.AspNetCore.Annotations; - -namespace OneBus.API.Controllers -{ - [SwaggerTag("Controlador responsável por gerenciar Garagem de Veículos")] - public class VehicleGarageController : BaseController - { - public VehicleGarageController( - IBaseService baseService) - : base(baseService) - { - } - - /// - /// Cadastrar nova garagem de veículo - /// - /// - /// POST de Garagem de Veículo - /// - /// Campos para cadastrar garagem de veículo - /// - /// Garagem de Veículo cadastrada - /// Garagem de Veículo cadastrada com sucesso - /// Validação encontrou erros - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateVehicleGarageDTO createDTO, CancellationToken cancellationToken = default) - { - return base.CreateAsync(createDTO, cancellationToken); - } - - /// - /// Atualizar garagem de veículo - /// - /// - /// PUT de Garagem de Veículo - /// - /// Id da garagem de veículo - /// Campos para atualizar garagem de veículo - /// - /// Garagem de Veículo atualizada - /// Garagem de Veículo atualizada com sucesso - /// Validação encontrou erros - /// Garagem de Veículo não encontrada - /// Conflito entre ids - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateVehicleGarageDTO updateDTO, CancellationToken cancellationToken = default) - { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Deletar garagem de veículo - /// - /// - /// DELETE de Garagem de Veículo - /// - /// Id da garagem de veículo - /// - /// Garagem de Veículo deletada - /// Garagem de Veículo deletada com sucesso - /// Garagem de Veículo não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.DeleteAsync(id, cancellationToken); - } - - /// - /// Obter garagem de veículos paginadas e filtradas - /// - /// - /// GET de Garagem de Veículos - /// - /// Filtros para aplicar - /// - /// Garagem de Veículos paginadas e filtradas - /// Garagem de Veículos paginadas e filtradas com sucesso - [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) - { - return base.GetPaginedAsync(filter, cancellationToken); - } - - /// - /// Obter garagem de veículo por id - /// - /// - /// GET pelo id da garagem de veículo - /// - /// Id da garagem de veículo - /// - /// Garagem de Veículo encontrada - /// Garagem de Veículo encontrada com sucesso - /// Garagem de Veículo não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) - { - return base.GetByIdAsync(id, cancellationToken); - } - } -} diff --git a/OneBus.Application/DTOs/Address/CreateAddressDTO.cs b/OneBus.Application/DTOs/Address/CreateAddressDTO.cs deleted file mode 100644 index 6e0e25f..0000000 --- a/OneBus.Application/DTOs/Address/CreateAddressDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.Address -{ - public class CreateAddressDTO : BaseCreateDTO - { - } -} diff --git a/OneBus.Application/DTOs/Address/ReadAddressDTO.cs b/OneBus.Application/DTOs/Address/ReadAddressDTO.cs deleted file mode 100644 index b8feaf7..0000000 --- a/OneBus.Application/DTOs/Address/ReadAddressDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.Address -{ - public class ReadAddressDTO : BaseReadDTO - { - } -} diff --git a/OneBus.Application/DTOs/Address/UpdateAddressDTO.cs b/OneBus.Application/DTOs/Address/UpdateAddressDTO.cs deleted file mode 100644 index 02d8e07..0000000 --- a/OneBus.Application/DTOs/Address/UpdateAddressDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.Address -{ - public class UpdateAddressDTO : BaseUpdateDTO - { - } -} diff --git a/OneBus.Application/DTOs/BusAudit/CreateBusAuditDTO.cs b/OneBus.Application/DTOs/BusAudit/CreateBusAuditDTO.cs deleted file mode 100644 index fbe1aba..0000000 --- a/OneBus.Application/DTOs/BusAudit/CreateBusAuditDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.BusAudit -{ - public class CreateBusAuditDTO : BaseCreateDTO - { - } -} diff --git a/OneBus.Application/DTOs/BusAudit/ReadBusAuditDTO.cs b/OneBus.Application/DTOs/BusAudit/ReadBusAuditDTO.cs deleted file mode 100644 index f07be88..0000000 --- a/OneBus.Application/DTOs/BusAudit/ReadBusAuditDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.BusAudit -{ - public class ReadBusAuditDTO : BaseReadDTO - { - } -} diff --git a/OneBus.Application/DTOs/BusAudit/UpdateBusAuditDTO.cs b/OneBus.Application/DTOs/BusAudit/UpdateBusAuditDTO.cs deleted file mode 100644 index 0f91e88..0000000 --- a/OneBus.Application/DTOs/BusAudit/UpdateBusAuditDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.BusAudit -{ - public class UpdateBusAuditDTO : BaseUpdateDTO - { - } -} diff --git a/OneBus.Application/DTOs/Company/CreateCompanyDTO.cs b/OneBus.Application/DTOs/Company/CreateCompanyDTO.cs deleted file mode 100644 index d7cf1b1..0000000 --- a/OneBus.Application/DTOs/Company/CreateCompanyDTO.cs +++ /dev/null @@ -1,23 +0,0 @@ -using OneBus.Application.DTOs.User; - -namespace OneBus.Application.DTOs.Company -{ - public class CreateCompanyDTO : BaseCreateDTO - { - public CreateCompanyDTO() - { - Name = string.Empty; - Cnpj = string.Empty; - Email = string.Empty; - CreateUser = default!; - } - - public string Name { get; set; } - - public string Cnpj { get; set; } - - public string Email { get; set; } - - public CreateUserDTO CreateUser { get; set; } - } -} diff --git a/OneBus.Application/DTOs/Company/ReadCompanyDTO.cs b/OneBus.Application/DTOs/Company/ReadCompanyDTO.cs deleted file mode 100644 index 7e31b10..0000000 --- a/OneBus.Application/DTOs/Company/ReadCompanyDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.Company -{ - public class ReadCompanyDTO : BaseReadDTO - { - } -} diff --git a/OneBus.Application/DTOs/Company/UpdateCompanyDTO.cs b/OneBus.Application/DTOs/Company/UpdateCompanyDTO.cs deleted file mode 100644 index 48715be..0000000 --- a/OneBus.Application/DTOs/Company/UpdateCompanyDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.Company -{ - public class UpdateCompanyDTO : BaseUpdateDTO - { - } -} diff --git a/OneBus.Application/DTOs/EmployeeGarage/CreateEmployeeGarageDTO.cs b/OneBus.Application/DTOs/EmployeeGarage/CreateEmployeeGarageDTO.cs deleted file mode 100644 index 602dab3..0000000 --- a/OneBus.Application/DTOs/EmployeeGarage/CreateEmployeeGarageDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.EmployeeGarage -{ - public class CreateEmployeeGarageDTO : BaseCreateDTO - { - } -} diff --git a/OneBus.Application/DTOs/EmployeeGarage/ReadEmployeeGarageDTO.cs b/OneBus.Application/DTOs/EmployeeGarage/ReadEmployeeGarageDTO.cs deleted file mode 100644 index 61728a0..0000000 --- a/OneBus.Application/DTOs/EmployeeGarage/ReadEmployeeGarageDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.EmployeeGarage -{ - public class ReadEmployeeGarageDTO : BaseReadDTO - { - } -} diff --git a/OneBus.Application/DTOs/EmployeeGarage/UpdateEmployeeGarageDTO.cs b/OneBus.Application/DTOs/EmployeeGarage/UpdateEmployeeGarageDTO.cs deleted file mode 100644 index 010346f..0000000 --- a/OneBus.Application/DTOs/EmployeeGarage/UpdateEmployeeGarageDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.EmployeeGarage -{ - public class UpdateEmployeeGarageDTO : BaseUpdateDTO - { - } -} diff --git a/OneBus.Application/DTOs/Feature/ReadFeatureDTO.cs b/OneBus.Application/DTOs/Feature/ReadFeatureDTO.cs deleted file mode 100644 index f6c8630..0000000 --- a/OneBus.Application/DTOs/Feature/ReadFeatureDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.Feature -{ - public class ReadFeatureDTO : BaseReadDTO - { - } -} diff --git a/OneBus.Application/DTOs/Garage/CreateGarageDTO.cs b/OneBus.Application/DTOs/Garage/CreateGarageDTO.cs deleted file mode 100644 index ea497f5..0000000 --- a/OneBus.Application/DTOs/Garage/CreateGarageDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.Garage -{ - public class CreateGarageDTO : BaseCreateDTO - { - } -} diff --git a/OneBus.Application/DTOs/Garage/ReadGarageDTO.cs b/OneBus.Application/DTOs/Garage/ReadGarageDTO.cs deleted file mode 100644 index dcf6152..0000000 --- a/OneBus.Application/DTOs/Garage/ReadGarageDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.Garage -{ - public class ReadGarageDTO : BaseReadDTO - { - } -} diff --git a/OneBus.Application/DTOs/Garage/UpdateGarageDTO.cs b/OneBus.Application/DTOs/Garage/UpdateGarageDTO.cs deleted file mode 100644 index b29414f..0000000 --- a/OneBus.Application/DTOs/Garage/UpdateGarageDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.Garage -{ - public class UpdateGarageDTO : BaseUpdateDTO - { - } -} diff --git a/OneBus.Application/DTOs/LineAddress/CreateLineAddressDTO.cs b/OneBus.Application/DTOs/LineAddress/CreateLineAddressDTO.cs deleted file mode 100644 index 520833b..0000000 --- a/OneBus.Application/DTOs/LineAddress/CreateLineAddressDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.LineAddress -{ - public class CreateLineAddressDTO : BaseCreateDTO - { - } -} diff --git a/OneBus.Application/DTOs/LineAddress/ReadLineAddressDTO.cs b/OneBus.Application/DTOs/LineAddress/ReadLineAddressDTO.cs deleted file mode 100644 index fedd7ee..0000000 --- a/OneBus.Application/DTOs/LineAddress/ReadLineAddressDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.LineAddress -{ - public class ReadLineAddressDTO : BaseReadDTO - { - } -} diff --git a/OneBus.Application/DTOs/LineAddress/UpdateLineAddressDTO.cs b/OneBus.Application/DTOs/LineAddress/UpdateLineAddressDTO.cs deleted file mode 100644 index ee67c5d..0000000 --- a/OneBus.Application/DTOs/LineAddress/UpdateLineAddressDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.LineAddress -{ - public class UpdateLineAddressDTO : BaseUpdateDTO - { - } -} diff --git a/OneBus.Application/DTOs/LineTariff/CreateLineTariffDTO.cs b/OneBus.Application/DTOs/LineTariff/CreateLineTariffDTO.cs deleted file mode 100644 index aa30be6..0000000 --- a/OneBus.Application/DTOs/LineTariff/CreateLineTariffDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.LineTariff -{ - public class CreateLineTariffDTO : BaseCreateDTO - { - } -} diff --git a/OneBus.Application/DTOs/LineTariff/ReadLineTariffDTO.cs b/OneBus.Application/DTOs/LineTariff/ReadLineTariffDTO.cs deleted file mode 100644 index 224e344..0000000 --- a/OneBus.Application/DTOs/LineTariff/ReadLineTariffDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.LineTariff -{ - public class ReadLineTariffDTO : BaseReadDTO - { - } -} diff --git a/OneBus.Application/DTOs/LineTariff/UpdateLineTariffDTO.cs b/OneBus.Application/DTOs/LineTariff/UpdateLineTariffDTO.cs deleted file mode 100644 index 4f5fbea..0000000 --- a/OneBus.Application/DTOs/LineTariff/UpdateLineTariffDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.LineTariff -{ - public class UpdateLineTariffDTO : BaseUpdateDTO - { - } -} diff --git a/OneBus.Application/DTOs/LineTariffAudit/CreateLineTariffAuditDTO.cs b/OneBus.Application/DTOs/LineTariffAudit/CreateLineTariffAuditDTO.cs deleted file mode 100644 index f950a70..0000000 --- a/OneBus.Application/DTOs/LineTariffAudit/CreateLineTariffAuditDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.LineTariffAudit -{ - public class CreateLineTariffAuditDTO : BaseCreateDTO - { - } -} diff --git a/OneBus.Application/DTOs/LineTariffAudit/ReadLineTariffAuditDTO.cs b/OneBus.Application/DTOs/LineTariffAudit/ReadLineTariffAuditDTO.cs deleted file mode 100644 index 268022a..0000000 --- a/OneBus.Application/DTOs/LineTariffAudit/ReadLineTariffAuditDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.LineTariffAudit -{ - public class ReadLineTariffAuditDTO : BaseReadDTO - { - } -} diff --git a/OneBus.Application/DTOs/LineTariffAudit/UpdateLineTariffAuditDTO.cs b/OneBus.Application/DTOs/LineTariffAudit/UpdateLineTariffAuditDTO.cs deleted file mode 100644 index 2aa4899..0000000 --- a/OneBus.Application/DTOs/LineTariffAudit/UpdateLineTariffAuditDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.LineTariffAudit -{ - public class UpdateLineTariffAuditDTO : BaseUpdateDTO - { - } -} diff --git a/OneBus.Application/DTOs/Stop/CreateStopDTO.cs b/OneBus.Application/DTOs/Stop/CreateStopDTO.cs deleted file mode 100644 index f45779e..0000000 --- a/OneBus.Application/DTOs/Stop/CreateStopDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.Stop -{ - public class CreateStopDTO : BaseCreateDTO - { - } -} diff --git a/OneBus.Application/DTOs/Stop/ReadStopDTO.cs b/OneBus.Application/DTOs/Stop/ReadStopDTO.cs deleted file mode 100644 index 9522615..0000000 --- a/OneBus.Application/DTOs/Stop/ReadStopDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.Stop -{ - public class ReadStopDTO : BaseReadDTO - { - } -} diff --git a/OneBus.Application/DTOs/Stop/UpdateStopDTO.cs b/OneBus.Application/DTOs/Stop/UpdateStopDTO.cs deleted file mode 100644 index 7f07e03..0000000 --- a/OneBus.Application/DTOs/Stop/UpdateStopDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.Stop -{ - public class UpdateStopDTO : BaseUpdateDTO - { - } -} diff --git a/OneBus.Application/DTOs/StopTime/CreateStopTimeDTO.cs b/OneBus.Application/DTOs/StopTime/CreateStopTimeDTO.cs deleted file mode 100644 index 1530998..0000000 --- a/OneBus.Application/DTOs/StopTime/CreateStopTimeDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.StopTime -{ - public class CreateStopTimeDTO : BaseCreateDTO - { - } -} diff --git a/OneBus.Application/DTOs/StopTime/ReadStopTimeDTO.cs b/OneBus.Application/DTOs/StopTime/ReadStopTimeDTO.cs deleted file mode 100644 index 83cbba6..0000000 --- a/OneBus.Application/DTOs/StopTime/ReadStopTimeDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.StopTime -{ - public class ReadStopTimeDTO : BaseReadDTO - { - } -} diff --git a/OneBus.Application/DTOs/StopTime/UpdateStopTimeDTO.cs b/OneBus.Application/DTOs/StopTime/UpdateStopTimeDTO.cs deleted file mode 100644 index a62dc19..0000000 --- a/OneBus.Application/DTOs/StopTime/UpdateStopTimeDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.StopTime -{ - public class UpdateStopTimeDTO : BaseUpdateDTO - { - } -} diff --git a/OneBus.Application/DTOs/UserType/CreateUserTypeDTO.cs b/OneBus.Application/DTOs/UserType/CreateUserTypeDTO.cs deleted file mode 100644 index 8c020f6..0000000 --- a/OneBus.Application/DTOs/UserType/CreateUserTypeDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.UserType -{ - public class CreateUserTypeDTO : BaseCreateDTO - { - } -} diff --git a/OneBus.Application/DTOs/UserType/ReadUserTypeDTO.cs b/OneBus.Application/DTOs/UserType/ReadUserTypeDTO.cs deleted file mode 100644 index 8fd7b85..0000000 --- a/OneBus.Application/DTOs/UserType/ReadUserTypeDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.UserType -{ - public class ReadUserTypeDTO : BaseReadDTO - { - } -} diff --git a/OneBus.Application/DTOs/UserType/UpdateUserTypeDTO.cs b/OneBus.Application/DTOs/UserType/UpdateUserTypeDTO.cs deleted file mode 100644 index bdeff92..0000000 --- a/OneBus.Application/DTOs/UserType/UpdateUserTypeDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.UserType -{ - public class UpdateUserTypeDTO : BaseUpdateDTO - { - } -} diff --git a/OneBus.Application/DTOs/UserTypeFeature/CreateUserTypeFeatureDTO.cs b/OneBus.Application/DTOs/UserTypeFeature/CreateUserTypeFeatureDTO.cs deleted file mode 100644 index 5dee8e5..0000000 --- a/OneBus.Application/DTOs/UserTypeFeature/CreateUserTypeFeatureDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.UserTypeFeature -{ - public class CreateUserTypeFeatureDTO : BaseCreateDTO - { - } -} diff --git a/OneBus.Application/DTOs/UserTypeFeature/ReadUserTypeFeatureDTO.cs b/OneBus.Application/DTOs/UserTypeFeature/ReadUserTypeFeatureDTO.cs deleted file mode 100644 index a40b394..0000000 --- a/OneBus.Application/DTOs/UserTypeFeature/ReadUserTypeFeatureDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.UserTypeFeature -{ - public class ReadUserTypeFeatureDTO : BaseReadDTO - { - } -} diff --git a/OneBus.Application/DTOs/UserTypeFeature/UpdateUserTypeFeatureDTO.cs b/OneBus.Application/DTOs/UserTypeFeature/UpdateUserTypeFeatureDTO.cs deleted file mode 100644 index 1477da2..0000000 --- a/OneBus.Application/DTOs/UserTypeFeature/UpdateUserTypeFeatureDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.UserTypeFeature -{ - public class UpdateUserTypeFeatureDTO : BaseUpdateDTO - { - } -} diff --git a/OneBus.Application/DTOs/VehicleGarage/CreateVehicleGarageDTO.cs b/OneBus.Application/DTOs/VehicleGarage/CreateVehicleGarageDTO.cs deleted file mode 100644 index babf31f..0000000 --- a/OneBus.Application/DTOs/VehicleGarage/CreateVehicleGarageDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.VehicleGarage -{ - public class CreateVehicleGarageDTO : BaseCreateDTO - { - } -} diff --git a/OneBus.Application/DTOs/VehicleGarage/ReadVehicleGarageDTO.cs b/OneBus.Application/DTOs/VehicleGarage/ReadVehicleGarageDTO.cs deleted file mode 100644 index 90384d4..0000000 --- a/OneBus.Application/DTOs/VehicleGarage/ReadVehicleGarageDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.VehicleGarage -{ - public class ReadVehicleGarageDTO : BaseReadDTO - { - } -} diff --git a/OneBus.Application/DTOs/VehicleGarage/UpdateVehicleGarageDTO.cs b/OneBus.Application/DTOs/VehicleGarage/UpdateVehicleGarageDTO.cs deleted file mode 100644 index a9bb8cb..0000000 --- a/OneBus.Application/DTOs/VehicleGarage/UpdateVehicleGarageDTO.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace OneBus.Application.DTOs.VehicleGarage -{ - public class UpdateVehicleGarageDTO : BaseUpdateDTO - { - } -} diff --git a/OneBus.Application/Interfaces/Services/IAddressService.cs b/OneBus.Application/Interfaces/Services/IAddressService.cs deleted file mode 100644 index dab3d54..0000000 --- a/OneBus.Application/Interfaces/Services/IAddressService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using OneBus.Application.DTOs.Address; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Application.Interfaces.Services -{ - public interface IAddressService : - IBaseService - { - } -} diff --git a/OneBus.Application/Interfaces/Services/IBusAuditService.cs b/OneBus.Application/Interfaces/Services/IBusAuditService.cs deleted file mode 100644 index 117389a..0000000 --- a/OneBus.Application/Interfaces/Services/IBusAuditService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using OneBus.Application.DTOs.BusAudit; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Application.Interfaces.Services -{ - public interface IBusAuditService : - IBaseService - { - } -} diff --git a/OneBus.Application/Interfaces/Services/ICompanyService.cs b/OneBus.Application/Interfaces/Services/ICompanyService.cs deleted file mode 100644 index 79ef24d..0000000 --- a/OneBus.Application/Interfaces/Services/ICompanyService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using OneBus.Application.DTOs.Company; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Application.Interfaces.Services -{ - public interface ICompanyService : - IBaseService - { - } -} diff --git a/OneBus.Application/Interfaces/Services/IEmailService.cs b/OneBus.Application/Interfaces/Services/IEmailService.cs deleted file mode 100644 index b25cd47..0000000 --- a/OneBus.Application/Interfaces/Services/IEmailService.cs +++ /dev/null @@ -1,10 +0,0 @@ -using OneBus.Domain.Commons.Result; -using OneBus.Domain.Models; - -namespace OneBus.Application.Interfaces.Services -{ - public interface IEmailService - { - Task> SendAsync(EmailModel emailModel, CancellationToken cancellationToken = default); - } -} diff --git a/OneBus.Application/Interfaces/Services/IEmployeeGarageService.cs b/OneBus.Application/Interfaces/Services/IEmployeeGarageService.cs deleted file mode 100644 index 515e7e4..0000000 --- a/OneBus.Application/Interfaces/Services/IEmployeeGarageService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using OneBus.Application.DTOs.EmployeeGarage; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Application.Interfaces.Services -{ - public interface IEmployeeGarageService : - IBaseService - { - } -} diff --git a/OneBus.Application/Interfaces/Services/IFeatureService.cs b/OneBus.Application/Interfaces/Services/IFeatureService.cs deleted file mode 100644 index 5990d80..0000000 --- a/OneBus.Application/Interfaces/Services/IFeatureService.cs +++ /dev/null @@ -1,10 +0,0 @@ -using OneBus.Application.DTOs.Feature; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Application.Interfaces.Services -{ - public interface IFeatureService : IBaseReadOnlyService - { - } -} diff --git a/OneBus.Application/Interfaces/Services/IGarageService.cs b/OneBus.Application/Interfaces/Services/IGarageService.cs deleted file mode 100644 index 8efb798..0000000 --- a/OneBus.Application/Interfaces/Services/IGarageService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using OneBus.Application.DTOs.Garage; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Application.Interfaces.Services -{ - public interface IGarageService : - IBaseService - { - } -} diff --git a/OneBus.Application/Interfaces/Services/ILineAddressService.cs b/OneBus.Application/Interfaces/Services/ILineAddressService.cs deleted file mode 100644 index a8e860a..0000000 --- a/OneBus.Application/Interfaces/Services/ILineAddressService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using OneBus.Application.DTOs.LineAddress; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Application.Interfaces.Services -{ - public interface ILineAddressService : - IBaseService - { - } -} diff --git a/OneBus.Application/Interfaces/Services/ILineTariffAuditService.cs b/OneBus.Application/Interfaces/Services/ILineTariffAuditService.cs deleted file mode 100644 index 3278b76..0000000 --- a/OneBus.Application/Interfaces/Services/ILineTariffAuditService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using OneBus.Application.DTOs.LineTariffAudit; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Application.Interfaces.Services -{ - public interface ILineTariffAuditService : - IBaseService - { - } -} diff --git a/OneBus.Application/Interfaces/Services/ILineTariffService.cs b/OneBus.Application/Interfaces/Services/ILineTariffService.cs deleted file mode 100644 index 467e3de..0000000 --- a/OneBus.Application/Interfaces/Services/ILineTariffService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using OneBus.Application.DTOs.LineTariff; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Application.Interfaces.Services -{ - public interface ILineTariffService : - IBaseService - { - } -} diff --git a/OneBus.Application/Interfaces/Services/IStopService.cs b/OneBus.Application/Interfaces/Services/IStopService.cs deleted file mode 100644 index 9b2f60c..0000000 --- a/OneBus.Application/Interfaces/Services/IStopService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using OneBus.Application.DTOs.Stop; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Application.Interfaces.Services -{ - public interface IStopService : - IBaseService - { - } -} diff --git a/OneBus.Application/Interfaces/Services/IStopTimeService.cs b/OneBus.Application/Interfaces/Services/IStopTimeService.cs deleted file mode 100644 index 7c0a7fe..0000000 --- a/OneBus.Application/Interfaces/Services/IStopTimeService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using OneBus.Application.DTOs.StopTime; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Application.Interfaces.Services -{ - public interface IStopTimeService : - IBaseService - { - } -} diff --git a/OneBus.Application/Interfaces/Services/IUserTypeFeatureService.cs b/OneBus.Application/Interfaces/Services/IUserTypeFeatureService.cs deleted file mode 100644 index 15e6d22..0000000 --- a/OneBus.Application/Interfaces/Services/IUserTypeFeatureService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using OneBus.Application.DTOs.UserTypeFeature; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Application.Interfaces.Services -{ - public interface IUserTypeFeatureService : IBaseService - { - Task HasPermissionAsync(ulong userId, byte featureCode, CancellationToken cancellationToken = default); - } -} diff --git a/OneBus.Application/Interfaces/Services/IUserTypeService.cs b/OneBus.Application/Interfaces/Services/IUserTypeService.cs deleted file mode 100644 index 92dfe35..0000000 --- a/OneBus.Application/Interfaces/Services/IUserTypeService.cs +++ /dev/null @@ -1,10 +0,0 @@ -using OneBus.Application.DTOs.UserType; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Application.Interfaces.Services -{ - public interface IUserTypeService : IBaseService - { - } -} diff --git a/OneBus.Application/Interfaces/Services/IVehicleGarageService.cs b/OneBus.Application/Interfaces/Services/IVehicleGarageService.cs deleted file mode 100644 index a600f4b..0000000 --- a/OneBus.Application/Interfaces/Services/IVehicleGarageService.cs +++ /dev/null @@ -1,11 +0,0 @@ -using OneBus.Application.DTOs.VehicleGarage; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Application.Interfaces.Services -{ - public interface IVehicleGarageService : - IBaseService - { - } -} diff --git a/OneBus.Application/Services/AddressService.cs b/OneBus.Application/Services/AddressService.cs deleted file mode 100644 index 0b5dc5f..0000000 --- a/OneBus.Application/Services/AddressService.cs +++ /dev/null @@ -1,26 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.Address; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; - -namespace OneBus.Application.Services -{ - public class AddressService : BaseService, - IAddressService - { - public AddressService( - IBaseRepository baseRepository, - IValidator createValidator, - IValidator updateValidator) - : base(baseRepository, createValidator, updateValidator) - { - } - - protected override void UpdateFields(Address entity, UpdateAddressDTO updateDTO) - { - throw new NotImplementedException(); - } - } -} diff --git a/OneBus.Application/Services/BusAuditService.cs b/OneBus.Application/Services/BusAuditService.cs deleted file mode 100644 index 803b908..0000000 --- a/OneBus.Application/Services/BusAuditService.cs +++ /dev/null @@ -1,26 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.BusAudit; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; - -namespace OneBus.Application.Services -{ - public class BusAuditService : BaseService, - IBusAuditService - { - public BusAuditService( - IBaseRepository baseRepository, - IValidator createValidator, - IValidator updateValidator) - : base(baseRepository, createValidator, updateValidator) - { - } - - protected override void UpdateFields(BusAudit entity, UpdateBusAuditDTO updateDTO) - { - throw new NotImplementedException(); - } - } -} diff --git a/OneBus.Application/Services/CompanyService.cs b/OneBus.Application/Services/CompanyService.cs deleted file mode 100644 index 0cf159b..0000000 --- a/OneBus.Application/Services/CompanyService.cs +++ /dev/null @@ -1,26 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.Company; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; - -namespace OneBus.Application.Services -{ - public class CompanyService : BaseService, - ICompanyService - { - public CompanyService( - IBaseRepository baseRepository, - IValidator createValidator, - IValidator updateValidator) - : base(baseRepository, createValidator, updateValidator) - { - } - - protected override void UpdateFields(Company entity, UpdateCompanyDTO updateDTO) - { - throw new NotImplementedException(); - } - } -} diff --git a/OneBus.Application/Services/EmailService.cs b/OneBus.Application/Services/EmailService.cs deleted file mode 100644 index 42a4dff..0000000 --- a/OneBus.Application/Services/EmailService.cs +++ /dev/null @@ -1,141 +0,0 @@ -using System.Net; -using System.Text; -using System.Net.Mime; -using System.Net.Mail; -using FluentValidation; -using OneBus.Domain.Models; -using OneBus.Domain.Settings; -using Microsoft.Extensions.Options; -using OneBus.Domain.Commons.Result; -using Microsoft.Extensions.Logging; -using OneBus.Application.Extensions; -using OneBus.Application.Interfaces.Services; - -namespace OneBus.Application.Services -{ - public class EmailService : IEmailService - { - private readonly EmailSettings _emailSettings; - private readonly IValidator _validator; - private readonly ILogger _logger; - - public EmailService(IOptions options, IValidator validator, ILogger logger) - { - _emailSettings = options.Value; - _validator = validator; - _logger = logger; - } - - public async Task> SendAsync(EmailModel emailModel, CancellationToken cancellationToken = default) - { - var validation = await _validator.ValidateAsync(emailModel, cancellationToken); - - if (!validation.IsValid) - return validation.Errors.ToInvalidResult(); - - AlternateView? htmlView = null; - - emailModel.Body = await ConfigureBodyAsync(emailModel, cancellationToken); - - if (emailModel.IsCid) - htmlView = ConfigureCid(emailModel.Body); - - SmtpClient client = ConfigureClient(); - MailMessage message = ConfigureMessage(emailModel, htmlView); - - // Fire and Forget - _ = Task.Run(() => - { - try - { - client.Send(message); - } - catch (Exception ex) - { - _logger.LogError(ex, "Erro ao enviar e-mail para {Destinatarios}", string.Join(',', emailModel.To)); - } - }, cancellationToken); - - return SuccessResult.Create(true); - } - - private static async Task ConfigureBodyAsync(EmailModel emailModel, CancellationToken cancellationToken) - { - string body = await File.ReadAllTextAsync(emailModel.BodyPath, cancellationToken); - - foreach (var item in emailModel.Variables) - body = body.Replace(item.Key, item.Value); - - return body; - } - - private SmtpClient ConfigureClient() - { - // Applying Stmp Client settings - var client = new SmtpClient - { - UseDefaultCredentials = false, - Host = _emailSettings.MailHost, - Port = Convert.ToInt32(_emailSettings.MailPort), - EnableSsl = _emailSettings.MailEnableSsl.ToLower().Equals("true"), - Timeout = 90000, //1,5min - - //Applying credentials - Credentials = new NetworkCredential(_emailSettings.MailUser, _emailSettings.MailPassword) - }; - - return client; - } - - private static MailMessage ConfigureMessage(EmailModel emailModel, AlternateView? htmlView) - { - // Applying message settings - MailMessage message = new() - { - From = new MailAddress(emailModel.From, emailModel.FromName, Encoding.UTF8), - IsBodyHtml = true, - Body = emailModel.Body, - Priority = MailPriority.Normal, - Subject = emailModel.Subject, - BodyEncoding = Encoding.UTF8, - SubjectEncoding = Encoding.UTF8 - }; - - // Adicionar o recurso ao corpo - if (htmlView is not null) - message.AlternateViews.Add(htmlView); - - // Adding email destination - foreach (var destination in emailModel.To) - message.To.Add(destination); - - // Adding attachment from local file path - if (!string.IsNullOrEmpty(emailModel.FilePath)) - message.Attachments.Add(new Attachment(emailModel.FilePath, emailModel.FileName)); - - // Adding attachment from memory stream - if (emailModel.FileStream is { Length: > 0 }) - message.Attachments.Add(new Attachment(emailModel.FileStream, emailModel.FileName)); - - return message; - } - - private static AlternateView ConfigureCid(string body) - { - // Criar o corpo alternativo em HTML - AlternateView htmlView = AlternateView.CreateAlternateViewFromString(body, null, MediaTypeNames.Text.Html); - - // Carregar a imagem como recurso vinculado - var imagePath = Path.Combine(Directory.GetCurrentDirectory(), "Assets", "Images", "OneBusLogoEmail.png"); - LinkedResource image = new(imagePath, MediaTypeNames.Image.Png) - { - ContentId = "OneBusEmail", - TransferEncoding = TransferEncoding.Base64 - }; - - // Adicionar o recurso ao corpo - htmlView.LinkedResources.Add(image); - return htmlView; - } - } -} diff --git a/OneBus.Application/Services/EmployeeGarageService.cs b/OneBus.Application/Services/EmployeeGarageService.cs deleted file mode 100644 index 7aeea13..0000000 --- a/OneBus.Application/Services/EmployeeGarageService.cs +++ /dev/null @@ -1,26 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.EmployeeGarage; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; - -namespace OneBus.Application.Services -{ - public class EmployeeGarageService : BaseService, - IEmployeeGarageService - { - public EmployeeGarageService( - IBaseRepository baseRepository, - IValidator createValidator, - IValidator updateValidator) - : base(baseRepository, createValidator, updateValidator) - { - } - - protected override void UpdateFields(EmployeeGarage entity, UpdateEmployeeGarageDTO updateDTO) - { - throw new NotImplementedException(); - } - } -} diff --git a/OneBus.Application/Services/FeatureService.cs b/OneBus.Application/Services/FeatureService.cs deleted file mode 100644 index 1ee09c1..0000000 --- a/OneBus.Application/Services/FeatureService.cs +++ /dev/null @@ -1,15 +0,0 @@ -using OneBus.Application.DTOs.Feature; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; - -namespace OneBus.Application.Services -{ - public class FeatureService : BaseReadOnlyService, IFeatureService - { - public FeatureService(IBaseReadOnlyRepository baseReadOnlyRepository) : base(baseReadOnlyRepository) - { - } - } -} diff --git a/OneBus.Application/Services/GarageService.cs b/OneBus.Application/Services/GarageService.cs deleted file mode 100644 index 17125be..0000000 --- a/OneBus.Application/Services/GarageService.cs +++ /dev/null @@ -1,26 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.Garage; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; - -namespace OneBus.Application.Services -{ - public class GarageService : BaseService, - IGarageService - { - public GarageService( - IBaseRepository baseRepository, - IValidator createValidator, - IValidator updateValidator) - : base(baseRepository, createValidator, updateValidator) - { - } - - protected override void UpdateFields(Garage entity, UpdateGarageDTO updateDTO) - { - throw new NotImplementedException(); - } - } -} diff --git a/OneBus.Application/Services/LineAddressService.cs b/OneBus.Application/Services/LineAddressService.cs deleted file mode 100644 index 5293846..0000000 --- a/OneBus.Application/Services/LineAddressService.cs +++ /dev/null @@ -1,26 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.LineAddress; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; - -namespace OneBus.Application.Services -{ - public class LineAddressService : BaseService, - ILineAddressService - { - public LineAddressService( - IBaseRepository baseRepository, - IValidator createValidator, - IValidator updateValidator) - : base(baseRepository, createValidator, updateValidator) - { - } - - protected override void UpdateFields(LineAddress entity, UpdateLineAddressDTO updateDTO) - { - throw new NotImplementedException(); - } - } -} diff --git a/OneBus.Application/Services/LineTariffAuditService.cs b/OneBus.Application/Services/LineTariffAuditService.cs deleted file mode 100644 index 3efca14..0000000 --- a/OneBus.Application/Services/LineTariffAuditService.cs +++ /dev/null @@ -1,26 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.LineTariffAudit; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; - -namespace OneBus.Application.Services -{ - public class LineTariffAuditService : BaseService, - ILineTariffAuditService - { - public LineTariffAuditService( - IBaseRepository baseRepository, - IValidator createValidator, - IValidator updateValidator) - : base(baseRepository, createValidator, updateValidator) - { - } - - protected override void UpdateFields(LineTariffAudit entity, UpdateLineTariffAuditDTO updateDTO) - { - throw new NotImplementedException(); - } - } -} diff --git a/OneBus.Application/Services/LineTariffService.cs b/OneBus.Application/Services/LineTariffService.cs deleted file mode 100644 index 0c7bfcb..0000000 --- a/OneBus.Application/Services/LineTariffService.cs +++ /dev/null @@ -1,26 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.LineTariff; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; - -namespace OneBus.Application.Services -{ - public class LineTariffService : BaseService, - ILineTariffService - { - public LineTariffService( - IBaseRepository baseRepository, - IValidator createValidator, - IValidator updateValidator) - : base(baseRepository, createValidator, updateValidator) - { - } - - protected override void UpdateFields(LineTariff entity, UpdateLineTariffDTO updateDTO) - { - throw new NotImplementedException(); - } - } -} diff --git a/OneBus.Application/Services/StopService.cs b/OneBus.Application/Services/StopService.cs deleted file mode 100644 index 746a4f6..0000000 --- a/OneBus.Application/Services/StopService.cs +++ /dev/null @@ -1,26 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.Stop; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; - -namespace OneBus.Application.Services -{ - public class StopService : BaseService, - IStopService - { - public StopService( - IBaseRepository baseRepository, - IValidator createValidator, - IValidator updateValidator) - : base(baseRepository, createValidator, updateValidator) - { - } - - protected override void UpdateFields(Stop entity, UpdateStopDTO updateDTO) - { - throw new NotImplementedException(); - } - } -} diff --git a/OneBus.Application/Services/StopTimeService.cs b/OneBus.Application/Services/StopTimeService.cs deleted file mode 100644 index c393ebf..0000000 --- a/OneBus.Application/Services/StopTimeService.cs +++ /dev/null @@ -1,26 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.StopTime; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; - -namespace OneBus.Application.Services -{ - public class StopTimeService : BaseService, - IStopTimeService - { - public StopTimeService( - IBaseRepository baseRepository, - IValidator createValidator, - IValidator updateValidator) - : base(baseRepository, createValidator, updateValidator) - { - } - - protected override void UpdateFields(StopTime entity, UpdateStopTimeDTO updateDTO) - { - throw new NotImplementedException(); - } - } -} diff --git a/OneBus.Application/Services/UserTypeFeatureService.cs b/OneBus.Application/Services/UserTypeFeatureService.cs deleted file mode 100644 index 7edd36e..0000000 --- a/OneBus.Application/Services/UserTypeFeatureService.cs +++ /dev/null @@ -1,31 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.UserTypeFeature; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; - -namespace OneBus.Application.Services -{ - public class UserTypeFeatureService : BaseService, - IUserTypeFeatureService - { - public UserTypeFeatureService( - IBaseRepository baseRepository, - IValidator createValidator, - IValidator updateValidator) - : base(baseRepository, createValidator, updateValidator) - { - } - - public Task HasPermissionAsync(ulong userId, byte featureCode, CancellationToken cancellationToken = default) - { - throw new NotImplementedException(); - } - - protected override void UpdateFields(UserTypeFeature entity, UpdateUserTypeFeatureDTO updateDTO) - { - throw new NotImplementedException(); - } - } -} diff --git a/OneBus.Application/Services/UserTypeService.cs b/OneBus.Application/Services/UserTypeService.cs deleted file mode 100644 index 4e8b789..0000000 --- a/OneBus.Application/Services/UserTypeService.cs +++ /dev/null @@ -1,26 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.UserType; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; - -namespace OneBus.Application.Services -{ - public class UserTypeService : BaseService, - IUserTypeService - { - public UserTypeService( - IBaseRepository baseRepository, - IValidator createValidator, - IValidator updateValidator) - : base(baseRepository, createValidator, updateValidator) - { - } - - protected override void UpdateFields(UserType entity, UpdateUserTypeDTO updateDTO) - { - throw new NotImplementedException(); - } - } -} diff --git a/OneBus.Application/Services/VehicleGarageService.cs b/OneBus.Application/Services/VehicleGarageService.cs deleted file mode 100644 index 59c1d44..0000000 --- a/OneBus.Application/Services/VehicleGarageService.cs +++ /dev/null @@ -1,26 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.VehicleGarage; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; - -namespace OneBus.Application.Services -{ - public class VehicleGarageService : BaseService, - IVehicleGarageService - { - public VehicleGarageService( - IBaseRepository baseRepository, - IValidator createValidator, - IValidator updateValidator) - : base(baseRepository, createValidator, updateValidator) - { - } - - protected override void UpdateFields(VehicleGarage entity, UpdateVehicleGarageDTO updateDTO) - { - throw new NotImplementedException(); - } - } -} diff --git a/OneBus.Application/Validators/Address/CreateAddressDTOValidator.cs b/OneBus.Application/Validators/Address/CreateAddressDTOValidator.cs deleted file mode 100644 index 32bf6e3..0000000 --- a/OneBus.Application/Validators/Address/CreateAddressDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.Address; - -namespace OneBus.Application.Validators.Address -{ - public class CreateAddressDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/Address/UpdateAddressDTOValidator.cs b/OneBus.Application/Validators/Address/UpdateAddressDTOValidator.cs deleted file mode 100644 index e3b88a9..0000000 --- a/OneBus.Application/Validators/Address/UpdateAddressDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.Address; - -namespace OneBus.Application.Validators.Address -{ - public class UpdateAddressDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/BusAudit/CreateBusAuditDTOValidator.cs b/OneBus.Application/Validators/BusAudit/CreateBusAuditDTOValidator.cs deleted file mode 100644 index 6457cc6..0000000 --- a/OneBus.Application/Validators/BusAudit/CreateBusAuditDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.BusAudit; - -namespace OneBus.Application.Validators.BusAudit -{ - public class CreateBusAuditDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/BusAudit/UpdateBusAuditDTOValidator.cs b/OneBus.Application/Validators/BusAudit/UpdateBusAuditDTOValidator.cs deleted file mode 100644 index e5f28c1..0000000 --- a/OneBus.Application/Validators/BusAudit/UpdateBusAuditDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.BusAudit; - -namespace OneBus.Application.Validators.BusAudit -{ - public class UpdateBusAuditDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/Company/CreateCompanyDTOValidator.cs b/OneBus.Application/Validators/Company/CreateCompanyDTOValidator.cs deleted file mode 100644 index c26c1fb..0000000 --- a/OneBus.Application/Validators/Company/CreateCompanyDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.Company; - -namespace OneBus.Application.Validators.Company -{ - public class CreateCompanyDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/Company/UpdateCompanyDTOValidator.cs b/OneBus.Application/Validators/Company/UpdateCompanyDTOValidator.cs deleted file mode 100644 index 1bac554..0000000 --- a/OneBus.Application/Validators/Company/UpdateCompanyDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.Company; - -namespace OneBus.Application.Validators.Company -{ - public class UpdateCompanyDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/Email/EmailValidator.cs b/OneBus.Application/Validators/Email/EmailValidator.cs deleted file mode 100644 index 1c06e64..0000000 --- a/OneBus.Application/Validators/Email/EmailValidator.cs +++ /dev/null @@ -1,13 +0,0 @@ -using FluentValidation; -using OneBus.Domain.Models; - -namespace OneBus.Application.Validators.Email -{ - public class EmailValidator : AbstractValidator - { - public EmailValidator() - { - - } - } -} diff --git a/OneBus.Application/Validators/EmployeeGarage/CreateEmployeeGarageDTOValidator.cs b/OneBus.Application/Validators/EmployeeGarage/CreateEmployeeGarageDTOValidator.cs deleted file mode 100644 index 7efd759..0000000 --- a/OneBus.Application/Validators/EmployeeGarage/CreateEmployeeGarageDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.EmployeeGarage; - -namespace OneBus.Application.Validators.EmployeeGarage -{ - public class CreateEmployeeGarageDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/EmployeeGarage/UpdateEmployeeGarageDTOValidator.cs b/OneBus.Application/Validators/EmployeeGarage/UpdateEmployeeGarageDTOValidator.cs deleted file mode 100644 index 1ad9102..0000000 --- a/OneBus.Application/Validators/EmployeeGarage/UpdateEmployeeGarageDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.EmployeeGarage; - -namespace OneBus.Application.Validators.EmployeeGarage -{ - public class UpdateEmployeeGarageDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/Garage/CreateGarageDTOValidator.cs b/OneBus.Application/Validators/Garage/CreateGarageDTOValidator.cs deleted file mode 100644 index 0f699eb..0000000 --- a/OneBus.Application/Validators/Garage/CreateGarageDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.Garage; - -namespace OneBus.Application.Validators.Garage -{ - public class CreateGarageDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/Garage/UpdateGarageDTOValidator.cs b/OneBus.Application/Validators/Garage/UpdateGarageDTOValidator.cs deleted file mode 100644 index da688cf..0000000 --- a/OneBus.Application/Validators/Garage/UpdateGarageDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.Garage; - -namespace OneBus.Application.Validators.Garage -{ - public class UpdateGarageDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/LineAddress/CreateLineAddressDTOValidator.cs b/OneBus.Application/Validators/LineAddress/CreateLineAddressDTOValidator.cs deleted file mode 100644 index 11fca20..0000000 --- a/OneBus.Application/Validators/LineAddress/CreateLineAddressDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.LineAddress; - -namespace OneBus.Application.Validators.LineAddress -{ - public class CreateLineAddressDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/LineAddress/UpdateLineAddressDTOValidator.cs b/OneBus.Application/Validators/LineAddress/UpdateLineAddressDTOValidator.cs deleted file mode 100644 index df7f499..0000000 --- a/OneBus.Application/Validators/LineAddress/UpdateLineAddressDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.LineAddress; - -namespace OneBus.Application.Validators.LineAddress -{ - public class UpdateLineAddressDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/LineTariff/CreateLineTariffDTOValidator.cs b/OneBus.Application/Validators/LineTariff/CreateLineTariffDTOValidator.cs deleted file mode 100644 index 74a2165..0000000 --- a/OneBus.Application/Validators/LineTariff/CreateLineTariffDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.LineTariff; - -namespace OneBus.Application.Validators.LineTariff -{ - public class CreateLineTariffDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/LineTariff/UpdateLineTariffDTOValidator.cs b/OneBus.Application/Validators/LineTariff/UpdateLineTariffDTOValidator.cs deleted file mode 100644 index 7319202..0000000 --- a/OneBus.Application/Validators/LineTariff/UpdateLineTariffDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.LineTariff; - -namespace OneBus.Application.Validators.LineTariff -{ - public class UpdateLineTariffDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/LineTariffAudit/CreateLineTariffAuditDTOValidator.cs b/OneBus.Application/Validators/LineTariffAudit/CreateLineTariffAuditDTOValidator.cs deleted file mode 100644 index f7b7198..0000000 --- a/OneBus.Application/Validators/LineTariffAudit/CreateLineTariffAuditDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.LineTariffAudit; - -namespace OneBus.Application.Validators.LineTariffAudit -{ - public class CreateLineTariffAuditDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/LineTariffAudit/UpdateLineTariffAuditDTOValidator.cs b/OneBus.Application/Validators/LineTariffAudit/UpdateLineTariffAuditDTOValidator.cs deleted file mode 100644 index 943f6f9..0000000 --- a/OneBus.Application/Validators/LineTariffAudit/UpdateLineTariffAuditDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.LineTariffAudit; - -namespace OneBus.Application.Validators.LineTariffAudit -{ - public class UpdateLineTariffAuditDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/Stop/CreateStopDTOValidator.cs b/OneBus.Application/Validators/Stop/CreateStopDTOValidator.cs deleted file mode 100644 index d590a77..0000000 --- a/OneBus.Application/Validators/Stop/CreateStopDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.Stop; - -namespace OneBus.Application.Validators.Stop -{ - public class CreateStopDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/Stop/UpdateStopDTOValidator.cs b/OneBus.Application/Validators/Stop/UpdateStopDTOValidator.cs deleted file mode 100644 index 971357a..0000000 --- a/OneBus.Application/Validators/Stop/UpdateStopDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.Stop; - -namespace OneBus.Application.Validators.Stop -{ - public class UpdateStopDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/StopTime/CreateStopTimeDTOValidator.cs b/OneBus.Application/Validators/StopTime/CreateStopTimeDTOValidator.cs deleted file mode 100644 index 52037ae..0000000 --- a/OneBus.Application/Validators/StopTime/CreateStopTimeDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.StopTime; - -namespace OneBus.Application.Validators.StopTime -{ - public class CreateStopTimeDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/StopTime/UpdateStopTimeDTOValidator.cs b/OneBus.Application/Validators/StopTime/UpdateStopTimeDTOValidator.cs deleted file mode 100644 index a74f371..0000000 --- a/OneBus.Application/Validators/StopTime/UpdateStopTimeDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.StopTime; - -namespace OneBus.Application.Validators.StopTime -{ - public class UpdateStopTimeDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/UserType/CreateUserTypeDTOValidator.cs b/OneBus.Application/Validators/UserType/CreateUserTypeDTOValidator.cs deleted file mode 100644 index d0bc07f..0000000 --- a/OneBus.Application/Validators/UserType/CreateUserTypeDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.UserType; - -namespace OneBus.Application.Validators.UserType -{ - public class CreateUserTypeDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/UserType/UpdateUserTypeDTOValidator.cs b/OneBus.Application/Validators/UserType/UpdateUserTypeDTOValidator.cs deleted file mode 100644 index 0e6a684..0000000 --- a/OneBus.Application/Validators/UserType/UpdateUserTypeDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.UserType; - -namespace OneBus.Application.Validators.UserType -{ - public class UpdateUserTypeDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/UserTypeFeature/CreateUserTypeFeatureDTOValidator.cs b/OneBus.Application/Validators/UserTypeFeature/CreateUserTypeFeatureDTOValidator.cs deleted file mode 100644 index 7a28c5e..0000000 --- a/OneBus.Application/Validators/UserTypeFeature/CreateUserTypeFeatureDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.UserTypeFeature; - -namespace OneBus.Application.Validators.UserTypeFeature -{ - public class CreateUserTypeFeatureDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/UserTypeFeature/UpdateUserTypeFeatureDTOValidator.cs b/OneBus.Application/Validators/UserTypeFeature/UpdateUserTypeFeatureDTOValidator.cs deleted file mode 100644 index 1f1e249..0000000 --- a/OneBus.Application/Validators/UserTypeFeature/UpdateUserTypeFeatureDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.UserTypeFeature; - -namespace OneBus.Application.Validators.UserTypeFeature -{ - public class UpdateUserTypeFeatureDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/VehicleGarage/CreateVehicleGarageDTOValidator.cs b/OneBus.Application/Validators/VehicleGarage/CreateVehicleGarageDTOValidator.cs deleted file mode 100644 index fa88004..0000000 --- a/OneBus.Application/Validators/VehicleGarage/CreateVehicleGarageDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.VehicleGarage; - -namespace OneBus.Application.Validators.VehicleGarage -{ - public class CreateVehicleGarageDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Application/Validators/VehicleGarage/UpdateVehicleGarageDTOValidator.cs b/OneBus.Application/Validators/VehicleGarage/UpdateVehicleGarageDTOValidator.cs deleted file mode 100644 index fb2d5b5..0000000 --- a/OneBus.Application/Validators/VehicleGarage/UpdateVehicleGarageDTOValidator.cs +++ /dev/null @@ -1,9 +0,0 @@ -using FluentValidation; -using OneBus.Application.DTOs.VehicleGarage; - -namespace OneBus.Application.Validators.VehicleGarage -{ - public class UpdateVehicleGarageDTOValidator : AbstractValidator - { - } -} diff --git a/OneBus.Domain/Constants/FeaturesCode.cs b/OneBus.Domain/Constants/FeaturesCode.cs deleted file mode 100644 index bcc33b2..0000000 --- a/OneBus.Domain/Constants/FeaturesCode.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace OneBus.Domain.Constants -{ - public static class FeaturesCode - { - public const byte UpdateUserCode = 1; - } -} diff --git a/OneBus.Domain/Constants/PolicyConstants.cs b/OneBus.Domain/Constants/PolicyConstants.cs deleted file mode 100644 index 69e4f4f..0000000 --- a/OneBus.Domain/Constants/PolicyConstants.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace OneBus.Domain.Constants -{ - public static class PolicyConstants - { - public const string UpdateUser = "Permission.UpdateUser"; - } -} diff --git a/OneBus.Domain/Entities/Address.cs b/OneBus.Domain/Entities/Address.cs deleted file mode 100644 index 26c25c8..0000000 --- a/OneBus.Domain/Entities/Address.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities -{ - [NotMapped] - public class Address : BaseEntity - { - public Address() - { - Area = string.Empty; - PostCode = string.Empty; - City = string.Empty; - State = string.Empty; - Number = string.Empty; - } - - public string Area { get; set; } - - public string PostCode { get; set; } - - public string City { get; set; } - - public string State { get; set; } - - public string? Number { get; set; } - - public string? Complement { get; set; } - - public ICollection? Companies { get; set; } - - public ICollection? Employees { get; set; } - - public ICollection? Garages { get; set; } - - public ICollection? LineAddresses { get; set; } - } -} diff --git a/OneBus.Domain/Entities/BusAudit.cs b/OneBus.Domain/Entities/BusAudit.cs deleted file mode 100644 index 5ccc3e8..0000000 --- a/OneBus.Domain/Entities/BusAudit.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities -{ - [NotMapped] - public class BusAudit : BaseEntity - { - public ulong EmployeeId { get; set; } - - public ulong BusId { get; set; } - - public DateOnly Date { get; set; } - - public ulong TotalPassengers { get; set; } - - public ulong TotalPassengersToday { get; set; } - - public decimal TotalMileage { get; set; } - - public decimal TotalMileageToday { get; set; } - - public Employee? Employee { get; set; } - - public Bus? Bus { get; set; } - } -} diff --git a/OneBus.Domain/Entities/Company.cs b/OneBus.Domain/Entities/Company.cs deleted file mode 100644 index 09449aa..0000000 --- a/OneBus.Domain/Entities/Company.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities -{ - [NotMapped] - public class Company : BaseEntity - { - public Company() - { - Name = string.Empty; - Cnpj = string.Empty; - Email = string.Empty; - Phone = string.Empty; - } - - public ulong AddressId { get; set; } - - public string Name { get; set; } - - public string Cnpj { get; set; } - - public string Email { get; set; } - - public string Phone { get; set; } - - public string? Image { get; set; } - - public Address? Address { get; set; } - - public ICollection? UserTypes { get; set; } - - public ICollection? Garages { get; set; } - - public ICollection? Lines { get; set; } - } -} diff --git a/OneBus.Domain/Entities/EmployeeGarage.cs b/OneBus.Domain/Entities/EmployeeGarage.cs deleted file mode 100644 index 12237f0..0000000 --- a/OneBus.Domain/Entities/EmployeeGarage.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities -{ - [NotMapped] - public class EmployeeGarage : BaseEntity - { - public ulong EmployeeId { get; set; } - - public ulong GarageId { get; set; } - - public Employee? Employee { get; set; } - - public Garage? Garage { get; set; } - } -} diff --git a/OneBus.Domain/Entities/Entities.cd b/OneBus.Domain/Entities/Entities.cd deleted file mode 100644 index 49fabaa..0000000 --- a/OneBus.Domain/Entities/Entities.cd +++ /dev/null @@ -1,265 +0,0 @@ - - - - - - AAACAAAAAAAAAAAAACAACAAAAAAAAgAAAAAgAAAAAAA= - Entities\BaseEntity.cs - - - - - - AAAAAAAAAAAAAAAIBEAAAAAACIAwAAAAAAAAhQAAAAA= - Entities\Address.cs - - - - - - AAAJAAAAAAAAAACCAAAAABAABAAAgAAAQAAJAAAAAEA= - Entities\Bus.cs - - - - - - AAIAAAIAAAAEAAAAAAAAAAAADAAAAAABAAAQAgACAAA= - Entities\BusAudit.cs - - - - - - AAJAAABAAAAAAAAAAAAAAAAABAAAEAABAAAAAAACAAA= - Entities\BusOperation.cs - - - - - - QAAAIAAAACAAAAAAAAAAAAQAAIAACBACAAAAIAAAAAA= - Entities\Company.cs - - - - - - QAACAAAEACAAAAAAEAAwQRYAAAAAERACQABAIACAAAA= - Entities\Employee.cs - - - - - - ACAEAAAAAAAAAAAAAAAAAAAACAAAAAAAAAAAAAACAAA= - Entities\EmployeeGarage.cs - - - - - - AAAAAAAAAAAAAACAAAAAAAAAKAAgAAAAQAAAAAASAAA= - Entities\EmployeeWorkday.cs - - - - - - - - - - - - - - AAAAAAAAAAAgAAAAAAAgAAAAIAAAAAAAAAAAAAAAAAA= - Entities\Feature.cs - - - - - - QAAAAAAAAAIAAAAAAAQAAQQAAAAAABACAAAAJAAAAAA= - Entities\Garage.cs - - - - - - AAIAAABAAAIAAAAIAEAAAAwAAGAQAAAAAQAABAAAAAA= - Entities\Line.cs - - - - - - - - - - - - - - - QAABAAAAAAAAAAAAAAAAAACAAAgAAAACAAAAAAABAAA= - Entities\LineAddress.cs - - - - - - AAAAAAAAAQAAAAAAAAAAQAAAAAgAEAAAAAAAAAABAAA= - Entities\LineTariff.cs - - - - - - - - - - - - - - AAAAAAAACAAAAAAAAAABAAAACAAAAAIBAAAAAAACAAA= - Entities\LineTariffAudit.cs - - - - - - - - - - - - - - - - AAAAAAAAAAAAAACAAAAAAAAAIAggAAAAQAAAAAABAAA= - Entities\LineTime.cs - - - - - - AAAAAAAACAAgAAAAAAAAABAgBAAAgAAAAAAAAFAAAAA= - Entities\Maintenance.cs - - - - - - ACAAAAAAAEAAAAAAQAAIAAQKAAAAAAAIAAAAAAAAAAA= - Entities\Stop.cs - - - - - - - - - - - - - - - - AAAAAAAAAAAAAACAAAAAAAAAAAAEAAAAIAAAAAAAAQA= - Entities\StopTime.cs - - - - - - AABAAAAAACIAAAAAAAAAAAQAAAAACBACAAAAIAAAAAA= - Entities\User.cs - - - - - - - - - - - - - - - AAAAACAAAAIAAAAAAAAAAAQAIAAAAAAAAAAABAAAAAA= - Entities\UserType.cs - - - - - - - - - - - - - - AAAAAAAAAAIAAAQAAAAAAAQAAAAACAAAAAAACAAAAAA= - Entities\UserTypeFeature.cs - - - - - - - - - - - - - - AACAAAAEBAAgQAAAABQBAAACAGAAIBAgEQoDgAwRAgA= - Entities\Vehicle.cs - - - - - - - - - - - - - - ACAEAAAAAAAAAAAAAAAAAAAABAAAgAAAAAAAAAAAAAA= - Entities\VehicleGarage.cs - - - - - - - - - - - - - - AAAAAAAAAAAAAAAAAAAAAAAABAAAgAABABAAAAACAAA= - Entities\VehicleOperation.cs - - - - \ No newline at end of file diff --git a/OneBus.Domain/Entities/Feature.cs b/OneBus.Domain/Entities/Feature.cs deleted file mode 100644 index 07f1553..0000000 --- a/OneBus.Domain/Entities/Feature.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities -{ - [NotMapped] - public class Feature : BaseEntity - { - public Feature() - { - Description = string.Empty; - } - - public byte Code { get; set; } - - public string Description { get; set; } - - public ICollection? UserTypeFeatures { get; set; } - } -} diff --git a/OneBus.Domain/Entities/Garage.cs b/OneBus.Domain/Entities/Garage.cs deleted file mode 100644 index cf6a007..0000000 --- a/OneBus.Domain/Entities/Garage.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities -{ - [NotMapped] - public class Garage : BaseEntity - { - public Garage() - { - Name = string.Empty; - Phone = string.Empty; - } - - public ulong CompanyId { get; set; } - - public ulong AddressId { get; set; } - - public string Name { get; set; } - - public string Phone { get; set; } - - public string? Image { get; set; } - - public Company? Company { get; set; } - - public Address? Address { get; set; } - - public ICollection? EmployeeGarages { get; set; } - - public ICollection? VehicleGarages { get; set; } - } -} diff --git a/OneBus.Domain/Entities/LineAddress.cs b/OneBus.Domain/Entities/LineAddress.cs deleted file mode 100644 index 2e28644..0000000 --- a/OneBus.Domain/Entities/LineAddress.cs +++ /dev/null @@ -1,21 +0,0 @@ -using OneBus.Domain.Enums.LineAddress; -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities -{ - [NotMapped] - public class LineAddress : BaseEntity - { - public ulong LineId { get; set; } - - public ulong AddressId { get; set; } - - public DirectionLine DirectionLine { get; set; } - - public Line? Line { get; set; } - - public Address? Address { get; set; } - - public ICollection? Stops { get; set; } - } -} diff --git a/OneBus.Domain/Entities/LineTariff.cs b/OneBus.Domain/Entities/LineTariff.cs deleted file mode 100644 index 3729572..0000000 --- a/OneBus.Domain/Entities/LineTariff.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities -{ - [NotMapped] - public class LineTariff : BaseEntity - { - public ulong LineId { get; set; } - - public decimal Price { get; set; } - - public ushort NumberTickets { get; set; } - - public Line? Line { get; set; } - - public ICollection? LineTariffAudits { get; set; } - } -} diff --git a/OneBus.Domain/Entities/LineTariffAudit.cs b/OneBus.Domain/Entities/LineTariffAudit.cs deleted file mode 100644 index bdd62a2..0000000 --- a/OneBus.Domain/Entities/LineTariffAudit.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities -{ - [NotMapped] - public class LineTariffAudit : BaseEntity - { - public ulong EmployeeId { get; set; } - - public ulong LineTariffId { get; set; } - - public ushort RemainingTicketsNumber { get; set; } - - public DateOnly Date { get; set; } - - public Employee? Employee { get; set; } - - public LineTariff? LineTariff { get; set; } - } -} diff --git a/OneBus.Domain/Entities/Stop.cs b/OneBus.Domain/Entities/Stop.cs deleted file mode 100644 index 82df64f..0000000 --- a/OneBus.Domain/Entities/Stop.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities -{ - [NotMapped] - public class Stop : BaseEntity - { - public ulong LineAddressId { get; set; } - - public bool IsInitialStop { get; set; } - - public bool IsFinalStop { get; set; } - - public string? Name { get; set; } - - public decimal Latitude { get; set; } - - public decimal Longitude { get; set; } - - public LineAddress? LineAddress { get; set; } - - public ICollection? StopTimes { get; set; } - } -} diff --git a/OneBus.Domain/Entities/StopTime.cs b/OneBus.Domain/Entities/StopTime.cs deleted file mode 100644 index 5e0c9b2..0000000 --- a/OneBus.Domain/Entities/StopTime.cs +++ /dev/null @@ -1,22 +0,0 @@ -using OneBus.Domain.Enums.StopTime; -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities -{ - [NotMapped] - public class StopTime : BaseEntity - { - public StopTime() - { - Time = string.Empty; - } - - public ulong StopId { get; set; } - - public string Time { get; set; } - - public DayType DayType { get; set; } - - public Stop? Stop { get; set; } - } -} diff --git a/OneBus.Domain/Entities/UserType.cs b/OneBus.Domain/Entities/UserType.cs deleted file mode 100644 index 713d3f6..0000000 --- a/OneBus.Domain/Entities/UserType.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities -{ - [NotMapped] - public class UserType : BaseEntity - { - public UserType() - { - Name = string.Empty; - } - - public ulong CompanyId { get; set; } - - public string Name { get; set; } - - public Company? Company { get; set; } - - public ICollection? UserTypeFeatures { get; set; } - - public ICollection? Users { get; set; } - } -} diff --git a/OneBus.Domain/Entities/UserTypeFeature.cs b/OneBus.Domain/Entities/UserTypeFeature.cs deleted file mode 100644 index 9c2d51b..0000000 --- a/OneBus.Domain/Entities/UserTypeFeature.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities -{ - [NotMapped] - public class UserTypeFeature : BaseEntity - { - public ulong UserTypeId { get; set; } - - public ulong FeatureId { get; set; } - - public bool HasPermission { get; set; } - - public UserType? UserType { get; set; } - - public Feature? Feature { get; set; } - } -} diff --git a/OneBus.Domain/Entities/VehicleGarage.cs b/OneBus.Domain/Entities/VehicleGarage.cs deleted file mode 100644 index e43ff4f..0000000 --- a/OneBus.Domain/Entities/VehicleGarage.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities -{ - [NotMapped] - public class VehicleGarage : BaseEntity - { - public ulong VehicleId { get; set; } - - public ulong GarageId { get; set; } - - public Vehicle? Vehicle { get; set; } - - public Garage? Garage { get; set; } - } -} diff --git a/OneBus.Domain/Enums/Address/AreaType.cs b/OneBus.Domain/Enums/Address/AreaType.cs deleted file mode 100644 index 8949dbd..0000000 --- a/OneBus.Domain/Enums/Address/AreaType.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace OneBus.Domain.Enums.Address -{ - public enum AreaType : byte - { - Rua, - Avenida, - Rodovia, - Estrada, - Alameda, - Praça, - Viaduto, - Tunel, - Ponte - } -} diff --git a/OneBus.Domain/Enums/LineAddress/DirectionLine.cs b/OneBus.Domain/Enums/LineAddress/DirectionLine.cs deleted file mode 100644 index d9d1739..0000000 --- a/OneBus.Domain/Enums/LineAddress/DirectionLine.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace OneBus.Domain.Enums.LineAddress -{ - public enum DirectionLine : byte - { - Ida, - Volta, - Ida_Volta - } -} diff --git a/OneBus.Domain/Enums/StopTime/DayType.cs b/OneBus.Domain/Enums/StopTime/DayType.cs deleted file mode 100644 index 665fcec..0000000 --- a/OneBus.Domain/Enums/StopTime/DayType.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace OneBus.Domain.Enums.StopTime -{ - public enum DayType : byte - { - Dias_Úteis, - Sábados, - Domingos, - Feriados - } -} diff --git a/OneBus.Domain/Filters/AddressFilter.cs b/OneBus.Domain/Filters/AddressFilter.cs deleted file mode 100644 index 9f787a9..0000000 --- a/OneBus.Domain/Filters/AddressFilter.cs +++ /dev/null @@ -1,9 +0,0 @@ -using OneBus.Domain.Enums.Address; - -namespace OneBus.Domain.Filters -{ - public class AddressFilter : BaseFilter - { - public AreaType? AreaType { get; set; } - } -} diff --git a/OneBus.Domain/Interfaces/Repositories/IAddressRepository.cs b/OneBus.Domain/Interfaces/Repositories/IAddressRepository.cs deleted file mode 100644 index 7fc783b..0000000 --- a/OneBus.Domain/Interfaces/Repositories/IAddressRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Domain.Interfaces.Repositories -{ - public interface IAddressRepository : IBaseRepository - { - } -} diff --git a/OneBus.Domain/Interfaces/Repositories/IBusAuditRepository.cs b/OneBus.Domain/Interfaces/Repositories/IBusAuditRepository.cs deleted file mode 100644 index 6739a44..0000000 --- a/OneBus.Domain/Interfaces/Repositories/IBusAuditRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Domain.Interfaces.Repositories -{ - public interface IBusAuditRepository : IBaseRepository - { - } -} diff --git a/OneBus.Domain/Interfaces/Repositories/ICompanyRepository.cs b/OneBus.Domain/Interfaces/Repositories/ICompanyRepository.cs deleted file mode 100644 index 851f0bc..0000000 --- a/OneBus.Domain/Interfaces/Repositories/ICompanyRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Domain.Interfaces.Repositories -{ - public interface ICompanyRepository : IBaseRepository - { - } -} diff --git a/OneBus.Domain/Interfaces/Repositories/IEmployeeGarageRepository.cs b/OneBus.Domain/Interfaces/Repositories/IEmployeeGarageRepository.cs deleted file mode 100644 index e33cd26..0000000 --- a/OneBus.Domain/Interfaces/Repositories/IEmployeeGarageRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Domain.Interfaces.Repositories -{ - public interface IEmployeeGarageRepository : IBaseRepository - { - } -} diff --git a/OneBus.Domain/Interfaces/Repositories/IFeatureRepository.cs b/OneBus.Domain/Interfaces/Repositories/IFeatureRepository.cs deleted file mode 100644 index 191516e..0000000 --- a/OneBus.Domain/Interfaces/Repositories/IFeatureRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Domain.Interfaces.Repositories -{ - public interface IFeatureRepository : IBaseReadOnlyRepository - { - } -} diff --git a/OneBus.Domain/Interfaces/Repositories/IGarageRepository.cs b/OneBus.Domain/Interfaces/Repositories/IGarageRepository.cs deleted file mode 100644 index 271a6b8..0000000 --- a/OneBus.Domain/Interfaces/Repositories/IGarageRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Domain.Interfaces.Repositories -{ - public interface IGarageRepository : IBaseRepository - { - } -} diff --git a/OneBus.Domain/Interfaces/Repositories/ILineAddressRepository.cs b/OneBus.Domain/Interfaces/Repositories/ILineAddressRepository.cs deleted file mode 100644 index 8d634ea..0000000 --- a/OneBus.Domain/Interfaces/Repositories/ILineAddressRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Domain.Interfaces.Repositories -{ - public interface ILineAddressRepository : IBaseRepository - { - } -} diff --git a/OneBus.Domain/Interfaces/Repositories/ILineTariffAuditRepository.cs b/OneBus.Domain/Interfaces/Repositories/ILineTariffAuditRepository.cs deleted file mode 100644 index 978ea38..0000000 --- a/OneBus.Domain/Interfaces/Repositories/ILineTariffAuditRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Domain.Interfaces.Repositories -{ - public interface ILineTariffAuditRepository : IBaseRepository - { - } -} diff --git a/OneBus.Domain/Interfaces/Repositories/ILineTariffRepository.cs b/OneBus.Domain/Interfaces/Repositories/ILineTariffRepository.cs deleted file mode 100644 index 1ea2ebb..0000000 --- a/OneBus.Domain/Interfaces/Repositories/ILineTariffRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Domain.Interfaces.Repositories -{ - public interface ILineTariffRepository : IBaseRepository - { - } -} diff --git a/OneBus.Domain/Interfaces/Repositories/IStopRepository.cs b/OneBus.Domain/Interfaces/Repositories/IStopRepository.cs deleted file mode 100644 index fa01c74..0000000 --- a/OneBus.Domain/Interfaces/Repositories/IStopRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Domain.Interfaces.Repositories -{ - public interface IStopRepository : IBaseRepository - { - } -} diff --git a/OneBus.Domain/Interfaces/Repositories/IStopTimeRepository.cs b/OneBus.Domain/Interfaces/Repositories/IStopTimeRepository.cs deleted file mode 100644 index 34fa8c6..0000000 --- a/OneBus.Domain/Interfaces/Repositories/IStopTimeRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Domain.Interfaces.Repositories -{ - public interface IStopTimeRepository : IBaseRepository - { - } -} diff --git a/OneBus.Domain/Interfaces/Repositories/IUserTypeFeatureRepository.cs b/OneBus.Domain/Interfaces/Repositories/IUserTypeFeatureRepository.cs deleted file mode 100644 index eb203e0..0000000 --- a/OneBus.Domain/Interfaces/Repositories/IUserTypeFeatureRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Domain.Interfaces.Repositories -{ - public interface IUserTypeFeatureRepository : IBaseRepository - { - } -} diff --git a/OneBus.Domain/Interfaces/Repositories/IUserTypeRepository.cs b/OneBus.Domain/Interfaces/Repositories/IUserTypeRepository.cs deleted file mode 100644 index e232118..0000000 --- a/OneBus.Domain/Interfaces/Repositories/IUserTypeRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Domain.Interfaces.Repositories -{ - public interface IUserTypeRepository : IBaseRepository - { - } -} diff --git a/OneBus.Domain/Interfaces/Repositories/IVehicleGarageRepository.cs b/OneBus.Domain/Interfaces/Repositories/IVehicleGarageRepository.cs deleted file mode 100644 index be86535..0000000 --- a/OneBus.Domain/Interfaces/Repositories/IVehicleGarageRepository.cs +++ /dev/null @@ -1,9 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.Domain.Interfaces.Repositories -{ - public interface IVehicleGarageRepository : IBaseRepository - { - } -} diff --git a/OneBus.Domain/Models/EmailModel.cs b/OneBus.Domain/Models/EmailModel.cs deleted file mode 100644 index d6cbdc2..0000000 --- a/OneBus.Domain/Models/EmailModel.cs +++ /dev/null @@ -1,40 +0,0 @@ -namespace OneBus.Domain.Models -{ - public class EmailModel - { - public EmailModel() - { - To = []; - Body = string.Empty; - From = string.Empty; - Subject = string.Empty; - BodyPath = string.Empty; - FromName = string.Empty; - Variables = new Dictionary(); - } - - public string FromName { get; set; } - - public string From { get; set; } - - public string[] To { get; set; } - - public string Subject { get; set; } - - public string BodyPath { get; set; } - - public string Body { get; set; } - - public bool IsCid { get; set; } - - public string? FileName { get; set; } - - public string? FilePath { get; set; } - - public string? FileType { get; set; } - - public MemoryStream? FileStream { get; set; } - - public IDictionary Variables { get; set; } - } -} diff --git a/OneBus.Domain/Settings/EmailSettings.cs b/OneBus.Domain/Settings/EmailSettings.cs deleted file mode 100644 index 322d123..0000000 --- a/OneBus.Domain/Settings/EmailSettings.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace OneBus.Domain.Settings -{ - public class EmailSettings - { - public EmailSettings() - { - MailUser = string.Empty; - MailPassword = string.Empty; - MailHost = string.Empty; - MailPort = string.Empty; - MailEnableSsl = string.Empty; - } - - // SMTP Mail Service Configuration - public string MailUser { get; set; } - - public string MailPassword { get; set; } - - public string MailHost { get; set; } - - public string MailPort { get; set; } - - public string MailEnableSsl { get; set; } - } -} diff --git a/OneBus.Infra.Data/Extensions/PredicateExtensions.cs b/OneBus.Infra.Data/Extensions/PredicateExtensions.cs deleted file mode 100644 index 27a7950..0000000 --- a/OneBus.Infra.Data/Extensions/PredicateExtensions.cs +++ /dev/null @@ -1,13 +0,0 @@ -using OneBus.Domain.Entities; - -namespace OneBus.Infra.Data.Extensions -{ - public static class PredicateExtensions - { - public static Predicate AndApply(this Predicate predicate, Predicate newPredicate) - where TEntity : BaseEntity - { - return c => predicate(c) && newPredicate(c); - } - } -} diff --git a/OneBus.Infra.Data/Mappings/AddressMapping.cs b/OneBus.Infra.Data/Mappings/AddressMapping.cs deleted file mode 100644 index 251d547..0000000 --- a/OneBus.Infra.Data/Mappings/AddressMapping.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using OneBus.Domain.Entities; - -namespace OneBus.Infra.Data.Mappings -{ - public class AddressMapping : BaseEntityMapping
- { - public override void Configure(EntityTypeBuilder
builder) - { - builder.ToTable("Endereco"); - base.Configure(builder); - - builder.Property(c => c.State).HasColumnName("Estado").HasMaxLength(4); - builder.Property(c => c.PostCode).HasColumnName("Cep").HasMaxLength(15); - builder.Property(c => c.City).HasColumnName("Municipio").HasMaxLength(50); - builder.Property(c => c.Area).HasColumnName("Logradouro").HasMaxLength(100); - builder.Property(c => c.Number).HasColumnName("Numero").HasMaxLength(30); - builder.Property(c => c.Complement).HasColumnName("Complemento").HasMaxLength(50); - - builder.HasIndex(c => c.PostCode); - } - } -} diff --git a/OneBus.Infra.Data/Mappings/BusAuditMapping.cs b/OneBus.Infra.Data/Mappings/BusAuditMapping.cs deleted file mode 100644 index dd625c6..0000000 --- a/OneBus.Infra.Data/Mappings/BusAuditMapping.cs +++ /dev/null @@ -1,33 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using OneBus.Domain.Entities; - -namespace OneBus.Infra.Data.Mappings -{ - public class BusAuditMapping : BaseEntityMapping - { - public override void Configure(EntityTypeBuilder builder) - { - builder.ToTable("OnibusAuditoria"); - base.Configure(builder); - - builder.Property(c => c.Date).HasColumnName("Data"); - builder.Property(c => c.BusId).HasColumnName("OnibusId"); - builder.Property(c => c.EmployeeId).HasColumnName("FuncionarioId"); - builder.Property(c => c.TotalMileage).HasColumnName("TotalQuilometragem"); - builder.Property(c => c.TotalPassengers).HasColumnName("TotalPassageiros"); - builder.Property(c => c.TotalMileageToday).HasColumnName("TotalQuilometragemDia"); - builder.Property(c => c.TotalPassengersToday).HasColumnName("TotalPassageirosDia"); - - builder - .HasOne(c => c.Employee) - .WithMany(c => c.BusAudits) - .HasForeignKey(c => c.EmployeeId); - - builder - .HasOne(c => c.Bus) - .WithMany(c => c.BusAudits) - .HasForeignKey(c => c.BusId); - } - } -} diff --git a/OneBus.Infra.Data/Mappings/CompanyMapping.cs b/OneBus.Infra.Data/Mappings/CompanyMapping.cs deleted file mode 100644 index 4b84783..0000000 --- a/OneBus.Infra.Data/Mappings/CompanyMapping.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using OneBus.Domain.Entities; - -namespace OneBus.Infra.Data.Mappings -{ - public class CompanyMapping : BaseEntityMapping - { - public override void Configure(EntityTypeBuilder builder) - { - builder.ToTable("Empresa"); - base.Configure(builder); - - builder.Property(c => c.Cnpj).HasMaxLength(20); - builder.Property(c => c.Email).HasMaxLength(80); - builder.Property(c => c.AddressId).HasColumnName("EnderecoId"); - builder.Property(c => c.Name).HasColumnName("Nome").HasMaxLength(80); - builder.Property(c => c.Image).HasColumnName("Foto").HasMaxLength(20); - builder.Property(c => c.Phone).HasColumnName("Telefone").HasMaxLength(20); - - builder.HasIndex(c => c.Cnpj); - builder.HasIndex(c => c.Email); - - builder - .HasOne(c => c.Address) - .WithMany(c => c.Companies) - .HasForeignKey(c => c.AddressId); - } - } -} diff --git a/OneBus.Infra.Data/Mappings/EmployeeGarageMapping.cs b/OneBus.Infra.Data/Mappings/EmployeeGarageMapping.cs deleted file mode 100644 index 240b215..0000000 --- a/OneBus.Infra.Data/Mappings/EmployeeGarageMapping.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using OneBus.Domain.Entities; - -namespace OneBus.Infra.Data.Mappings -{ - public class EmployeeGarageMapping : BaseEntityMapping - { - public override void Configure(EntityTypeBuilder builder) - { - builder.ToTable("FuncionarioGaragem"); - base.Configure(builder); - - builder.Property(c => c.GarageId).HasColumnName("GaragemId"); - builder.Property(c => c.EmployeeId).HasColumnName("FuncionarioId"); - - builder - .HasOne(c => c.Garage) - .WithMany(c => c.EmployeeGarages) - .HasForeignKey(c => c.GarageId); - - builder - .HasOne(c => c.Employee) - .WithMany(c => c.EmployeeGarages) - .HasForeignKey(c => c.EmployeeId); - } - } -} diff --git a/OneBus.Infra.Data/Mappings/FeatureMapping.cs b/OneBus.Infra.Data/Mappings/FeatureMapping.cs deleted file mode 100644 index 7e6812d..0000000 --- a/OneBus.Infra.Data/Mappings/FeatureMapping.cs +++ /dev/null @@ -1,21 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using OneBus.Domain.Entities; - -namespace OneBus.Infra.Data.Mappings -{ - public class FeatureMapping : BaseEntityMapping - { - public override void Configure(EntityTypeBuilder builder) - { - builder.ToTable("Funcionalidade"); - base.Configure(builder); - - builder.Property(c => c.Code).HasColumnName("Codigo"); - builder.Property(c => c.Description).HasColumnName("Descricao").HasMaxLength(80); - - builder.HasIndex(c => c.Code); - builder.HasIndex(c => c.Description); - } - } -} diff --git a/OneBus.Infra.Data/Mappings/GarageMapping.cs b/OneBus.Infra.Data/Mappings/GarageMapping.cs deleted file mode 100644 index d3b541b..0000000 --- a/OneBus.Infra.Data/Mappings/GarageMapping.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using OneBus.Domain.Entities; - -namespace OneBus.Infra.Data.Mappings -{ - public class GarageMapping : BaseEntityMapping - { - public override void Configure(EntityTypeBuilder builder) - { - builder.ToTable("Garagem"); - base.Configure(builder); - - builder.Property(c => c.CompanyId).HasColumnName("EmpresaId"); - builder.Property(c => c.AddressId).HasColumnName("EnderecoId"); - builder.Property(c => c.Name).HasColumnName("Nome").HasMaxLength(80); - builder.Property(c => c.Image).HasColumnName("Foto").HasMaxLength(20); - builder.Property(c => c.Phone).HasColumnName("Telefone").HasMaxLength(20); - - builder - .HasOne(c => c.Company) - .WithMany(c => c.Garages) - .HasForeignKey(c => c.CompanyId); - - builder - .HasOne(c => c.Address) - .WithMany(c => c.Garages) - .HasForeignKey(c => c.AddressId); - } - } -} diff --git a/OneBus.Infra.Data/Mappings/LineAddressMapping.cs b/OneBus.Infra.Data/Mappings/LineAddressMapping.cs deleted file mode 100644 index 747808c..0000000 --- a/OneBus.Infra.Data/Mappings/LineAddressMapping.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using OneBus.Domain.Entities; - -namespace OneBus.Infra.Data.Mappings -{ - public class LineAddressMapping : BaseEntityMapping - { - public override void Configure(EntityTypeBuilder builder) - { - builder.ToTable("LinhaEndereco"); - base.Configure(builder); - - builder.Property(c => c.LineId).HasColumnName("LinhaId"); - builder.Property(c => c.AddressId).HasColumnName("EnderecoId"); - builder.Property(c => c.DirectionLine).HasColumnName("SentidoLinha").HasConversion(); - - builder - .HasOne(c => c.Line) - .WithMany(c => c.LineAddresses) - .HasForeignKey(c => c.LineId); - - builder - .HasOne(c => c.Address) - .WithMany(c => c.LineAddresses) - .HasForeignKey(c => c.AddressId); - } - } -} diff --git a/OneBus.Infra.Data/Mappings/LineTariffAuditMapping.cs b/OneBus.Infra.Data/Mappings/LineTariffAuditMapping.cs deleted file mode 100644 index 04159f1..0000000 --- a/OneBus.Infra.Data/Mappings/LineTariffAuditMapping.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using OneBus.Domain.Entities; - -namespace OneBus.Infra.Data.Mappings -{ - public class LineTariffAuditMapping : BaseEntityMapping - { - public override void Configure(EntityTypeBuilder builder) - { - builder.ToTable("LinhaTarifaAuditoria"); - base.Configure(builder); - - builder.Property(c => c.Date).HasColumnName("Data"); - builder.Property(c => c.EmployeeId).HasColumnName("FuncionarioId"); - builder.Property(c => c.LineTariffId).HasColumnName("LinhaTarifaId"); - builder.Property(c => c.RemainingTicketsNumber).HasColumnName("NumeroRestanteBilhetes"); - - builder - .HasOne(c => c.Employee) - .WithMany(c => c.LineTariffAudits) - .HasForeignKey(c => c.EmployeeId); - } - } -} diff --git a/OneBus.Infra.Data/Mappings/LineTariffMapping.cs b/OneBus.Infra.Data/Mappings/LineTariffMapping.cs deleted file mode 100644 index a9a19de..0000000 --- a/OneBus.Infra.Data/Mappings/LineTariffMapping.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using OneBus.Domain.Entities; - -namespace OneBus.Infra.Data.Mappings -{ - public class LineTariffMapping : BaseEntityMapping - { - public override void Configure(EntityTypeBuilder builder) - { - builder.ToTable("LinhaTarifa"); - base.Configure(builder); - - builder.Property(c => c.LineId).HasColumnName("LinhaId"); - builder.Property(c => c.Price).HasColumnName("Preco"); - builder.Property(c => c.NumberTickets).HasColumnName("NumeroBilhetes"); - - builder - .HasOne(c => c.Line) - .WithMany(c => c.LineTariffs) - .HasForeignKey(c => c.LineId); - } - } -} diff --git a/OneBus.Infra.Data/Mappings/StopMapping.cs b/OneBus.Infra.Data/Mappings/StopMapping.cs deleted file mode 100644 index 06aed99..0000000 --- a/OneBus.Infra.Data/Mappings/StopMapping.cs +++ /dev/null @@ -1,25 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using OneBus.Domain.Entities; - -namespace OneBus.Infra.Data.Mappings -{ - public class StopMapping : BaseEntityMapping - { - public override void Configure(EntityTypeBuilder builder) - { - builder.ToTable("Parada"); - base.Configure(builder); - - builder.Property(c => c.IsFinalStop).HasColumnName("PontoFinal"); - builder.Property(c => c.IsInitialStop).HasColumnName("PontoInicial"); - builder.Property(c => c.Name).HasColumnName("Nome").HasMaxLength(50); - builder.Property(c => c.LineAddressId).HasColumnName("LinhaEnderecoId"); - - builder - .HasOne(c => c.LineAddress) - .WithMany(c => c.Stops) - .HasForeignKey(c => c.LineAddressId); - } - } -} diff --git a/OneBus.Infra.Data/Mappings/StopTimeMapping.cs b/OneBus.Infra.Data/Mappings/StopTimeMapping.cs deleted file mode 100644 index 777d0c9..0000000 --- a/OneBus.Infra.Data/Mappings/StopTimeMapping.cs +++ /dev/null @@ -1,24 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using OneBus.Domain.Entities; - -namespace OneBus.Infra.Data.Mappings -{ - public class StopTimeMapping : BaseEntityMapping - { - public override void Configure(EntityTypeBuilder builder) - { - builder.ToTable("ParadaHorario"); - base.Configure(builder); - - builder.Property(c => c.StopId).HasColumnName("ParadaId"); - builder.Property(c => c.Time).HasColumnName("Horario").HasMaxLength(100); - builder.Property(c => c.DayType).HasColumnName("Dia").HasConversion(); - - builder - .HasOne(c => c.Stop) - .WithMany(c => c.StopTimes) - .HasForeignKey(c => c.StopId); - } - } -} diff --git a/OneBus.Infra.Data/Mappings/UserTypeFeatureMapping.cs b/OneBus.Infra.Data/Mappings/UserTypeFeatureMapping.cs deleted file mode 100644 index 633b37e..0000000 --- a/OneBus.Infra.Data/Mappings/UserTypeFeatureMapping.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using OneBus.Domain.Entities; - -namespace OneBus.Infra.Data.Mappings -{ - public class UserTypeFeatureMapping : BaseEntityMapping - { - public override void Configure(EntityTypeBuilder builder) - { - builder.ToTable("TipoUsuarioFuncionalidade"); - base.Configure(builder); - - builder.Property(c => c.UserTypeId).HasColumnName("TipoUsuarioId"); - builder.Property(c => c.FeatureId).HasColumnName("FuncionalidadeId"); - builder.Property(c => c.HasPermission).HasColumnName("TemPermissao"); - - builder - .HasOne(c => c.UserType) - .WithMany(c => c.UserTypeFeatures) - .HasForeignKey(c => c.UserTypeId); - - builder - .HasOne(c => c.Feature) - .WithMany(c => c.UserTypeFeatures) - .HasForeignKey(c => c.FeatureId); - } - } -} diff --git a/OneBus.Infra.Data/Mappings/UserTypeMapping.cs b/OneBus.Infra.Data/Mappings/UserTypeMapping.cs deleted file mode 100644 index 5fe14fa..0000000 --- a/OneBus.Infra.Data/Mappings/UserTypeMapping.cs +++ /dev/null @@ -1,23 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using OneBus.Domain.Entities; - -namespace OneBus.Infra.Data.Mappings -{ - public class UserTypeMapping : BaseEntityMapping - { - public override void Configure(EntityTypeBuilder builder) - { - builder.ToTable("TipoUsuario"); - base.Configure(builder); - - builder.Property(c => c.CompanyId).HasColumnName("EmpresaId"); - builder.Property(c => c.Name).HasColumnName("Nome").HasMaxLength(30); - - builder - .HasOne(c => c.Company) - .WithMany(c => c.UserTypes) - .HasForeignKey(c => c.CompanyId); - } - } -} diff --git a/OneBus.Infra.Data/Mappings/VehicleGarageMapping.cs b/OneBus.Infra.Data/Mappings/VehicleGarageMapping.cs deleted file mode 100644 index 9b15fd7..0000000 --- a/OneBus.Infra.Data/Mappings/VehicleGarageMapping.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; -using OneBus.Domain.Entities; - -namespace OneBus.Infra.Data.Mappings -{ - public class VehicleGarageMapping : BaseEntityMapping - { - public override void Configure(EntityTypeBuilder builder) - { - builder.ToTable("VeiculoGaragem"); - base.Configure(builder); - - builder.Property(c => c.GarageId).HasColumnName("GaragemId"); - builder.Property(c => c.VehicleId).HasColumnName("VeiculoId"); - - builder - .HasOne(c => c.Garage) - .WithMany(c => c.VehicleGarages) - .HasForeignKey(c => c.GarageId); - - builder - .HasOne(c => c.Vehicle) - .WithMany(c => c.VehicleGarages) - .HasForeignKey(c => c.VehicleId); - } - } -} diff --git a/OneBus.Infra.Data/Repositories/AddressRepository.cs b/OneBus.Infra.Data/Repositories/AddressRepository.cs deleted file mode 100644 index a967d9e..0000000 --- a/OneBus.Infra.Data/Repositories/AddressRepository.cs +++ /dev/null @@ -1,20 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; -using OneBus.Infra.Data.DbContexts; -using OneBus.Infra.Data.Extensions; - -namespace OneBus.Infra.Data.Repositories -{ - public class AddressRepository : BaseRepository, IAddressRepository - { - public AddressRepository(OneBusDbContext dbContext) : base(dbContext) { } - - protected override Predicate
ApplyFilter(AddressFilter filter) - { - return base - .ApplyFilter(filter) - .AndApply(c => filter.AreaType == null || c.Area.ToLower().Contains(filter.AreaType.ToString()!)); - } - } -} diff --git a/OneBus.Infra.Data/Repositories/BusAuditRepository.cs b/OneBus.Infra.Data/Repositories/BusAuditRepository.cs deleted file mode 100644 index dc1336a..0000000 --- a/OneBus.Infra.Data/Repositories/BusAuditRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; -using OneBus.Infra.Data.DbContexts; - -namespace OneBus.Infra.Data.Repositories -{ - public class BusAuditRepository : BaseRepository, IBusAuditRepository - { - public BusAuditRepository(OneBusDbContext dbContext) : base(dbContext) - { - } - } -} diff --git a/OneBus.Infra.Data/Repositories/CompanyRepository.cs b/OneBus.Infra.Data/Repositories/CompanyRepository.cs deleted file mode 100644 index 1e122f7..0000000 --- a/OneBus.Infra.Data/Repositories/CompanyRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; -using OneBus.Infra.Data.DbContexts; - -namespace OneBus.Infra.Data.Repositories -{ - public class CompanyRepository : BaseRepository, ICompanyRepository - { - public CompanyRepository(OneBusDbContext dbContext) : base(dbContext) - { - } - } -} diff --git a/OneBus.Infra.Data/Repositories/EmployeeGarageRepository.cs b/OneBus.Infra.Data/Repositories/EmployeeGarageRepository.cs deleted file mode 100644 index 32f3b0b..0000000 --- a/OneBus.Infra.Data/Repositories/EmployeeGarageRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; -using OneBus.Infra.Data.DbContexts; - -namespace OneBus.Infra.Data.Repositories -{ - public class EmployeeGarageRepository : BaseRepository, IEmployeeGarageRepository - { - public EmployeeGarageRepository(OneBusDbContext dbContext) : base(dbContext) - { - } - } -} diff --git a/OneBus.Infra.Data/Repositories/FeatureRepository.cs b/OneBus.Infra.Data/Repositories/FeatureRepository.cs deleted file mode 100644 index 9b4686a..0000000 --- a/OneBus.Infra.Data/Repositories/FeatureRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; -using OneBus.Infra.Data.DbContexts; - -namespace OneBus.Infra.Data.Repositories -{ - public class FeatureRepository : BaseReadOnlyRepository, IFeatureRepository - { - public FeatureRepository(OneBusDbContext dbContext) : base(dbContext) - { - } - } -} diff --git a/OneBus.Infra.Data/Repositories/GarageRepository.cs b/OneBus.Infra.Data/Repositories/GarageRepository.cs deleted file mode 100644 index 8f5ea73..0000000 --- a/OneBus.Infra.Data/Repositories/GarageRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; -using OneBus.Infra.Data.DbContexts; - -namespace OneBus.Infra.Data.Repositories -{ - public class GarageRepository : BaseRepository, IGarageRepository - { - public GarageRepository(OneBusDbContext dbContext) : base(dbContext) - { - } - } -} diff --git a/OneBus.Infra.Data/Repositories/LineAddressRepository.cs b/OneBus.Infra.Data/Repositories/LineAddressRepository.cs deleted file mode 100644 index 1a348f7..0000000 --- a/OneBus.Infra.Data/Repositories/LineAddressRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; -using OneBus.Infra.Data.DbContexts; - -namespace OneBus.Infra.Data.Repositories -{ - public class LineAddressRepository : BaseRepository, ILineAddressRepository - { - public LineAddressRepository(OneBusDbContext dbContext) : base(dbContext) - { - } - } -} diff --git a/OneBus.Infra.Data/Repositories/LineTariffAuditRepository.cs b/OneBus.Infra.Data/Repositories/LineTariffAuditRepository.cs deleted file mode 100644 index d5fab8e..0000000 --- a/OneBus.Infra.Data/Repositories/LineTariffAuditRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; -using OneBus.Infra.Data.DbContexts; - -namespace OneBus.Infra.Data.Repositories -{ - public class LineTariffAuditRepository : BaseRepository, ILineTariffAuditRepository - { - public LineTariffAuditRepository(OneBusDbContext dbContext) : base(dbContext) - { - } - } -} diff --git a/OneBus.Infra.Data/Repositories/LineTariffRepository.cs b/OneBus.Infra.Data/Repositories/LineTariffRepository.cs deleted file mode 100644 index ac84099..0000000 --- a/OneBus.Infra.Data/Repositories/LineTariffRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; -using OneBus.Infra.Data.DbContexts; - -namespace OneBus.Infra.Data.Repositories -{ - public class LineTariffRepository : BaseRepository, ILineTariffRepository - { - public LineTariffRepository(OneBusDbContext dbContext) : base(dbContext) - { - } - } -} diff --git a/OneBus.Infra.Data/Repositories/StopRepository.cs b/OneBus.Infra.Data/Repositories/StopRepository.cs deleted file mode 100644 index 8484e33..0000000 --- a/OneBus.Infra.Data/Repositories/StopRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; -using OneBus.Infra.Data.DbContexts; - -namespace OneBus.Infra.Data.Repositories -{ - public class StopRepository : BaseRepository, IStopRepository - { - public StopRepository(OneBusDbContext dbContext) : base(dbContext) - { - } - } -} diff --git a/OneBus.Infra.Data/Repositories/StopTimeRepository.cs b/OneBus.Infra.Data/Repositories/StopTimeRepository.cs deleted file mode 100644 index a5003cc..0000000 --- a/OneBus.Infra.Data/Repositories/StopTimeRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; -using OneBus.Infra.Data.DbContexts; - -namespace OneBus.Infra.Data.Repositories -{ - public class StopTimeRepository : BaseRepository, IStopTimeRepository - { - public StopTimeRepository(OneBusDbContext dbContext) : base(dbContext) - { - } - } -} diff --git a/OneBus.Infra.Data/Repositories/UserTypeFeatureRepository.cs b/OneBus.Infra.Data/Repositories/UserTypeFeatureRepository.cs deleted file mode 100644 index 92addf8..0000000 --- a/OneBus.Infra.Data/Repositories/UserTypeFeatureRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; -using OneBus.Infra.Data.DbContexts; - -namespace OneBus.Infra.Data.Repositories -{ - public class UserTypeFeatureRepository : BaseRepository, IUserTypeFeatureRepository - { - public UserTypeFeatureRepository(OneBusDbContext dbContext) : base(dbContext) - { - } - } -} diff --git a/OneBus.Infra.Data/Repositories/UserTypeRepository.cs b/OneBus.Infra.Data/Repositories/UserTypeRepository.cs deleted file mode 100644 index ae895a4..0000000 --- a/OneBus.Infra.Data/Repositories/UserTypeRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; -using OneBus.Infra.Data.DbContexts; - -namespace OneBus.Infra.Data.Repositories -{ - public class UserTypeRepository : BaseRepository, IUserTypeRepository - { - public UserTypeRepository(OneBusDbContext dbContext) : base(dbContext) - { - } - } -} diff --git a/OneBus.Infra.Data/Repositories/VehicleGarageRepository.cs b/OneBus.Infra.Data/Repositories/VehicleGarageRepository.cs deleted file mode 100644 index 9a5c61f..0000000 --- a/OneBus.Infra.Data/Repositories/VehicleGarageRepository.cs +++ /dev/null @@ -1,14 +0,0 @@ -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Domain.Interfaces.Repositories; -using OneBus.Infra.Data.DbContexts; - -namespace OneBus.Infra.Data.Repositories -{ - public class VehicleGarageRepository : BaseRepository, IVehicleGarageRepository - { - public VehicleGarageRepository(OneBusDbContext dbContext) : base(dbContext) - { - } - } -} From 2d7bd92b89d05f7ea5c9ab690da507783d5d4ba5 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 00:23:14 -0300 Subject: [PATCH 24/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20On?= =?UTF-8?q?eBus.API=20project?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing Assets folder --- OneBus.API/OneBus.API.csproj | 5 ----- 1 file changed, 5 deletions(-) diff --git a/OneBus.API/OneBus.API.csproj b/OneBus.API/OneBus.API.csproj index fccf323..cda3555 100644 --- a/OneBus.API/OneBus.API.csproj +++ b/OneBus.API/OneBus.API.csproj @@ -38,9 +38,4 @@ - - - - - From 2282032e835d32c6cde851c7d0b44fbb2fe9a282 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 00:23:38 -0300 Subject: [PATCH 25/41] =?UTF-8?q?=E2=9C=A8feat:=20Add=20DayType=20enum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding enum for Days Types --- OneBus.Domain/Enums/DayType.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 OneBus.Domain/Enums/DayType.cs diff --git a/OneBus.Domain/Enums/DayType.cs b/OneBus.Domain/Enums/DayType.cs new file mode 100644 index 0000000..a50e9da --- /dev/null +++ b/OneBus.Domain/Enums/DayType.cs @@ -0,0 +1,10 @@ +namespace OneBus.Domain.Enums +{ + public enum DayType : byte + { + Dias_Úteis, + Sábados, + Domingos, + Feriados + } +} From 397ca8c8480e737b8fd75ece630c6b1e0ae2ecbd Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 00:24:46 -0300 Subject: [PATCH 26/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20en?= =?UTF-8?q?tities?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating entities and removing excluded references --- OneBus.Domain/Entities/Bus.cs | 2 -- OneBus.Domain/Entities/Employee.cs | 12 +----------- OneBus.Domain/Entities/EmployeeWorkday.cs | 2 +- OneBus.Domain/Entities/Line.cs | 8 +------- OneBus.Domain/Entities/LineTime.cs | 2 +- OneBus.Domain/Entities/Vehicle.cs | 2 -- 6 files changed, 4 insertions(+), 24 deletions(-) diff --git a/OneBus.Domain/Entities/Bus.cs b/OneBus.Domain/Entities/Bus.cs index 644ab40..811603a 100644 --- a/OneBus.Domain/Entities/Bus.cs +++ b/OneBus.Domain/Entities/Bus.cs @@ -33,7 +33,5 @@ public Bus() public Vehicle? Vehicle { get; set; } public ICollection? BusOperations { get; set; } - - public ICollection? BusAudits { get; set; } } } diff --git a/OneBus.Domain/Entities/Employee.cs b/OneBus.Domain/Entities/Employee.cs index 9960c51..a97a881 100644 --- a/OneBus.Domain/Entities/Employee.cs +++ b/OneBus.Domain/Entities/Employee.cs @@ -16,8 +16,6 @@ public Employee() Phone = string.Empty; } - public ulong AddressId { get; set; } - public string Name { get; set; } public string Rg { get; set; } @@ -44,16 +42,8 @@ public Employee() public EmployeeStatus Status { get; set; } - public string? Image { get; set; } - - public Address? Address { get; set; } - - public ICollection? EmployeeGarages { get; set; } + public string? Image { get; set; } public ICollection? EmployeeWorkdays { get; set; } - - public ICollection? BusAudits { get; set; } - - public ICollection? LineTariffAudits { get; set; } } } diff --git a/OneBus.Domain/Entities/EmployeeWorkday.cs b/OneBus.Domain/Entities/EmployeeWorkday.cs index 7587120..8aa4c41 100644 --- a/OneBus.Domain/Entities/EmployeeWorkday.cs +++ b/OneBus.Domain/Entities/EmployeeWorkday.cs @@ -1,4 +1,4 @@ -using OneBus.Domain.Enums.StopTime; +using OneBus.Domain.Enums; using System.ComponentModel.DataAnnotations.Schema; namespace OneBus.Domain.Entities diff --git a/OneBus.Domain/Entities/Line.cs b/OneBus.Domain/Entities/Line.cs index a6561d7..6212092 100644 --- a/OneBus.Domain/Entities/Line.cs +++ b/OneBus.Domain/Entities/Line.cs @@ -26,13 +26,7 @@ public Line() public byte MinNumberBuses { get; set; } - public byte MaxNumberBuses { get; set; } - - public Company? Company { get; set; } - - public ICollection? LineAddresses { get; set; } - - public ICollection? LineTariffs { get; set; } + public byte MaxNumberBuses { get; set; } public ICollection? LineTimes { get; set; } } diff --git a/OneBus.Domain/Entities/LineTime.cs b/OneBus.Domain/Entities/LineTime.cs index a2e03a1..63bdacf 100644 --- a/OneBus.Domain/Entities/LineTime.cs +++ b/OneBus.Domain/Entities/LineTime.cs @@ -1,4 +1,4 @@ -using OneBus.Domain.Enums.StopTime; +using OneBus.Domain.Enums; using System.ComponentModel.DataAnnotations.Schema; namespace OneBus.Domain.Entities diff --git a/OneBus.Domain/Entities/Vehicle.cs b/OneBus.Domain/Entities/Vehicle.cs index 6dcc62b..963af0c 100644 --- a/OneBus.Domain/Entities/Vehicle.cs +++ b/OneBus.Domain/Entities/Vehicle.cs @@ -59,8 +59,6 @@ public Vehicle() public string? Image { get; set; } - public ICollection? VehicleGarages { get; set; } - public ICollection? Buses { get; set; } public ICollection? Maintenances { get; set; } From c5e8080b31d18282c66d2fcdfecd518b3adbdbb0 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 00:25:13 -0300 Subject: [PATCH 27/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20en?= =?UTF-8?q?tities=20Mapping?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating mappings and removing excluded references --- OneBus.Infra.Data/Mappings/EmployeeMapping.cs | 8 +------- OneBus.Infra.Data/Mappings/LineMapping.cs | 7 +------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/OneBus.Infra.Data/Mappings/EmployeeMapping.cs b/OneBus.Infra.Data/Mappings/EmployeeMapping.cs index 458dea9..57f31d7 100644 --- a/OneBus.Infra.Data/Mappings/EmployeeMapping.cs +++ b/OneBus.Infra.Data/Mappings/EmployeeMapping.cs @@ -15,7 +15,6 @@ public override void Configure(EntityTypeBuilder builder) builder.Property(c => c.Cpf).HasMaxLength(20); builder.Property(c => c.Email).HasMaxLength(80); builder.Property(c => c.CnhNumber).HasColumnName("NumeroCnh"); - builder.Property(c => c.AddressId).HasColumnName("EnderecoId"); builder.Property(c => c.CnhExpiration).HasColumnName("ValidadeCnh"); builder.Property(c => c.HiringDate).HasColumnName("DataContratacao"); builder.Property(c => c.Name).HasColumnName("Nome").HasMaxLength(80); @@ -29,12 +28,7 @@ public override void Configure(EntityTypeBuilder builder) builder.HasIndex(c => c.Cpf); builder.HasIndex(c => c.CnhNumber); - builder.HasIndex(c => c.Code); - - builder - .HasOne(c => c.Address) - .WithMany(c => c.Employees) - .HasForeignKey(c => c.AddressId); + builder.HasIndex(c => c.Code); } } } diff --git a/OneBus.Infra.Data/Mappings/LineMapping.cs b/OneBus.Infra.Data/Mappings/LineMapping.cs index 2f0a1bf..c520223 100644 --- a/OneBus.Infra.Data/Mappings/LineMapping.cs +++ b/OneBus.Infra.Data/Mappings/LineMapping.cs @@ -18,12 +18,7 @@ public override void Configure(EntityTypeBuilder builder) builder.Property(c => c.Number).HasColumnName("Numero").HasMaxLength(20); builder.Property(c => c.Type).HasColumnName("Tipo").HasConversion(); builder.Property(c => c.MinNumberBuses).HasColumnName("NumeroMinimoOnibus"); - builder.Property(c => c.MaxNumberBuses).HasColumnName("NumeroMaximoOnibus"); - - builder - .HasOne(c => c.Company) - .WithMany(c => c.Lines) - .HasForeignKey(c => c.CompanyId); + builder.Property(c => c.MaxNumberBuses).HasColumnName("NumeroMaximoOnibus"); } } } From 8c9ecbf300159dc6b97d8aa7f8f875486c260bd2 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 00:45:43 -0300 Subject: [PATCH 28/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Us?= =?UTF-8?q?er=20Mapping?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding admin default record --- OneBus.Infra.Data/Mappings/UserMapping.cs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/OneBus.Infra.Data/Mappings/UserMapping.cs b/OneBus.Infra.Data/Mappings/UserMapping.cs index bdd7136..8a307a4 100644 --- a/OneBus.Infra.Data/Mappings/UserMapping.cs +++ b/OneBus.Infra.Data/Mappings/UserMapping.cs @@ -10,9 +10,22 @@ public override void Configure(EntityTypeBuilder builder) base.Configure(builder); builder.Property(c => c.Email).HasMaxLength(80); - builder.Property(c => c.Salt).HasMaxLength(25); + builder.Property(c => c.Salt).HasMaxLength(32); builder.Property(c => c.Name).HasMaxLength(80); builder.Property(c => c.Password).HasMaxLength(50); + + // Admin default data: + builder.HasData( + new User + { + Id = 1, + Name = "Administrador", + Email = "onebus@admin", + Password = "YRT66Z4XEJ2SSNaJVDIXQW7uvC8LSvOxDU1sH/Sr/ic=", //onebus@2025 + Salt = "c37b6028194d489192aac9391801594a", + CreatedAt = new DateTime(2025, 08, 25, 00, 00, 00, DateTimeKind.Utc), + } + ); } } } From 7cfc754b9b985ac073949195bc4e3b4f8b2c58bb Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 00:47:27 -0300 Subject: [PATCH 29/41] =?UTF-8?q?=F0=9F=90=9Bfix:=20Update=20Program?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixing TokenSettings builder configurations invocation --- OneBus.API/Program.cs | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/OneBus.API/Program.cs b/OneBus.API/Program.cs index bee52da..62c01dc 100644 --- a/OneBus.API/Program.cs +++ b/OneBus.API/Program.cs @@ -2,17 +2,12 @@ using OneBus.Infra.Ioc; using OneBus.API.Handlers; using OneBus.Domain.Settings; -using OneBus.Domain.Constants; using Microsoft.OpenApi.Models; -using OneBus.API.Authorizations; -using OneBus.Application.Services; using OneBus.Infra.Data.DbContexts; using Microsoft.EntityFrameworkCore; using System.Text.Json.Serialization; using Microsoft.AspNetCore.Http.Json; using Microsoft.IdentityModel.Tokens; -using Microsoft.AspNetCore.Authorization; -using OneBus.Application.Interfaces.Services; using Microsoft.AspNetCore.Authentication.JwtBearer; var builder = WebApplication.CreateBuilder(args); @@ -56,10 +51,6 @@ .AddOptions() .BindConfiguration("TokenSettings"); -builder.Services - .AddOptions() - .BindConfiguration("EmailSettings"); - // Adds IoC configurations builder.Services.AddInfrastructure(); @@ -137,9 +128,9 @@ ValidateAudience = true, ValidateLifetime = true, ValidateIssuerSigningKey = true, - ValidIssuer = builder.Configuration["TokenConfigurations:Issuer"], - ValidAudience = builder.Configuration["TokenConfigurations:Audience"], - IssuerSigningKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(builder.Configuration["TokenConfigurations:Key"]!)) + ValidIssuer = builder.Configuration["TokenSettings:Issuer"], + ValidAudience = builder.Configuration["TokenSettings:Audience"], + IssuerSigningKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(builder.Configuration["TokenSettings:Key"]!)) }; }); @@ -147,14 +138,6 @@ builder.Services.AddExceptionHandler(); builder.Services.AddProblemDetails(); -// Authorization settings -builder.Services.AddAuthorizationBuilder() - .AddPolicy(PolicyConstants.UpdateUser, policy => - policy.Requirements.Add(new FeatureRequirement(FeaturesCode.UpdateUserCode))); - -builder.Services.AddScoped(); -builder.Services.AddScoped(); - // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle builder.Services.AddEndpointsApiExplorer(); From 9ddeaf1a9083129ffa2f4cd3e55489be2e7d51e7 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 00:48:18 -0300 Subject: [PATCH 30/41] =?UTF-8?q?=F0=9F=90=9Bfix:=20Update=20Dependency=20?= =?UTF-8?q?Injection?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixing the DI registration container code --- OneBus.Infra.Ioc/DependencyInjection.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/OneBus.Infra.Ioc/DependencyInjection.cs b/OneBus.Infra.Ioc/DependencyInjection.cs index 948fb4d..ee9f497 100644 --- a/OneBus.Infra.Ioc/DependencyInjection.cs +++ b/OneBus.Infra.Ioc/DependencyInjection.cs @@ -1,7 +1,7 @@ using FluentValidation; using Microsoft.Extensions.DependencyInjection; using OneBus.Application.Interfaces.Services; -using OneBus.Application.Services; +using OneBus.Domain.Interfaces.Repositories; using OneBus.Infra.Data.Repositories; namespace OneBus.Infra.Ioc @@ -10,9 +10,20 @@ public static class DependencyInjection { public static IServiceCollection AddInfrastructure(this IServiceCollection services) { - services.Scan(c => c.FromAssemblyOf().AddClasses()); - services.Scan(c => c.FromAssemblyOf().AddClasses()); services.AddValidatorsFromAssembly(typeof(IBaseReadOnlyService<,,>).Assembly); + + services.Scan(scan => scan + .FromAssemblies(typeof(BaseReadOnlyRepository<,>).Assembly) + .AddClasses(classes => classes.AssignableTo(typeof(IBaseReadOnlyRepository<,>))) + .AsImplementedInterfaces() + .WithScopedLifetime()); + + services.Scan(scan => scan + .FromAssemblies(typeof(IBaseReadOnlyService<,,>).Assembly) + .AddClasses(classes => classes.AssignableTo(typeof(IBaseReadOnlyService<,,>))) + .AsImplementedInterfaces() + .WithScopedLifetime()); + return services; } } From 8cfa3832cc8f6f0c61fbd2c180a481b9f9ba858e Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 00:51:39 -0300 Subject: [PATCH 31/41] =?UTF-8?q?=F0=9F=90=9Bfix:=20Update=20Project=20lay?= =?UTF-8?q?ers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changing ulong references to long because database needs it --- OneBus.API/Controllers/BaseController.cs | 4 ++-- OneBus.API/Controllers/BaseReadOnlyController.cs | 2 +- OneBus.API/Controllers/BusController.cs | 6 +++--- OneBus.API/Controllers/BusOperationController.cs | 6 +++--- OneBus.API/Controllers/EmployeeController.cs | 6 +++--- OneBus.API/Controllers/EmployeeWorkdayController.cs | 6 +++--- OneBus.API/Controllers/LineController.cs | 6 +++--- OneBus.API/Controllers/LineTimeController.cs | 6 +++--- OneBus.API/Controllers/MaintenanceController.cs | 6 +++--- OneBus.API/Controllers/UserController.cs | 10 ++++------ OneBus.API/Controllers/VehicleController.cs | 6 +++--- OneBus.API/Controllers/VehicleOperationController.cs | 6 +++--- OneBus.Application/DTOs/BaseReadDTO.cs | 2 +- OneBus.Application/DTOs/BaseUpdateDTO.cs | 2 +- OneBus.Application/DTOs/User/CreateUserDTO.cs | 2 +- OneBus.Application/DTOs/User/ReadUserDTO.cs | 2 +- .../Interfaces/Services/IBaseReadOnlyService.cs | 2 +- OneBus.Application/Interfaces/Services/IBaseService.cs | 2 +- OneBus.Application/Services/BaseReadOnlyService.cs | 4 ++-- OneBus.Application/Services/BaseService.cs | 2 +- OneBus.Domain/Commons/Pagination.cs | 4 ++-- OneBus.Domain/Entities/BaseEntity.cs | 2 +- OneBus.Domain/Entities/Bus.cs | 2 +- OneBus.Domain/Entities/BusOperation.cs | 6 +++--- OneBus.Domain/Entities/EmployeeWorkday.cs | 2 +- OneBus.Domain/Entities/Line.cs | 2 +- OneBus.Domain/Entities/LineTime.cs | 2 +- OneBus.Domain/Entities/Maintenance.cs | 2 +- OneBus.Domain/Entities/VehicleOperation.cs | 4 ++-- .../Interfaces/Repositories/IBaseReadOnlyRepository.cs | 2 +- .../Repositories/BaseReadOnlyRepository.cs | 4 ++-- 31 files changed, 59 insertions(+), 61 deletions(-) diff --git a/OneBus.API/Controllers/BaseController.cs b/OneBus.API/Controllers/BaseController.cs index 9490e4a..528c9f4 100644 --- a/OneBus.API/Controllers/BaseController.cs +++ b/OneBus.API/Controllers/BaseController.cs @@ -34,7 +34,7 @@ public async virtual Task CreateAsync( [HttpPut("{id}")] public async virtual Task UpdateAsync( - [FromRoute] ulong id, + [FromRoute] long id, [FromBody] TUpdateDTO updateDTO, CancellationToken cancellationToken = default) { @@ -46,7 +46,7 @@ public async virtual Task UpdateAsync( [HttpDelete("{id}")] public async virtual Task DeleteAsync( - [FromRoute] ulong id, + [FromRoute] long id, CancellationToken cancellationToken = default) { return (await _baseService.DeleteAsync(id, cancellationToken)).ToActionResult(); diff --git a/OneBus.API/Controllers/BaseReadOnlyController.cs b/OneBus.API/Controllers/BaseReadOnlyController.cs index 61f262e..01a2aba 100644 --- a/OneBus.API/Controllers/BaseReadOnlyController.cs +++ b/OneBus.API/Controllers/BaseReadOnlyController.cs @@ -34,7 +34,7 @@ public async virtual Task GetPaginedAsync( [HttpGet("{id}")] public async virtual Task GetByIdAsync( - [FromRoute] ulong id, + [FromRoute] long id, CancellationToken cancellationToken = default) { return (await _baseReadOnlyService.GetByIdAsync(id, cancellationToken)).ToActionResult(); diff --git a/OneBus.API/Controllers/BusController.cs b/OneBus.API/Controllers/BusController.cs index f482822..84d39ee 100644 --- a/OneBus.API/Controllers/BusController.cs +++ b/OneBus.API/Controllers/BusController.cs @@ -54,7 +54,7 @@ public override Task CreateAsync([FromBody] CreateBusDTO createDT [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateBusDTO updateDTO, CancellationToken cancellationToken = default) + public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateBusDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); } @@ -72,7 +72,7 @@ public override Task UpdateAsync([FromRoute] ulong id, [FromBody] /// Ônibus não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.DeleteAsync(id, cancellationToken); } @@ -106,7 +106,7 @@ public override Task GetPaginedAsync([FromQuery] BaseFilter filte /// Ônibus não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.GetByIdAsync(id, cancellationToken); } diff --git a/OneBus.API/Controllers/BusOperationController.cs b/OneBus.API/Controllers/BusOperationController.cs index 8127f12..ea597ad 100644 --- a/OneBus.API/Controllers/BusOperationController.cs +++ b/OneBus.API/Controllers/BusOperationController.cs @@ -54,7 +54,7 @@ public override Task CreateAsync([FromBody] CreateBusOperationDTO [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateBusOperationDTO updateDTO, CancellationToken cancellationToken = default) + public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateBusOperationDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); } @@ -72,7 +72,7 @@ public override Task UpdateAsync([FromRoute] ulong id, [FromBody] /// Operação de Ônibus não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.DeleteAsync(id, cancellationToken); } @@ -106,7 +106,7 @@ public override Task GetPaginedAsync([FromQuery] BaseFilter filte /// Operação de Ônibus não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.GetByIdAsync(id, cancellationToken); } diff --git a/OneBus.API/Controllers/EmployeeController.cs b/OneBus.API/Controllers/EmployeeController.cs index 54ee15e..2a1e34c 100644 --- a/OneBus.API/Controllers/EmployeeController.cs +++ b/OneBus.API/Controllers/EmployeeController.cs @@ -54,7 +54,7 @@ public override Task CreateAsync([FromBody] CreateEmployeeDTO cre [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateEmployeeDTO updateDTO, CancellationToken cancellationToken = default) + public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateEmployeeDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); } @@ -72,7 +72,7 @@ public override Task UpdateAsync([FromRoute] ulong id, [FromBody] /// Funcionário não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.DeleteAsync(id, cancellationToken); } @@ -106,7 +106,7 @@ public override Task GetPaginedAsync([FromQuery] BaseFilter filte /// Funcionário não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.GetByIdAsync(id, cancellationToken); } diff --git a/OneBus.API/Controllers/EmployeeWorkdayController.cs b/OneBus.API/Controllers/EmployeeWorkdayController.cs index c4e388e..0557ccd 100644 --- a/OneBus.API/Controllers/EmployeeWorkdayController.cs +++ b/OneBus.API/Controllers/EmployeeWorkdayController.cs @@ -54,7 +54,7 @@ public override Task CreateAsync([FromBody] CreateEmployeeWorkday [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateEmployeeWorkdayDTO updateDTO, CancellationToken cancellationToken = default) + public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateEmployeeWorkdayDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); } @@ -72,7 +72,7 @@ public override Task UpdateAsync([FromRoute] ulong id, [FromBody] /// Horário do Funcionário não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.DeleteAsync(id, cancellationToken); } @@ -106,7 +106,7 @@ public override Task GetPaginedAsync([FromQuery] BaseFilter filte /// Horário do Funcionário não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.GetByIdAsync(id, cancellationToken); } diff --git a/OneBus.API/Controllers/LineController.cs b/OneBus.API/Controllers/LineController.cs index 36c3807..01c78f6 100644 --- a/OneBus.API/Controllers/LineController.cs +++ b/OneBus.API/Controllers/LineController.cs @@ -54,7 +54,7 @@ public override Task CreateAsync([FromBody] CreateLineDTO createD [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateLineDTO updateDTO, CancellationToken cancellationToken = default) + public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateLineDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); } @@ -72,7 +72,7 @@ public override Task UpdateAsync([FromRoute] ulong id, [FromBody] /// Linha não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.DeleteAsync(id, cancellationToken); } @@ -106,7 +106,7 @@ public override Task GetPaginedAsync([FromQuery] BaseFilter filte /// Linha não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.GetByIdAsync(id, cancellationToken); } diff --git a/OneBus.API/Controllers/LineTimeController.cs b/OneBus.API/Controllers/LineTimeController.cs index 8ae402f..6dd8092 100644 --- a/OneBus.API/Controllers/LineTimeController.cs +++ b/OneBus.API/Controllers/LineTimeController.cs @@ -54,7 +54,7 @@ public override Task CreateAsync([FromBody] CreateLineTimeDTO cre [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateLineTimeDTO updateDTO, CancellationToken cancellationToken = default) + public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateLineTimeDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); } @@ -72,7 +72,7 @@ public override Task UpdateAsync([FromRoute] ulong id, [FromBody] /// Horário de Linha não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.DeleteAsync(id, cancellationToken); } @@ -106,7 +106,7 @@ public override Task GetPaginedAsync([FromQuery] BaseFilter filte /// Horário de Linha não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.GetByIdAsync(id, cancellationToken); } diff --git a/OneBus.API/Controllers/MaintenanceController.cs b/OneBus.API/Controllers/MaintenanceController.cs index 7518ce6..8ebf82e 100644 --- a/OneBus.API/Controllers/MaintenanceController.cs +++ b/OneBus.API/Controllers/MaintenanceController.cs @@ -54,7 +54,7 @@ public override Task CreateAsync([FromBody] CreateMaintenanceDTO [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateMaintenanceDTO updateDTO, CancellationToken cancellationToken = default) + public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateMaintenanceDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); } @@ -72,7 +72,7 @@ public override Task UpdateAsync([FromRoute] ulong id, [FromBody] /// Manutenção não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.DeleteAsync(id, cancellationToken); } @@ -106,7 +106,7 @@ public override Task GetPaginedAsync([FromQuery] BaseFilter filte /// Manutenção não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.GetByIdAsync(id, cancellationToken); } diff --git a/OneBus.API/Controllers/UserController.cs b/OneBus.API/Controllers/UserController.cs index 23428ab..7d2cc3a 100644 --- a/OneBus.API/Controllers/UserController.cs +++ b/OneBus.API/Controllers/UserController.cs @@ -1,6 +1,5 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.RateLimiting; using OneBus.Application.DTOs.Login; using OneBus.Application.DTOs.User; using OneBus.Application.Interfaces.Services; @@ -30,11 +29,10 @@ public UserController( /// /// /// Usuário autenticado - [EnableRateLimiting("login")] [AllowAnonymous] [HttpPost("login")] public Task LoginAsync([FromBody] LoginDTO login, CancellationToken cancellationToken = default) - { + { throw new NotImplementedException(); } @@ -74,7 +72,7 @@ public override Task CreateAsync([FromBody] CreateUserDTO createD [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateUserDTO updateDTO, CancellationToken cancellationToken = default) + public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateUserDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); } @@ -92,7 +90,7 @@ public override Task UpdateAsync([FromRoute] ulong id, [FromBody] /// Usuário não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.DeleteAsync(id, cancellationToken); } @@ -126,7 +124,7 @@ public override Task GetPaginedAsync([FromQuery] BaseFilter filte /// Usuário não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.GetByIdAsync(id, cancellationToken); } diff --git a/OneBus.API/Controllers/VehicleController.cs b/OneBus.API/Controllers/VehicleController.cs index 36d73b8..e72d367 100644 --- a/OneBus.API/Controllers/VehicleController.cs +++ b/OneBus.API/Controllers/VehicleController.cs @@ -54,7 +54,7 @@ public override Task CreateAsync([FromBody] CreateVehicleDTO crea [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateVehicleDTO updateDTO, CancellationToken cancellationToken = default) + public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateVehicleDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); } @@ -72,7 +72,7 @@ public override Task UpdateAsync([FromRoute] ulong id, [FromBody] /// Veículo não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.DeleteAsync(id, cancellationToken); } @@ -106,7 +106,7 @@ public override Task GetPaginedAsync([FromQuery] BaseFilter filte /// Veículo não encontrado [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.GetByIdAsync(id, cancellationToken); } diff --git a/OneBus.API/Controllers/VehicleOperationController.cs b/OneBus.API/Controllers/VehicleOperationController.cs index 7c41001..1fe7627 100644 --- a/OneBus.API/Controllers/VehicleOperationController.cs +++ b/OneBus.API/Controllers/VehicleOperationController.cs @@ -54,7 +54,7 @@ public override Task CreateAsync([FromBody] CreateVehicleOperatio [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] ulong id, [FromBody] UpdateVehicleOperationDTO updateDTO, CancellationToken cancellationToken = default) + public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateVehicleOperationDTO updateDTO, CancellationToken cancellationToken = default) { return base.UpdateAsync(id, updateDTO, cancellationToken); } @@ -72,7 +72,7 @@ public override Task UpdateAsync([FromRoute] ulong id, [FromBody] /// Operação de Veículo não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.DeleteAsync(id, cancellationToken); } @@ -106,7 +106,7 @@ public override Task GetPaginedAsync([FromQuery] BaseFilter filte /// Operação de Veículo não encontrada [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] ulong id, CancellationToken cancellationToken = default) + public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) { return base.GetByIdAsync(id, cancellationToken); } diff --git a/OneBus.Application/DTOs/BaseReadDTO.cs b/OneBus.Application/DTOs/BaseReadDTO.cs index 6174861..aa6f0d4 100644 --- a/OneBus.Application/DTOs/BaseReadDTO.cs +++ b/OneBus.Application/DTOs/BaseReadDTO.cs @@ -5,7 +5,7 @@ namespace OneBus.Application.DTOs public abstract class BaseReadDTO { [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public ulong? Id { get; set; } + public long? Id { get; set; } [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public DateTime CreatedAt { get; set; } diff --git a/OneBus.Application/DTOs/BaseUpdateDTO.cs b/OneBus.Application/DTOs/BaseUpdateDTO.cs index 69d690d..53808fb 100644 --- a/OneBus.Application/DTOs/BaseUpdateDTO.cs +++ b/OneBus.Application/DTOs/BaseUpdateDTO.cs @@ -2,6 +2,6 @@ { public abstract class BaseUpdateDTO { - public ulong Id { get; set; } + public long Id { get; set; } } } diff --git a/OneBus.Application/DTOs/User/CreateUserDTO.cs b/OneBus.Application/DTOs/User/CreateUserDTO.cs index 4e6969e..9793766 100644 --- a/OneBus.Application/DTOs/User/CreateUserDTO.cs +++ b/OneBus.Application/DTOs/User/CreateUserDTO.cs @@ -14,7 +14,7 @@ public CreateUserDTO() public string Email { get; set; } - public ulong UserTypeId { get; set; } + public long UserTypeId { get; set; } public string Password { get; set; } diff --git a/OneBus.Application/DTOs/User/ReadUserDTO.cs b/OneBus.Application/DTOs/User/ReadUserDTO.cs index 9148e75..1e37517 100644 --- a/OneBus.Application/DTOs/User/ReadUserDTO.cs +++ b/OneBus.Application/DTOs/User/ReadUserDTO.cs @@ -9,6 +9,6 @@ public ReadUserDTO() public string Email { get; set; } - public ulong CompanyId { get; set; } + public long CompanyId { get; set; } } } diff --git a/OneBus.Application/Interfaces/Services/IBaseReadOnlyService.cs b/OneBus.Application/Interfaces/Services/IBaseReadOnlyService.cs index 6909900..5e18a65 100644 --- a/OneBus.Application/Interfaces/Services/IBaseReadOnlyService.cs +++ b/OneBus.Application/Interfaces/Services/IBaseReadOnlyService.cs @@ -16,7 +16,7 @@ Task>> GetPaginedAsync( CancellationToken cancellationToken = default); Task> GetByIdAsync( - ulong id, + long id, CancellationToken cancellationToken = default); } } diff --git a/OneBus.Application/Interfaces/Services/IBaseService.cs b/OneBus.Application/Interfaces/Services/IBaseService.cs index 4bede10..44d6a7d 100644 --- a/OneBus.Application/Interfaces/Services/IBaseService.cs +++ b/OneBus.Application/Interfaces/Services/IBaseService.cs @@ -16,6 +16,6 @@ public interface IBaseService> UpdateAsync(TUpdateDTO updateDTO, CancellationToken cancellationToken = default); - Task> DeleteAsync(ulong id, CancellationToken cancellationToken = default); + Task> DeleteAsync(long id, CancellationToken cancellationToken = default); } } diff --git a/OneBus.Application/Services/BaseReadOnlyService.cs b/OneBus.Application/Services/BaseReadOnlyService.cs index 50710fb..9640501 100644 --- a/OneBus.Application/Services/BaseReadOnlyService.cs +++ b/OneBus.Application/Services/BaseReadOnlyService.cs @@ -25,7 +25,7 @@ public virtual async Task>> GetPaginedAsync( TFilter filter, CancellationToken cancellationToken = default) { - ulong totalItems = await _baseReadOnlyRepository.LongCountAsync(filter, dbQueryOptions: null, cancellationToken); + long totalItems = await _baseReadOnlyRepository.LongCountAsync(filter, dbQueryOptions: null, cancellationToken); if (totalItems < 1) { @@ -42,7 +42,7 @@ public virtual async Task>> GetPaginedAsync( } public virtual async Task> GetByIdAsync( - ulong id, + long id, CancellationToken cancellationToken = default) { TEntity? entity = await _baseReadOnlyRepository.GetOneAsync(c => c.Id == id, dbQueryOptions: null, cancellationToken); diff --git a/OneBus.Application/Services/BaseService.cs b/OneBus.Application/Services/BaseService.cs index 65a951c..a52e8d9 100644 --- a/OneBus.Application/Services/BaseService.cs +++ b/OneBus.Application/Services/BaseService.cs @@ -65,7 +65,7 @@ public virtual async Task> UpdateAsync(TUpdateDTO updateDTO, Ca return SuccessResult.Create(entity.Adapt()); } - public virtual async Task> DeleteAsync(ulong id, CancellationToken cancellationToken = default) + public virtual async Task> DeleteAsync(long id, CancellationToken cancellationToken = default) { TEntity? entity = await _baseReadOnlyRepository.GetOneAsync(c => c.Id == id, cancellationToken: cancellationToken); diff --git a/OneBus.Domain/Commons/Pagination.cs b/OneBus.Domain/Commons/Pagination.cs index 3bff6cf..342d109 100644 --- a/OneBus.Domain/Commons/Pagination.cs +++ b/OneBus.Domain/Commons/Pagination.cs @@ -20,7 +20,7 @@ public class Pagination /// /// Total de itens no conjunto original (com filtros de página). /// - public ulong TotalItems { get; private set; } + public long TotalItems { get; private set; } /// /// Número total de páginas (calculado). @@ -37,7 +37,7 @@ public class Pagination /// public bool HasNextPage { get { return CurrentPage < TotalPages; } } - public Pagination(IEnumerable items, ulong totalItems, uint currentPage, uint pageSize) + public Pagination(IEnumerable items, long totalItems, uint currentPage, uint pageSize) { Items = [.. items]; TotalItems = totalItems; diff --git a/OneBus.Domain/Entities/BaseEntity.cs b/OneBus.Domain/Entities/BaseEntity.cs index 289af9b..96078ac 100644 --- a/OneBus.Domain/Entities/BaseEntity.cs +++ b/OneBus.Domain/Entities/BaseEntity.cs @@ -7,7 +7,7 @@ protected BaseEntity() CreatedAt = DateTime.UtcNow; } - public ulong Id { get; set; } + public long Id { get; set; } public DateTime CreatedAt { get; set; } diff --git a/OneBus.Domain/Entities/Bus.cs b/OneBus.Domain/Entities/Bus.cs index 811603a..bc8c69d 100644 --- a/OneBus.Domain/Entities/Bus.cs +++ b/OneBus.Domain/Entities/Bus.cs @@ -12,7 +12,7 @@ public Bus() ChassisModel = string.Empty; } - public ulong VehicleId { get; set; } + public long VehicleId { get; set; } public ServiceType ServiceType { get; set; } diff --git a/OneBus.Domain/Entities/BusOperation.cs b/OneBus.Domain/Entities/BusOperation.cs index 5851c59..f0950d9 100644 --- a/OneBus.Domain/Entities/BusOperation.cs +++ b/OneBus.Domain/Entities/BusOperation.cs @@ -5,11 +5,11 @@ namespace OneBus.Domain.Entities [NotMapped] public class BusOperation : BaseEntity { - public ulong LineTimeId { get; set; } + public long LineTimeId { get; set; } - public ulong EmployeeWorkDayId { get; set; } + public long EmployeeWorkDayId { get; set; } - public ulong BusId { get; set; } + public long BusId { get; set; } public DateOnly Date { get; set; } diff --git a/OneBus.Domain/Entities/EmployeeWorkday.cs b/OneBus.Domain/Entities/EmployeeWorkday.cs index 8aa4c41..ad56000 100644 --- a/OneBus.Domain/Entities/EmployeeWorkday.cs +++ b/OneBus.Domain/Entities/EmployeeWorkday.cs @@ -6,7 +6,7 @@ namespace OneBus.Domain.Entities [NotMapped] public class EmployeeWorkday : BaseEntity { - public ulong EmployeeId { get; set; } + public long EmployeeId { get; set; } public TimeOnly StartTime { get; set; } diff --git a/OneBus.Domain/Entities/Line.cs b/OneBus.Domain/Entities/Line.cs index 6212092..35630fc 100644 --- a/OneBus.Domain/Entities/Line.cs +++ b/OneBus.Domain/Entities/Line.cs @@ -12,7 +12,7 @@ public Line() Name = string.Empty; } - public ulong CompanyId { get; set; } + public long CompanyId { get; set; } public string Number { get; set; } diff --git a/OneBus.Domain/Entities/LineTime.cs b/OneBus.Domain/Entities/LineTime.cs index 63bdacf..35144cf 100644 --- a/OneBus.Domain/Entities/LineTime.cs +++ b/OneBus.Domain/Entities/LineTime.cs @@ -6,7 +6,7 @@ namespace OneBus.Domain.Entities [NotMapped] public class LineTime : BaseEntity { - public ulong LineId { get; set; } + public long LineId { get; set; } public TimeOnly StartTime { get; set; } diff --git a/OneBus.Domain/Entities/Maintenance.cs b/OneBus.Domain/Entities/Maintenance.cs index 113463d..e237127 100644 --- a/OneBus.Domain/Entities/Maintenance.cs +++ b/OneBus.Domain/Entities/Maintenance.cs @@ -11,7 +11,7 @@ public Maintenance() Description = string.Empty; } - public ulong VehicleId { get; set; } + public long VehicleId { get; set; } public Sector Sector { get; set; } diff --git a/OneBus.Domain/Entities/VehicleOperation.cs b/OneBus.Domain/Entities/VehicleOperation.cs index a5c1506..22a8f07 100644 --- a/OneBus.Domain/Entities/VehicleOperation.cs +++ b/OneBus.Domain/Entities/VehicleOperation.cs @@ -5,9 +5,9 @@ namespace OneBus.Domain.Entities [NotMapped] public class VehicleOperation : BaseEntity { - public ulong EmployeeWorkdayId { get; set; } + public long EmployeeWorkdayId { get; set; } - public ulong VehicleId { get; set; } + public long VehicleId { get; set; } public DateOnly Date { get; set; } diff --git a/OneBus.Domain/Interfaces/Repositories/IBaseReadOnlyRepository.cs b/OneBus.Domain/Interfaces/Repositories/IBaseReadOnlyRepository.cs index 7db7ac1..f6f9216 100644 --- a/OneBus.Domain/Interfaces/Repositories/IBaseReadOnlyRepository.cs +++ b/OneBus.Domain/Interfaces/Repositories/IBaseReadOnlyRepository.cs @@ -23,7 +23,7 @@ Task> GetPaginedAsync( DbQueryOptions? dbQueryOptions = null, CancellationToken cancellationToken = default); - Task LongCountAsync( + Task LongCountAsync( TFilter filter, DbQueryOptions? dbQueryOptions = null, CancellationToken cancellationToken = default); diff --git a/OneBus.Infra.Data/Repositories/BaseReadOnlyRepository.cs b/OneBus.Infra.Data/Repositories/BaseReadOnlyRepository.cs index a4b212a..f049333 100644 --- a/OneBus.Infra.Data/Repositories/BaseReadOnlyRepository.cs +++ b/OneBus.Infra.Data/Repositories/BaseReadOnlyRepository.cs @@ -63,7 +63,7 @@ public virtual async Task> GetPaginedAsync( .ToListAsync(cancellationToken); } - public virtual async Task LongCountAsync( + public virtual async Task LongCountAsync( TFilter filter, DbQueryOptions? dbQueryOptions = null, CancellationToken cancellationToken = default) @@ -72,7 +72,7 @@ public virtual async Task LongCountAsync( IQueryable query = ApplyDbQueryOptions(dbQueryOptions); - return (ulong)await query + return await query .Where(c => predicate(c)) .LongCountAsync(cancellationToken); } From 746fdf966413c1bacb7d525b97f4cdf91b024510 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 01:14:42 -0300 Subject: [PATCH 32/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20en?= =?UTF-8?q?tities?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating some entities fields types and removing unnecessary fields --- OneBus.Domain/Entities/Bus.cs | 8 ++------ OneBus.Domain/Entities/BusOperation.cs | 5 +---- OneBus.Domain/Entities/Employee.cs | 16 ++++++---------- OneBus.Domain/Entities/EmployeeWorkday.cs | 8 ++------ OneBus.Domain/Entities/Line.cs | 10 ++-------- OneBus.Domain/Entities/LineTime.cs | 8 ++------ OneBus.Domain/Entities/Maintenance.cs | 8 ++------ OneBus.Domain/Entities/Vehicle.cs | 16 ++++++---------- OneBus.Domain/Entities/VehicleOperation.cs | 5 +---- 9 files changed, 24 insertions(+), 60 deletions(-) diff --git a/OneBus.Domain/Entities/Bus.cs b/OneBus.Domain/Entities/Bus.cs index bc8c69d..b81933f 100644 --- a/OneBus.Domain/Entities/Bus.cs +++ b/OneBus.Domain/Entities/Bus.cs @@ -1,9 +1,5 @@ -using OneBus.Domain.Enums.Bus; -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities +namespace OneBus.Domain.Entities { - [NotMapped] public class Bus : BaseEntity { public Bus() @@ -14,7 +10,7 @@ public Bus() public long VehicleId { get; set; } - public ServiceType ServiceType { get; set; } + public byte ServiceType { get; set; } public string ChassisBrand { get; set; } diff --git a/OneBus.Domain/Entities/BusOperation.cs b/OneBus.Domain/Entities/BusOperation.cs index f0950d9..2485f6b 100644 --- a/OneBus.Domain/Entities/BusOperation.cs +++ b/OneBus.Domain/Entities/BusOperation.cs @@ -1,8 +1,5 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities +namespace OneBus.Domain.Entities { - [NotMapped] public class BusOperation : BaseEntity { public long LineTimeId { get; set; } diff --git a/OneBus.Domain/Entities/Employee.cs b/OneBus.Domain/Entities/Employee.cs index a97a881..6d274a0 100644 --- a/OneBus.Domain/Entities/Employee.cs +++ b/OneBus.Domain/Entities/Employee.cs @@ -1,9 +1,5 @@ -using OneBus.Domain.Enums.Employee; -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities +namespace OneBus.Domain.Entities { - [NotMapped] public class Employee : BaseEntity { public Employee() @@ -22,11 +18,11 @@ public Employee() public string Cpf { get; set; } - public BloodType? BloodType { get; set; } + public byte? BloodType { get; set; } public string Code { get; set; } - public Role Role { get; set; } + public byte Role { get; set; } public string Email { get; set; } @@ -36,13 +32,13 @@ public Employee() public string? CnhNumber { get; set; } - public CnhCategory? CnhCategory { get; set; } + public byte? CnhCategory { get; set; } public DateOnly? CnhExpiration { get; set; } - public EmployeeStatus Status { get; set; } + public byte Status { get; set; } - public string? Image { get; set; } + public byte[]? Image { get; set; } public ICollection? EmployeeWorkdays { get; set; } } diff --git a/OneBus.Domain/Entities/EmployeeWorkday.cs b/OneBus.Domain/Entities/EmployeeWorkday.cs index ad56000..9edde3f 100644 --- a/OneBus.Domain/Entities/EmployeeWorkday.cs +++ b/OneBus.Domain/Entities/EmployeeWorkday.cs @@ -1,9 +1,5 @@ -using OneBus.Domain.Enums; -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities +namespace OneBus.Domain.Entities { - [NotMapped] public class EmployeeWorkday : BaseEntity { public long EmployeeId { get; set; } @@ -12,7 +8,7 @@ public class EmployeeWorkday : BaseEntity public TimeOnly EndTime { get; set; } - public DayType DayType { get; set; } + public byte DayType { get; set; } public Employee? Employee { get; set; } diff --git a/OneBus.Domain/Entities/Line.cs b/OneBus.Domain/Entities/Line.cs index 35630fc..d437f56 100644 --- a/OneBus.Domain/Entities/Line.cs +++ b/OneBus.Domain/Entities/Line.cs @@ -1,9 +1,5 @@ -using OneBus.Domain.Enums.Line; -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities +namespace OneBus.Domain.Entities { - [NotMapped] public class Line : BaseEntity { public Line() @@ -12,13 +8,11 @@ public Line() Name = string.Empty; } - public long CompanyId { get; set; } - public string Number { get; set; } public string Name { get; set; } - public LineType Type { get; set; } + public byte Type { get; set; } public TimeOnly TravelTime { get; set; } diff --git a/OneBus.Domain/Entities/LineTime.cs b/OneBus.Domain/Entities/LineTime.cs index 35144cf..d3c4b07 100644 --- a/OneBus.Domain/Entities/LineTime.cs +++ b/OneBus.Domain/Entities/LineTime.cs @@ -1,9 +1,5 @@ -using OneBus.Domain.Enums; -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities +namespace OneBus.Domain.Entities { - [NotMapped] public class LineTime : BaseEntity { public long LineId { get; set; } @@ -12,7 +8,7 @@ public class LineTime : BaseEntity public TimeOnly EndTime { get; set; } - public DayType DayType { get; set; } + public byte DayType { get; set; } public Line? Line { get; set; } diff --git a/OneBus.Domain/Entities/Maintenance.cs b/OneBus.Domain/Entities/Maintenance.cs index e237127..8cdbbec 100644 --- a/OneBus.Domain/Entities/Maintenance.cs +++ b/OneBus.Domain/Entities/Maintenance.cs @@ -1,9 +1,5 @@ -using OneBus.Domain.Enums.Maintenance; -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities +namespace OneBus.Domain.Entities { - [NotMapped] public class Maintenance : BaseEntity { public Maintenance() @@ -13,7 +9,7 @@ public Maintenance() public long VehicleId { get; set; } - public Sector Sector { get; set; } + public byte Sector { get; set; } public string Description { get; set; } diff --git a/OneBus.Domain/Entities/Vehicle.cs b/OneBus.Domain/Entities/Vehicle.cs index 963af0c..0a01f1b 100644 --- a/OneBus.Domain/Entities/Vehicle.cs +++ b/OneBus.Domain/Entities/Vehicle.cs @@ -1,9 +1,5 @@ -using OneBus.Domain.Enums.Vehicle; -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities +namespace OneBus.Domain.Entities { - [NotMapped] public class Vehicle : BaseEntity { public Vehicle() @@ -15,7 +11,7 @@ public Vehicle() Renavam = string.Empty; } - public VehicleType Type { get; set; } + public byte Type { get; set; } public string Prefix { get; set; } @@ -25,7 +21,7 @@ public Vehicle() public bool HasAccessibility { get; set; } - public FuelType FuelType { get; set; } + public byte FuelType { get; set; } public string Brand { get; set; } @@ -51,13 +47,13 @@ public Vehicle() public string Renavam { get; set; } - public TransmissionType TransmissionType { get; set; } + public byte TransmissionType { get; set; } public DateOnly AcquisitionDate { get; set; } - public VehicleStatus Status { get; set; } + public byte Status { get; set; } - public string? Image { get; set; } + public byte[]? Image { get; set; } public ICollection? Buses { get; set; } diff --git a/OneBus.Domain/Entities/VehicleOperation.cs b/OneBus.Domain/Entities/VehicleOperation.cs index 22a8f07..877318f 100644 --- a/OneBus.Domain/Entities/VehicleOperation.cs +++ b/OneBus.Domain/Entities/VehicleOperation.cs @@ -1,8 +1,5 @@ -using System.ComponentModel.DataAnnotations.Schema; - -namespace OneBus.Domain.Entities +namespace OneBus.Domain.Entities { - [NotMapped] public class VehicleOperation : BaseEntity { public long EmployeeWorkdayId { get; set; } From 0f0eafa11e63da7307210ff51b504dd4ee4a2c7a Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 01:15:37 -0300 Subject: [PATCH 33/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20en?= =?UTF-8?q?tities=20Mapping?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating some entities fields types and removing unnecessary fields --- OneBus.Infra.Data/Mappings/BusMapping.cs | 15 ++------ .../Mappings/BusOperationMapping.cs | 9 +---- OneBus.Infra.Data/Mappings/EmployeeMapping.cs | 21 ++++------- .../Mappings/EmployeeWorkdayMapping.cs | 6 ---- OneBus.Infra.Data/Mappings/LineMapping.cs | 14 ++------ OneBus.Infra.Data/Mappings/LineTimeMapping.cs | 9 +---- .../Mappings/MaintenanceMapping.cs | 12 ++----- OneBus.Infra.Data/Mappings/VehicleMapping.cs | 35 ++++++------------- .../Mappings/VehicleOperationMapping.cs | 8 +---- 9 files changed, 27 insertions(+), 102 deletions(-) diff --git a/OneBus.Infra.Data/Mappings/BusMapping.cs b/OneBus.Infra.Data/Mappings/BusMapping.cs index 88ed18d..41e1f21 100644 --- a/OneBus.Infra.Data/Mappings/BusMapping.cs +++ b/OneBus.Infra.Data/Mappings/BusMapping.cs @@ -1,5 +1,4 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.EntityFrameworkCore.Metadata.Builders; using OneBus.Domain.Entities; namespace OneBus.Infra.Data.Mappings @@ -8,18 +7,10 @@ public class BusMapping : BaseEntityMapping { public override void Configure(EntityTypeBuilder builder) { - builder.ToTable("Onibus"); base.Configure(builder); - builder.Property(c => c.VehicleId).HasColumnName("VeiculoId"); - builder.Property(c => c.ChassisYear).HasColumnName("AnoChassi"); - builder.Property(c => c.HasLowFloor).HasColumnName("TemPisoBaixo"); - builder.Property(c => c.HasLeftDoors).HasColumnName("TemPortasEsquerda"); - builder.Property(c => c.InsuranceExpiration).HasColumnName("SeguroVencimento"); - builder.Property(c => c.FumigateExpiration).HasColumnName("DetetizacaoVencimento"); - builder.Property(c => c.ChassisBrand).HasColumnName("MarcaChassi").HasMaxLength(50); - builder.Property(c => c.ServiceType).HasColumnName("Servico").HasConversion(); - builder.Property(c => c.ChassisModel).HasColumnName("ModeloChassi").HasMaxLength(50); + builder.Property(c => c.ChassisBrand).HasMaxLength(50); + builder.Property(c => c.ChassisModel).HasMaxLength(50); builder .HasOne(c => c.Vehicle) diff --git a/OneBus.Infra.Data/Mappings/BusOperationMapping.cs b/OneBus.Infra.Data/Mappings/BusOperationMapping.cs index f05a309..c797a93 100644 --- a/OneBus.Infra.Data/Mappings/BusOperationMapping.cs +++ b/OneBus.Infra.Data/Mappings/BusOperationMapping.cs @@ -1,5 +1,4 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.EntityFrameworkCore.Metadata.Builders; using OneBus.Domain.Entities; namespace OneBus.Infra.Data.Mappings @@ -8,14 +7,8 @@ public class BusOperationMapping : BaseEntityMapping { public override void Configure(EntityTypeBuilder builder) { - builder.ToTable("OnibusOperacao"); base.Configure(builder); - builder.Property(c => c.Date).HasColumnName("Data"); - builder.Property(c => c.BusId).HasColumnName("OnibusId"); - builder.Property(c => c.LineTimeId).HasColumnName("LinhaHorarioId"); - builder.Property(c => c.EmployeeWorkDayId).HasColumnName("FuncionarioHorarioId"); - builder .HasOne(c => c.LineTime) .WithMany(c => c.BusOperations) diff --git a/OneBus.Infra.Data/Mappings/EmployeeMapping.cs b/OneBus.Infra.Data/Mappings/EmployeeMapping.cs index 57f31d7..741962b 100644 --- a/OneBus.Infra.Data/Mappings/EmployeeMapping.cs +++ b/OneBus.Infra.Data/Mappings/EmployeeMapping.cs @@ -1,5 +1,4 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.EntityFrameworkCore.Metadata.Builders; using OneBus.Domain.Entities; namespace OneBus.Infra.Data.Mappings @@ -8,27 +7,19 @@ public class EmployeeMapping : BaseEntityMapping { public override void Configure(EntityTypeBuilder builder) { - builder.ToTable("Funcionario"); base.Configure(builder); builder.Property(c => c.Rg).HasMaxLength(20); builder.Property(c => c.Cpf).HasMaxLength(20); builder.Property(c => c.Email).HasMaxLength(80); - builder.Property(c => c.CnhNumber).HasColumnName("NumeroCnh"); - builder.Property(c => c.CnhExpiration).HasColumnName("ValidadeCnh"); - builder.Property(c => c.HiringDate).HasColumnName("DataContratacao"); - builder.Property(c => c.Name).HasColumnName("Nome").HasMaxLength(80); - builder.Property(c => c.Image).HasColumnName("Foto").HasMaxLength(20); - builder.Property(c => c.Code).HasColumnName("Codigo").HasMaxLength(30); - builder.Property(c => c.Phone).HasColumnName("Telefone").HasMaxLength(20); - builder.Property(c => c.Role).HasColumnName("Cargo").HasConversion(); - builder.Property(c => c.Status).HasColumnName("Status").HasConversion(); - builder.Property(c => c.BloodType).HasColumnName("TipoSanguineo").HasConversion(); - builder.Property(c => c.CnhCategory).HasColumnName("CategoriaCnh").HasConversion(); + builder.Property(c => c.CnhNumber).HasMaxLength(20); + builder.Property(c => c.Name).HasMaxLength(80); + builder.Property(c => c.Code).HasMaxLength(30); + builder.Property(c => c.Phone).HasMaxLength(20); builder.HasIndex(c => c.Cpf); builder.HasIndex(c => c.CnhNumber); - builder.HasIndex(c => c.Code); + builder.HasIndex(c => c.Code); } } } diff --git a/OneBus.Infra.Data/Mappings/EmployeeWorkdayMapping.cs b/OneBus.Infra.Data/Mappings/EmployeeWorkdayMapping.cs index 8bb1f31..0974109 100644 --- a/OneBus.Infra.Data/Mappings/EmployeeWorkdayMapping.cs +++ b/OneBus.Infra.Data/Mappings/EmployeeWorkdayMapping.cs @@ -8,14 +8,8 @@ public class EmployeeWorkdayMapping : BaseEntityMapping { public override void Configure(EntityTypeBuilder builder) { - builder.ToTable("FuncionarioHorario"); base.Configure(builder); - builder.Property(c => c.EmployeeId).HasColumnName("FuncionarioId"); - builder.Property(c => c.StartTime).HasColumnName("HoraInicio"); - builder.Property(c => c.EndTime).HasColumnName("HoraFim"); - builder.Property(c => c.DayType).HasColumnName("Dia").HasConversion(); - builder .HasOne(c => c.Employee) .WithMany(c => c.EmployeeWorkdays) diff --git a/OneBus.Infra.Data/Mappings/LineMapping.cs b/OneBus.Infra.Data/Mappings/LineMapping.cs index c520223..5c865a1 100644 --- a/OneBus.Infra.Data/Mappings/LineMapping.cs +++ b/OneBus.Infra.Data/Mappings/LineMapping.cs @@ -1,5 +1,4 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.EntityFrameworkCore.Metadata.Builders; using OneBus.Domain.Entities; namespace OneBus.Infra.Data.Mappings @@ -8,17 +7,10 @@ public class LineMapping : BaseEntityMapping { public override void Configure(EntityTypeBuilder builder) { - builder.ToTable("Linha"); base.Configure(builder); - builder.Property(c => c.CompanyId).HasColumnName("EmpresaId"); - builder.Property(c => c.Mileage).HasColumnName("Quilometragem"); - builder.Property(c => c.TravelTime).HasColumnName("TempoViagem"); - builder.Property(c => c.Name).HasColumnName("Nome").HasMaxLength(80); - builder.Property(c => c.Number).HasColumnName("Numero").HasMaxLength(20); - builder.Property(c => c.Type).HasColumnName("Tipo").HasConversion(); - builder.Property(c => c.MinNumberBuses).HasColumnName("NumeroMinimoOnibus"); - builder.Property(c => c.MaxNumberBuses).HasColumnName("NumeroMaximoOnibus"); + builder.Property(c => c.Name).HasMaxLength(80); + builder.Property(c => c.Number).HasMaxLength(20); } } } diff --git a/OneBus.Infra.Data/Mappings/LineTimeMapping.cs b/OneBus.Infra.Data/Mappings/LineTimeMapping.cs index 530db62..49699a8 100644 --- a/OneBus.Infra.Data/Mappings/LineTimeMapping.cs +++ b/OneBus.Infra.Data/Mappings/LineTimeMapping.cs @@ -1,5 +1,4 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.EntityFrameworkCore.Metadata.Builders; using OneBus.Domain.Entities; namespace OneBus.Infra.Data.Mappings @@ -8,14 +7,8 @@ public class LineTimeMapping : BaseEntityMapping { public override void Configure(EntityTypeBuilder builder) { - builder.ToTable("LinhaHorario"); base.Configure(builder); - builder.Property(c => c.LineId).HasColumnName("LinhaId"); - builder.Property(c => c.EndTime).HasColumnName("HoraFim"); - builder.Property(c => c.StartTime).HasColumnName("HoraInicio"); - builder.Property(c => c.DayType).HasColumnName("Dia").HasConversion(); - builder .HasOne(c => c.Line) .WithMany(c => c.LineTimes) diff --git a/OneBus.Infra.Data/Mappings/MaintenanceMapping.cs b/OneBus.Infra.Data/Mappings/MaintenanceMapping.cs index 3923af1..185a88c 100644 --- a/OneBus.Infra.Data/Mappings/MaintenanceMapping.cs +++ b/OneBus.Infra.Data/Mappings/MaintenanceMapping.cs @@ -1,5 +1,4 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.EntityFrameworkCore.Metadata.Builders; using OneBus.Domain.Entities; namespace OneBus.Infra.Data.Mappings @@ -8,16 +7,9 @@ public class MaintenanceMapping : BaseEntityMapping { public override void Configure(EntityTypeBuilder builder) { - builder.ToTable("Manutencao"); base.Configure(builder); - builder.Property(c => c.Cost).HasColumnName("Custo"); - builder.Property(c => c.EndDate).HasColumnName("DataFim"); - builder.Property(c => c.VehicleId).HasColumnName("VeiculoId"); - builder.Property(c => c.StartDate).HasColumnName("DataInicio"); - builder.Property(c => c.Sector).HasColumnName("Setor").HasConversion(); - builder.Property(c => c.SurveyExpiration).HasColumnName("VistoriaVencimento"); - builder.Property(c => c.Description).HasColumnName("Descricao").HasMaxLength(150); + builder.Property(c => c.Description).HasMaxLength(150); builder .HasOne(c => c.Vehicle) diff --git a/OneBus.Infra.Data/Mappings/VehicleMapping.cs b/OneBus.Infra.Data/Mappings/VehicleMapping.cs index 9a81e5f..814a9b7 100644 --- a/OneBus.Infra.Data/Mappings/VehicleMapping.cs +++ b/OneBus.Infra.Data/Mappings/VehicleMapping.cs @@ -1,5 +1,4 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.EntityFrameworkCore.Metadata.Builders; using OneBus.Domain.Entities; namespace OneBus.Infra.Data.Mappings @@ -8,35 +7,21 @@ public class VehicleMapping : BaseEntityMapping { public override void Configure(EntityTypeBuilder builder) { - builder.ToTable("Veiculo"); base.Configure(builder); builder.Property(c => c.Renavam).HasMaxLength(20); - builder.Property(c => c.Year).HasColumnName("Ano"); - builder.Property(c => c.Status).HasConversion(); - builder.Property(c => c.AxesNumber).HasColumnName("NumeroEixos"); - builder.Property(c => c.NumberDoors).HasColumnName("NumeroPortas"); - builder.Property(c => c.NumberSeats).HasColumnName("NumeroAssentos"); - builder.Property(c => c.Color).HasColumnName("Cor").HasMaxLength(30); - builder.Property(c => c.Image).HasColumnName("Foto").HasMaxLength(20); - builder.Property(c => c.Brand).HasColumnName("Marca").HasMaxLength(50); - builder.Property(c => c.Plate).HasColumnName("Placa").HasMaxLength(15); - builder.Property(c => c.Model).HasColumnName("Modelo").HasMaxLength(50); - builder.Property(c => c.IpvaExpiration).HasColumnName("IpvaVencimento"); - builder.Property(c => c.AcquisitionDate).HasColumnName("DataAquisicao"); - builder.Property(c => c.Prefix).HasColumnName("Prefixo").HasMaxLength(30); - builder.Property(c => c.Type).HasColumnName("Tipo").HasConversion(); - builder.Property(c => c.HasAccessibility).HasColumnName("TemAcessibilidade"); - builder.Property(c => c.EngineNumber).HasColumnName("NumeroMotor").HasMaxLength(20); - builder.Property(c => c.NumberChassis).HasColumnName("NumeroChassi").HasMaxLength(20); - builder.Property(c => c.LicensingExpiration).HasColumnName("LicenciamentoVencimento"); - builder.Property(c => c.FuelType).HasColumnName("TipoCombustivel").HasConversion(); - builder.Property(c => c.BodyworkNumber).HasColumnName("NumeroCarroceria").HasMaxLength(20); - builder.Property(c => c.TransmissionType).HasColumnName("TipoTransmissao").HasConversion(); + builder.Property(c => c.Color).HasMaxLength(20); + builder.Property(c => c.Brand).HasMaxLength(50); + builder.Property(c => c.Plate).HasMaxLength(20); + builder.Property(c => c.Model).HasMaxLength(50); + builder.Property(c => c.Prefix).HasMaxLength(30); + builder.Property(c => c.EngineNumber).HasMaxLength(20); + builder.Property(c => c.NumberChassis).HasMaxLength(20); + builder.Property(c => c.BodyworkNumber).HasMaxLength(20); builder.HasIndex(c => c.Plate); builder.HasIndex(c => c.Prefix); - builder.HasIndex(c => c.Renavam); + builder.HasIndex(c => c.Renavam); } } } diff --git a/OneBus.Infra.Data/Mappings/VehicleOperationMapping.cs b/OneBus.Infra.Data/Mappings/VehicleOperationMapping.cs index 0451392..1d594ac 100644 --- a/OneBus.Infra.Data/Mappings/VehicleOperationMapping.cs +++ b/OneBus.Infra.Data/Mappings/VehicleOperationMapping.cs @@ -1,5 +1,4 @@ -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; +using Microsoft.EntityFrameworkCore.Metadata.Builders; using OneBus.Domain.Entities; namespace OneBus.Infra.Data.Mappings @@ -8,13 +7,8 @@ public class VehicleOperationMapping : BaseEntityMapping { public override void Configure(EntityTypeBuilder builder) { - builder.ToTable("VeiculoOperacao"); base.Configure(builder); - builder.Property(c => c.Date).HasColumnName("Data"); - builder.Property(c => c.VehicleId).HasColumnName("VeiculoId"); - builder.Property(c => c.EmployeeWorkdayId).HasColumnName("FuncionarioHorarioId"); - builder .HasOne(c => c.Vehicle) .WithMany(c => c.VehicleOperations) From ea6e223748b70c4f1f1136c533946027c3320113 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 01:15:58 -0300 Subject: [PATCH 34/41] =?UTF-8?q?=E2=9C=A8feat:=20Add=20Migration?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adding Initial Migration --- ...0250824041047_InitialMigration.Designer.cs | 694 ++++++++++++++++++ .../20250824041047_InitialMigration.cs | 402 ++++++++++ .../OneBusDbContextModelSnapshot.cs | 691 +++++++++++++++++ 3 files changed, 1787 insertions(+) create mode 100644 OneBus.Infra.Data/Migrations/20250824041047_InitialMigration.Designer.cs create mode 100644 OneBus.Infra.Data/Migrations/20250824041047_InitialMigration.cs create mode 100644 OneBus.Infra.Data/Migrations/OneBusDbContextModelSnapshot.cs diff --git a/OneBus.Infra.Data/Migrations/20250824041047_InitialMigration.Designer.cs b/OneBus.Infra.Data/Migrations/20250824041047_InitialMigration.Designer.cs new file mode 100644 index 0000000..49a1d82 --- /dev/null +++ b/OneBus.Infra.Data/Migrations/20250824041047_InitialMigration.Designer.cs @@ -0,0 +1,694 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using OneBus.Infra.Data.DbContexts; + +#nullable disable + +namespace OneBus.Infra.Data.Migrations +{ + [DbContext(typeof(OneBusDbContext))] + [Migration("20250824041047_InitialMigration")] + partial class InitialMigration + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("OneBus.Domain.Entities.Bus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ChassisBrand") + .IsRequired() + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("character varying(50)"); + + b.Property("ChassisModel") + .IsRequired() + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("character varying(50)"); + + b.Property("ChassisYear") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("FumigateExpiration") + .HasColumnType("date"); + + b.Property("HasLeftDoors") + .HasColumnType("boolean"); + + b.Property("HasLowFloor") + .HasColumnType("boolean"); + + b.Property("InsuranceExpiration") + .HasColumnType("date"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("ServiceType") + .HasColumnType("smallint"); + + b.Property("VehicleId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("VehicleId"); + + b.ToTable("Bus"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.BusOperation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("BusId") + .HasColumnType("bigint"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Date") + .HasColumnType("date"); + + b.Property("EmployeeWorkDayId") + .HasColumnType("bigint"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("LineTimeId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("BusId"); + + b.HasIndex("EmployeeWorkDayId"); + + b.HasIndex("LineTimeId"); + + b.ToTable("BusOperation"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("BloodType") + .HasColumnType("smallint"); + + b.Property("CnhCategory") + .HasColumnType("smallint"); + + b.Property("CnhExpiration") + .HasColumnType("date"); + + b.Property("CnhNumber") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(30) + .IsUnicode(false) + .HasColumnType("character varying(30)"); + + b.Property("Cpf") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(80) + .IsUnicode(false) + .HasColumnType("character varying(80)"); + + b.Property("HiringDate") + .HasColumnType("date"); + + b.Property("Image") + .HasColumnType("bytea"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(80) + .IsUnicode(false) + .HasColumnType("character varying(80)"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("Rg") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("Role") + .HasColumnType("smallint"); + + b.Property("Status") + .HasColumnType("smallint"); + + b.HasKey("Id"); + + b.HasIndex("CnhNumber"); + + b.HasIndex("Code"); + + b.HasIndex("Cpf"); + + b.ToTable("Employee"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.EmployeeWorkday", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("DayType") + .HasColumnType("smallint"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("EndTime") + .HasColumnType("time without time zone"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("StartTime") + .HasColumnType("time without time zone"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeWorkday"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Line", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("MaxNumberBuses") + .HasColumnType("smallint"); + + b.Property("Mileage") + .HasPrecision(19, 4) + .HasColumnType("numeric(19,4)"); + + b.Property("MinNumberBuses") + .HasColumnType("smallint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(80) + .IsUnicode(false) + .HasColumnType("character varying(80)"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("TravelTime") + .HasColumnType("time without time zone"); + + b.Property("Type") + .HasColumnType("smallint"); + + b.HasKey("Id"); + + b.ToTable("Line"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.LineTime", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("DayType") + .HasColumnType("smallint"); + + b.Property("EndTime") + .HasColumnType("time without time zone"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("LineId") + .HasColumnType("bigint"); + + b.Property("StartTime") + .HasColumnType("time without time zone"); + + b.HasKey("Id"); + + b.HasIndex("LineId"); + + b.ToTable("LineTime"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Maintenance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Cost") + .HasPrecision(19, 4) + .HasColumnType("numeric(19,4)"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(150) + .IsUnicode(false) + .HasColumnType("character varying(150)"); + + b.Property("EndDate") + .HasColumnType("date"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("Sector") + .HasColumnType("smallint"); + + b.Property("StartDate") + .HasColumnType("date"); + + b.Property("SurveyExpiration") + .HasColumnType("date"); + + b.Property("VehicleId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("VehicleId"); + + b.ToTable("Maintenance"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(80) + .IsUnicode(false) + .HasColumnType("character varying(80)"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(80) + .IsUnicode(false) + .HasColumnType("character varying(80)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("character varying(50)"); + + b.Property("Salt") + .IsRequired() + .HasMaxLength(32) + .IsUnicode(false) + .HasColumnType("character varying(32)"); + + b.HasKey("Id"); + + b.ToTable("User"); + + b.HasData( + new + { + Id = 1L, + CreatedAt = new DateTime(2025, 8, 25, 0, 0, 0, 0, DateTimeKind.Utc), + Email = "onebus@admin", + IsDeleted = false, + Name = "Administrador", + Password = "YRT66Z4XEJ2SSNaJVDIXQW7uvC8LSvOxDU1sH/Sr/ic=", + Salt = "c37b6028194d489192aac9391801594a" + }); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Vehicle", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AcquisitionDate") + .HasColumnType("date"); + + b.Property("AxesNumber") + .HasColumnType("smallint"); + + b.Property("BodyworkNumber") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("Brand") + .IsRequired() + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("character varying(50)"); + + b.Property("Color") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("EngineNumber") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("FuelType") + .HasColumnType("smallint"); + + b.Property("HasAccessibility") + .HasColumnType("boolean"); + + b.Property("Image") + .HasColumnType("bytea"); + + b.Property("IpvaExpiration") + .HasColumnType("date"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("LicensingExpiration") + .HasColumnType("date"); + + b.Property("Model") + .IsRequired() + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("character varying(50)"); + + b.Property("NumberChassis") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("NumberDoors") + .HasColumnType("smallint"); + + b.Property("NumberSeats") + .HasColumnType("smallint"); + + b.Property("Plate") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("Prefix") + .IsRequired() + .HasMaxLength(30) + .IsUnicode(false) + .HasColumnType("character varying(30)"); + + b.Property("Renavam") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("Status") + .HasColumnType("smallint"); + + b.Property("TransmissionType") + .HasColumnType("smallint"); + + b.Property("Type") + .HasColumnType("smallint"); + + b.Property("Year") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("Plate"); + + b.HasIndex("Prefix"); + + b.HasIndex("Renavam"); + + b.ToTable("Vehicle"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.VehicleOperation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Date") + .HasColumnType("date"); + + b.Property("EmployeeWorkdayId") + .HasColumnType("bigint"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("VehicleId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeWorkdayId"); + + b.HasIndex("VehicleId"); + + b.ToTable("VehicleOperation"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Bus", b => + { + b.HasOne("OneBus.Domain.Entities.Vehicle", "Vehicle") + .WithMany("Buses") + .HasForeignKey("VehicleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Vehicle"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.BusOperation", b => + { + b.HasOne("OneBus.Domain.Entities.Bus", "Bus") + .WithMany("BusOperations") + .HasForeignKey("BusId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("OneBus.Domain.Entities.EmployeeWorkday", "EmployeeWorkday") + .WithMany("BusOperations") + .HasForeignKey("EmployeeWorkDayId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("OneBus.Domain.Entities.LineTime", "LineTime") + .WithMany("BusOperations") + .HasForeignKey("LineTimeId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Bus"); + + b.Navigation("EmployeeWorkday"); + + b.Navigation("LineTime"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.EmployeeWorkday", b => + { + b.HasOne("OneBus.Domain.Entities.Employee", "Employee") + .WithMany("EmployeeWorkdays") + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.LineTime", b => + { + b.HasOne("OneBus.Domain.Entities.Line", "Line") + .WithMany("LineTimes") + .HasForeignKey("LineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Line"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Maintenance", b => + { + b.HasOne("OneBus.Domain.Entities.Vehicle", "Vehicle") + .WithMany("Maintenances") + .HasForeignKey("VehicleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Vehicle"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.VehicleOperation", b => + { + b.HasOne("OneBus.Domain.Entities.EmployeeWorkday", "EmployeeWorkday") + .WithMany("VehicleOperations") + .HasForeignKey("EmployeeWorkdayId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("OneBus.Domain.Entities.Vehicle", "Vehicle") + .WithMany("VehicleOperations") + .HasForeignKey("VehicleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("EmployeeWorkday"); + + b.Navigation("Vehicle"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Bus", b => + { + b.Navigation("BusOperations"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Employee", b => + { + b.Navigation("EmployeeWorkdays"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.EmployeeWorkday", b => + { + b.Navigation("BusOperations"); + + b.Navigation("VehicleOperations"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Line", b => + { + b.Navigation("LineTimes"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.LineTime", b => + { + b.Navigation("BusOperations"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Vehicle", b => + { + b.Navigation("Buses"); + + b.Navigation("Maintenances"); + + b.Navigation("VehicleOperations"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/OneBus.Infra.Data/Migrations/20250824041047_InitialMigration.cs b/OneBus.Infra.Data/Migrations/20250824041047_InitialMigration.cs new file mode 100644 index 0000000..91849cb --- /dev/null +++ b/OneBus.Infra.Data/Migrations/20250824041047_InitialMigration.cs @@ -0,0 +1,402 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace OneBus.Infra.Data.Migrations +{ + /// + public partial class InitialMigration : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Employee", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "character varying(80)", unicode: false, maxLength: 80, nullable: false), + Rg = table.Column(type: "character varying(20)", unicode: false, maxLength: 20, nullable: false), + Cpf = table.Column(type: "character varying(20)", unicode: false, maxLength: 20, nullable: false), + BloodType = table.Column(type: "smallint", nullable: true), + Code = table.Column(type: "character varying(30)", unicode: false, maxLength: 30, nullable: false), + Role = table.Column(type: "smallint", nullable: false), + Email = table.Column(type: "character varying(80)", unicode: false, maxLength: 80, nullable: false), + Phone = table.Column(type: "character varying(20)", unicode: false, maxLength: 20, nullable: false), + HiringDate = table.Column(type: "date", nullable: false), + CnhNumber = table.Column(type: "character varying(20)", unicode: false, maxLength: 20, nullable: true), + CnhCategory = table.Column(type: "smallint", nullable: true), + CnhExpiration = table.Column(type: "date", nullable: true), + Status = table.Column(type: "smallint", nullable: false), + Image = table.Column(type: "bytea", nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + IsDeleted = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Employee", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Line", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Number = table.Column(type: "character varying(20)", unicode: false, maxLength: 20, nullable: false), + Name = table.Column(type: "character varying(80)", unicode: false, maxLength: 80, nullable: false), + Type = table.Column(type: "smallint", nullable: false), + TravelTime = table.Column(type: "time without time zone", nullable: false), + Mileage = table.Column(type: "numeric(19,4)", precision: 19, scale: 4, nullable: false), + MinNumberBuses = table.Column(type: "smallint", nullable: false), + MaxNumberBuses = table.Column(type: "smallint", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + IsDeleted = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Line", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "User", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Name = table.Column(type: "character varying(80)", unicode: false, maxLength: 80, nullable: false), + Email = table.Column(type: "character varying(80)", unicode: false, maxLength: 80, nullable: false), + Password = table.Column(type: "character varying(50)", unicode: false, maxLength: 50, nullable: false), + Salt = table.Column(type: "character varying(32)", unicode: false, maxLength: 32, nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + IsDeleted = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_User", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Vehicle", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + Type = table.Column(type: "smallint", nullable: false), + Prefix = table.Column(type: "character varying(30)", unicode: false, maxLength: 30, nullable: false), + NumberDoors = table.Column(type: "smallint", nullable: false), + NumberSeats = table.Column(type: "smallint", nullable: false), + HasAccessibility = table.Column(type: "boolean", nullable: false), + FuelType = table.Column(type: "smallint", nullable: false), + Brand = table.Column(type: "character varying(50)", unicode: false, maxLength: 50, nullable: false), + Model = table.Column(type: "character varying(50)", unicode: false, maxLength: 50, nullable: false), + Year = table.Column(type: "integer", nullable: false), + Plate = table.Column(type: "character varying(20)", unicode: false, maxLength: 20, nullable: false), + Color = table.Column(type: "character varying(20)", unicode: false, maxLength: 20, nullable: true), + BodyworkNumber = table.Column(type: "character varying(20)", unicode: false, maxLength: 20, nullable: true), + NumberChassis = table.Column(type: "character varying(20)", unicode: false, maxLength: 20, nullable: true), + EngineNumber = table.Column(type: "character varying(20)", unicode: false, maxLength: 20, nullable: true), + AxesNumber = table.Column(type: "smallint", nullable: false), + IpvaExpiration = table.Column(type: "date", nullable: false), + LicensingExpiration = table.Column(type: "date", nullable: false), + Renavam = table.Column(type: "character varying(20)", unicode: false, maxLength: 20, nullable: false), + TransmissionType = table.Column(type: "smallint", nullable: false), + AcquisitionDate = table.Column(type: "date", nullable: false), + Status = table.Column(type: "smallint", nullable: false), + Image = table.Column(type: "bytea", nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + IsDeleted = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Vehicle", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "EmployeeWorkday", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + EmployeeId = table.Column(type: "bigint", nullable: false), + StartTime = table.Column(type: "time without time zone", nullable: false), + EndTime = table.Column(type: "time without time zone", nullable: false), + DayType = table.Column(type: "smallint", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + IsDeleted = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_EmployeeWorkday", x => x.Id); + table.ForeignKey( + name: "FK_EmployeeWorkday_Employee_EmployeeId", + column: x => x.EmployeeId, + principalTable: "Employee", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "LineTime", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + LineId = table.Column(type: "bigint", nullable: false), + StartTime = table.Column(type: "time without time zone", nullable: false), + EndTime = table.Column(type: "time without time zone", nullable: false), + DayType = table.Column(type: "smallint", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + IsDeleted = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_LineTime", x => x.Id); + table.ForeignKey( + name: "FK_LineTime_Line_LineId", + column: x => x.LineId, + principalTable: "Line", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Bus", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + VehicleId = table.Column(type: "bigint", nullable: false), + ServiceType = table.Column(type: "smallint", nullable: false), + ChassisBrand = table.Column(type: "character varying(50)", unicode: false, maxLength: 50, nullable: false), + ChassisModel = table.Column(type: "character varying(50)", unicode: false, maxLength: 50, nullable: false), + ChassisYear = table.Column(type: "integer", nullable: false), + HasLowFloor = table.Column(type: "boolean", nullable: false), + HasLeftDoors = table.Column(type: "boolean", nullable: false), + InsuranceExpiration = table.Column(type: "date", nullable: false), + FumigateExpiration = table.Column(type: "date", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + IsDeleted = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Bus", x => x.Id); + table.ForeignKey( + name: "FK_Bus_Vehicle_VehicleId", + column: x => x.VehicleId, + principalTable: "Vehicle", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Maintenance", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + VehicleId = table.Column(type: "bigint", nullable: false), + Sector = table.Column(type: "smallint", nullable: false), + Description = table.Column(type: "character varying(150)", unicode: false, maxLength: 150, nullable: false), + StartDate = table.Column(type: "date", nullable: false), + EndDate = table.Column(type: "date", nullable: false), + SurveyExpiration = table.Column(type: "date", nullable: false), + Cost = table.Column(type: "numeric(19,4)", precision: 19, scale: 4, nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + IsDeleted = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Maintenance", x => x.Id); + table.ForeignKey( + name: "FK_Maintenance_Vehicle_VehicleId", + column: x => x.VehicleId, + principalTable: "Vehicle", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "VehicleOperation", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + EmployeeWorkdayId = table.Column(type: "bigint", nullable: false), + VehicleId = table.Column(type: "bigint", nullable: false), + Date = table.Column(type: "date", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + IsDeleted = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_VehicleOperation", x => x.Id); + table.ForeignKey( + name: "FK_VehicleOperation_EmployeeWorkday_EmployeeWorkdayId", + column: x => x.EmployeeWorkdayId, + principalTable: "EmployeeWorkday", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_VehicleOperation_Vehicle_VehicleId", + column: x => x.VehicleId, + principalTable: "Vehicle", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "BusOperation", + columns: table => new + { + Id = table.Column(type: "bigint", nullable: false) + .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), + LineTimeId = table.Column(type: "bigint", nullable: false), + EmployeeWorkDayId = table.Column(type: "bigint", nullable: false), + BusId = table.Column(type: "bigint", nullable: false), + Date = table.Column(type: "date", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + IsDeleted = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_BusOperation", x => x.Id); + table.ForeignKey( + name: "FK_BusOperation_Bus_BusId", + column: x => x.BusId, + principalTable: "Bus", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_BusOperation_EmployeeWorkday_EmployeeWorkDayId", + column: x => x.EmployeeWorkDayId, + principalTable: "EmployeeWorkday", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_BusOperation_LineTime_LineTimeId", + column: x => x.LineTimeId, + principalTable: "LineTime", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.InsertData( + table: "User", + columns: new[] { "Id", "CreatedAt", "Email", "IsDeleted", "Name", "Password", "Salt" }, + values: new object[] { 1L, new DateTime(2025, 8, 25, 0, 0, 0, 0, DateTimeKind.Utc), "onebus@admin", false, "Administrador", "YRT66Z4XEJ2SSNaJVDIXQW7uvC8LSvOxDU1sH/Sr/ic=", "c37b6028194d489192aac9391801594a" }); + + migrationBuilder.CreateIndex( + name: "IX_Bus_VehicleId", + table: "Bus", + column: "VehicleId"); + + migrationBuilder.CreateIndex( + name: "IX_BusOperation_BusId", + table: "BusOperation", + column: "BusId"); + + migrationBuilder.CreateIndex( + name: "IX_BusOperation_EmployeeWorkDayId", + table: "BusOperation", + column: "EmployeeWorkDayId"); + + migrationBuilder.CreateIndex( + name: "IX_BusOperation_LineTimeId", + table: "BusOperation", + column: "LineTimeId"); + + migrationBuilder.CreateIndex( + name: "IX_Employee_CnhNumber", + table: "Employee", + column: "CnhNumber"); + + migrationBuilder.CreateIndex( + name: "IX_Employee_Code", + table: "Employee", + column: "Code"); + + migrationBuilder.CreateIndex( + name: "IX_Employee_Cpf", + table: "Employee", + column: "Cpf"); + + migrationBuilder.CreateIndex( + name: "IX_EmployeeWorkday_EmployeeId", + table: "EmployeeWorkday", + column: "EmployeeId"); + + migrationBuilder.CreateIndex( + name: "IX_LineTime_LineId", + table: "LineTime", + column: "LineId"); + + migrationBuilder.CreateIndex( + name: "IX_Maintenance_VehicleId", + table: "Maintenance", + column: "VehicleId"); + + migrationBuilder.CreateIndex( + name: "IX_Vehicle_Plate", + table: "Vehicle", + column: "Plate"); + + migrationBuilder.CreateIndex( + name: "IX_Vehicle_Prefix", + table: "Vehicle", + column: "Prefix"); + + migrationBuilder.CreateIndex( + name: "IX_Vehicle_Renavam", + table: "Vehicle", + column: "Renavam"); + + migrationBuilder.CreateIndex( + name: "IX_VehicleOperation_EmployeeWorkdayId", + table: "VehicleOperation", + column: "EmployeeWorkdayId"); + + migrationBuilder.CreateIndex( + name: "IX_VehicleOperation_VehicleId", + table: "VehicleOperation", + column: "VehicleId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "BusOperation"); + + migrationBuilder.DropTable( + name: "Maintenance"); + + migrationBuilder.DropTable( + name: "User"); + + migrationBuilder.DropTable( + name: "VehicleOperation"); + + migrationBuilder.DropTable( + name: "Bus"); + + migrationBuilder.DropTable( + name: "LineTime"); + + migrationBuilder.DropTable( + name: "EmployeeWorkday"); + + migrationBuilder.DropTable( + name: "Vehicle"); + + migrationBuilder.DropTable( + name: "Line"); + + migrationBuilder.DropTable( + name: "Employee"); + } + } +} diff --git a/OneBus.Infra.Data/Migrations/OneBusDbContextModelSnapshot.cs b/OneBus.Infra.Data/Migrations/OneBusDbContextModelSnapshot.cs new file mode 100644 index 0000000..657adab --- /dev/null +++ b/OneBus.Infra.Data/Migrations/OneBusDbContextModelSnapshot.cs @@ -0,0 +1,691 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using OneBus.Infra.Data.DbContexts; + +#nullable disable + +namespace OneBus.Infra.Data.Migrations +{ + [DbContext(typeof(OneBusDbContext))] + partial class OneBusDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("OneBus.Domain.Entities.Bus", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ChassisBrand") + .IsRequired() + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("character varying(50)"); + + b.Property("ChassisModel") + .IsRequired() + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("character varying(50)"); + + b.Property("ChassisYear") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("FumigateExpiration") + .HasColumnType("date"); + + b.Property("HasLeftDoors") + .HasColumnType("boolean"); + + b.Property("HasLowFloor") + .HasColumnType("boolean"); + + b.Property("InsuranceExpiration") + .HasColumnType("date"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("ServiceType") + .HasColumnType("smallint"); + + b.Property("VehicleId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("VehicleId"); + + b.ToTable("Bus"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.BusOperation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("BusId") + .HasColumnType("bigint"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Date") + .HasColumnType("date"); + + b.Property("EmployeeWorkDayId") + .HasColumnType("bigint"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("LineTimeId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("BusId"); + + b.HasIndex("EmployeeWorkDayId"); + + b.HasIndex("LineTimeId"); + + b.ToTable("BusOperation"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Employee", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("BloodType") + .HasColumnType("smallint"); + + b.Property("CnhCategory") + .HasColumnType("smallint"); + + b.Property("CnhExpiration") + .HasColumnType("date"); + + b.Property("CnhNumber") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("Code") + .IsRequired() + .HasMaxLength(30) + .IsUnicode(false) + .HasColumnType("character varying(30)"); + + b.Property("Cpf") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(80) + .IsUnicode(false) + .HasColumnType("character varying(80)"); + + b.Property("HiringDate") + .HasColumnType("date"); + + b.Property("Image") + .HasColumnType("bytea"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(80) + .IsUnicode(false) + .HasColumnType("character varying(80)"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("Rg") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("Role") + .HasColumnType("smallint"); + + b.Property("Status") + .HasColumnType("smallint"); + + b.HasKey("Id"); + + b.HasIndex("CnhNumber"); + + b.HasIndex("Code"); + + b.HasIndex("Cpf"); + + b.ToTable("Employee"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.EmployeeWorkday", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("DayType") + .HasColumnType("smallint"); + + b.Property("EmployeeId") + .HasColumnType("bigint"); + + b.Property("EndTime") + .HasColumnType("time without time zone"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("StartTime") + .HasColumnType("time without time zone"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeId"); + + b.ToTable("EmployeeWorkday"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Line", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("MaxNumberBuses") + .HasColumnType("smallint"); + + b.Property("Mileage") + .HasPrecision(19, 4) + .HasColumnType("numeric(19,4)"); + + b.Property("MinNumberBuses") + .HasColumnType("smallint"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(80) + .IsUnicode(false) + .HasColumnType("character varying(80)"); + + b.Property("Number") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("TravelTime") + .HasColumnType("time without time zone"); + + b.Property("Type") + .HasColumnType("smallint"); + + b.HasKey("Id"); + + b.ToTable("Line"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.LineTime", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("DayType") + .HasColumnType("smallint"); + + b.Property("EndTime") + .HasColumnType("time without time zone"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("LineId") + .HasColumnType("bigint"); + + b.Property("StartTime") + .HasColumnType("time without time zone"); + + b.HasKey("Id"); + + b.HasIndex("LineId"); + + b.ToTable("LineTime"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Maintenance", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("Cost") + .HasPrecision(19, 4) + .HasColumnType("numeric(19,4)"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .IsRequired() + .HasMaxLength(150) + .IsUnicode(false) + .HasColumnType("character varying(150)"); + + b.Property("EndDate") + .HasColumnType("date"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("Sector") + .HasColumnType("smallint"); + + b.Property("StartDate") + .HasColumnType("date"); + + b.Property("SurveyExpiration") + .HasColumnType("date"); + + b.Property("VehicleId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("VehicleId"); + + b.ToTable("Maintenance"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(80) + .IsUnicode(false) + .HasColumnType("character varying(80)"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(80) + .IsUnicode(false) + .HasColumnType("character varying(80)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("character varying(50)"); + + b.Property("Salt") + .IsRequired() + .HasMaxLength(32) + .IsUnicode(false) + .HasColumnType("character varying(32)"); + + b.HasKey("Id"); + + b.ToTable("User"); + + b.HasData( + new + { + Id = 1L, + CreatedAt = new DateTime(2025, 8, 25, 0, 0, 0, 0, DateTimeKind.Utc), + Email = "onebus@admin", + IsDeleted = false, + Name = "Administrador", + Password = "YRT66Z4XEJ2SSNaJVDIXQW7uvC8LSvOxDU1sH/Sr/ic=", + Salt = "c37b6028194d489192aac9391801594a" + }); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Vehicle", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("AcquisitionDate") + .HasColumnType("date"); + + b.Property("AxesNumber") + .HasColumnType("smallint"); + + b.Property("BodyworkNumber") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("Brand") + .IsRequired() + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("character varying(50)"); + + b.Property("Color") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("EngineNumber") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("FuelType") + .HasColumnType("smallint"); + + b.Property("HasAccessibility") + .HasColumnType("boolean"); + + b.Property("Image") + .HasColumnType("bytea"); + + b.Property("IpvaExpiration") + .HasColumnType("date"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("LicensingExpiration") + .HasColumnType("date"); + + b.Property("Model") + .IsRequired() + .HasMaxLength(50) + .IsUnicode(false) + .HasColumnType("character varying(50)"); + + b.Property("NumberChassis") + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("NumberDoors") + .HasColumnType("smallint"); + + b.Property("NumberSeats") + .HasColumnType("smallint"); + + b.Property("Plate") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("Prefix") + .IsRequired() + .HasMaxLength(30) + .IsUnicode(false) + .HasColumnType("character varying(30)"); + + b.Property("Renavam") + .IsRequired() + .HasMaxLength(20) + .IsUnicode(false) + .HasColumnType("character varying(20)"); + + b.Property("Status") + .HasColumnType("smallint"); + + b.Property("TransmissionType") + .HasColumnType("smallint"); + + b.Property("Type") + .HasColumnType("smallint"); + + b.Property("Year") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("Plate"); + + b.HasIndex("Prefix"); + + b.HasIndex("Renavam"); + + b.ToTable("Vehicle"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.VehicleOperation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Date") + .HasColumnType("date"); + + b.Property("EmployeeWorkdayId") + .HasColumnType("bigint"); + + b.Property("IsDeleted") + .HasColumnType("boolean"); + + b.Property("VehicleId") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("EmployeeWorkdayId"); + + b.HasIndex("VehicleId"); + + b.ToTable("VehicleOperation"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Bus", b => + { + b.HasOne("OneBus.Domain.Entities.Vehicle", "Vehicle") + .WithMany("Buses") + .HasForeignKey("VehicleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Vehicle"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.BusOperation", b => + { + b.HasOne("OneBus.Domain.Entities.Bus", "Bus") + .WithMany("BusOperations") + .HasForeignKey("BusId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("OneBus.Domain.Entities.EmployeeWorkday", "EmployeeWorkday") + .WithMany("BusOperations") + .HasForeignKey("EmployeeWorkDayId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("OneBus.Domain.Entities.LineTime", "LineTime") + .WithMany("BusOperations") + .HasForeignKey("LineTimeId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Bus"); + + b.Navigation("EmployeeWorkday"); + + b.Navigation("LineTime"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.EmployeeWorkday", b => + { + b.HasOne("OneBus.Domain.Entities.Employee", "Employee") + .WithMany("EmployeeWorkdays") + .HasForeignKey("EmployeeId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Employee"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.LineTime", b => + { + b.HasOne("OneBus.Domain.Entities.Line", "Line") + .WithMany("LineTimes") + .HasForeignKey("LineId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Line"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Maintenance", b => + { + b.HasOne("OneBus.Domain.Entities.Vehicle", "Vehicle") + .WithMany("Maintenances") + .HasForeignKey("VehicleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Vehicle"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.VehicleOperation", b => + { + b.HasOne("OneBus.Domain.Entities.EmployeeWorkday", "EmployeeWorkday") + .WithMany("VehicleOperations") + .HasForeignKey("EmployeeWorkdayId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("OneBus.Domain.Entities.Vehicle", "Vehicle") + .WithMany("VehicleOperations") + .HasForeignKey("VehicleId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("EmployeeWorkday"); + + b.Navigation("Vehicle"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Bus", b => + { + b.Navigation("BusOperations"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Employee", b => + { + b.Navigation("EmployeeWorkdays"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.EmployeeWorkday", b => + { + b.Navigation("BusOperations"); + + b.Navigation("VehicleOperations"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Line", b => + { + b.Navigation("LineTimes"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.LineTime", b => + { + b.Navigation("BusOperations"); + }); + + modelBuilder.Entity("OneBus.Domain.Entities.Vehicle", b => + { + b.Navigation("Buses"); + + b.Navigation("Maintenances"); + + b.Navigation("VehicleOperations"); + }); +#pragma warning restore 612, 618 + } + } +} From d7d1ec2c937705e6f36295bea9b2fa4400a9913a Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 01:18:46 -0300 Subject: [PATCH 35/41] =?UTF-8?q?=F0=9F=A7=B9cleanup:=20Update=20BaseReadD?= =?UTF-8?q?TO?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing DeletedAt field because it's unnecessary --- OneBus.Application/DTOs/BaseReadDTO.cs | 3 --- 1 file changed, 3 deletions(-) diff --git a/OneBus.Application/DTOs/BaseReadDTO.cs b/OneBus.Application/DTOs/BaseReadDTO.cs index aa6f0d4..9ad7619 100644 --- a/OneBus.Application/DTOs/BaseReadDTO.cs +++ b/OneBus.Application/DTOs/BaseReadDTO.cs @@ -9,8 +9,5 @@ public abstract class BaseReadDTO [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)] public DateTime CreatedAt { get; set; } - - [JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] - public DateTime? DeletedAt { get; set; } } } From 32734826c14b821d5f9a18e5acbd7ca82e099fbf Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 01:24:22 -0300 Subject: [PATCH 36/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Us?= =?UTF-8?q?er=20DTOs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing unnecessary fields --- OneBus.Application/DTOs/User/CreateUserDTO.cs | 19 +------------------ OneBus.Application/DTOs/User/ReadUserDTO.cs | 5 +++-- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/OneBus.Application/DTOs/User/CreateUserDTO.cs b/OneBus.Application/DTOs/User/CreateUserDTO.cs index 9793766..ade3728 100644 --- a/OneBus.Application/DTOs/User/CreateUserDTO.cs +++ b/OneBus.Application/DTOs/User/CreateUserDTO.cs @@ -1,23 +1,6 @@ namespace OneBus.Application.DTOs.User { public class CreateUserDTO : BaseCreateDTO - { - public CreateUserDTO() - { - Name = string.Empty; - Email = string.Empty; - Password = string.Empty; - ConfirmPassword = string.Empty; - } - - public string Name { get; set; } - - public string Email { get; set; } - - public long UserTypeId { get; set; } - - public string Password { get; set; } - - public string ConfirmPassword { get; set; } + { } } diff --git a/OneBus.Application/DTOs/User/ReadUserDTO.cs b/OneBus.Application/DTOs/User/ReadUserDTO.cs index 1e37517..edab6dd 100644 --- a/OneBus.Application/DTOs/User/ReadUserDTO.cs +++ b/OneBus.Application/DTOs/User/ReadUserDTO.cs @@ -4,11 +4,12 @@ public class ReadUserDTO : BaseReadDTO { public ReadUserDTO() { + Name = string.Empty; Email = string.Empty; } - public string Email { get; set; } + public string Name { get; set; } - public long CompanyId { get; set; } + public string Email { get; set; } } } From 80cf2768dcd7279a39df36dcd00bfbd5c896c27a Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 01:24:44 -0300 Subject: [PATCH 37/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Er?= =?UTF-8?q?rorUtils?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating EntityNotFound method error message --- OneBus.Domain/Commons/ErrorUtils.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OneBus.Domain/Commons/ErrorUtils.cs b/OneBus.Domain/Commons/ErrorUtils.cs index be478ff..49c680b 100644 --- a/OneBus.Domain/Commons/ErrorUtils.cs +++ b/OneBus.Domain/Commons/ErrorUtils.cs @@ -8,14 +8,14 @@ public static class ErrorUtils /// public static Error EntityNotFound() { - return new Error("Entidade não encontrada.", "id"); + return new Error("Registro não encontrado.", "id"); } /// /// Id da rota e Id do corpo estão diferentes. /// /// - public static Error IdConflict() + public static Error IdConflict() { return new Error("Id da rota e Id do corpo estão diferentes.", "ids"); } From 2edbe9ba846857187e8371b47ac5eb8386112cd1 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 01:25:17 -0300 Subject: [PATCH 38/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20To?= =?UTF-8?q?kenService?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing company_id claim because it's unnecessary --- OneBus.Application/Services/TokenService.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/OneBus.Application/Services/TokenService.cs b/OneBus.Application/Services/TokenService.cs index f32be05..e3bd47f 100644 --- a/OneBus.Application/Services/TokenService.cs +++ b/OneBus.Application/Services/TokenService.cs @@ -24,7 +24,6 @@ public TokenModel Generate(ReadUserDTO user) { var claims = new List { - new("company_id", user.CompanyId.ToString()), new(JwtRegisteredClaimNames.Email, user.Email), new(JwtRegisteredClaimNames.NameId, user.Id.ToString()!), new(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString("N")) From 18ac94043e3430937d4e1f76133c2657b9a080ab Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 02:02:24 -0300 Subject: [PATCH 39/41] =?UTF-8?q?=F0=9F=A7=B9cleanup:=20Update=20Program?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Removing Lower case URLs configuration --- OneBus.API/Program.cs | 7 ------- 1 file changed, 7 deletions(-) diff --git a/OneBus.API/Program.cs b/OneBus.API/Program.cs index 62c01dc..cf7298e 100644 --- a/OneBus.API/Program.cs +++ b/OneBus.API/Program.cs @@ -39,13 +39,6 @@ builder.Configuration.AddEnvironmentVariables(); -// Lower case URLs -builder.Services.AddRouting(c => -{ - c.LowercaseUrls = true; - c.LowercaseQueryStrings = true; -}); - // Add Options Pattern builder.Services .AddOptions() From 2c930bd48b343fb22d07d33760083427ca883386 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 02:03:05 -0300 Subject: [PATCH 40/41] =?UTF-8?q?=F0=9F=93=9Adocs:=20Update=20ErrorUtils?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating EntityNotFound method documentation --- OneBus.Domain/Commons/ErrorUtils.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OneBus.Domain/Commons/ErrorUtils.cs b/OneBus.Domain/Commons/ErrorUtils.cs index 49c680b..0b657c7 100644 --- a/OneBus.Domain/Commons/ErrorUtils.cs +++ b/OneBus.Domain/Commons/ErrorUtils.cs @@ -3,7 +3,7 @@ public static class ErrorUtils { /// - /// Entidade não encontrada. + /// Registro não encontrado. /// /// public static Error EntityNotFound() From daad0b777af5e0c5543e719d0c2716d5bccef215 Mon Sep 17 00:00:00 2001 From: Eduardo Rezende Date: Sun, 24 Aug 2025 02:03:44 -0300 Subject: [PATCH 41/41] =?UTF-8?q?=E2=99=BB=EF=B8=8Frefactor:=20Update=20Co?= =?UTF-8?q?ntrollers?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updating Controllers endpoints and attributes settings --- OneBus.API/Controllers/BaseController.cs | 55 --------- .../Controllers/BaseReadOnlyController.cs | 43 ------- OneBus.API/Controllers/BusController.cs | 114 ----------------- .../Controllers/BusOperationController.cs | 114 ----------------- OneBus.API/Controllers/EmployeeController.cs | 48 +++++--- .../Controllers/EmployeeWorkdayController.cs | 46 ++++--- OneBus.API/Controllers/LineController.cs | 46 ++++--- OneBus.API/Controllers/LineTimeController.cs | 48 +++++--- .../Controllers/MaintenanceController.cs | 48 +++++--- OneBus.API/Controllers/UserController.cs | 115 ++---------------- OneBus.API/Controllers/VehicleController.cs | 48 +++++--- .../Controllers/VehicleOperationController.cs | 48 +++++--- 12 files changed, 226 insertions(+), 547 deletions(-) delete mode 100644 OneBus.API/Controllers/BaseController.cs delete mode 100644 OneBus.API/Controllers/BaseReadOnlyController.cs delete mode 100644 OneBus.API/Controllers/BusController.cs delete mode 100644 OneBus.API/Controllers/BusOperationController.cs diff --git a/OneBus.API/Controllers/BaseController.cs b/OneBus.API/Controllers/BaseController.cs deleted file mode 100644 index 528c9f4..0000000 --- a/OneBus.API/Controllers/BaseController.cs +++ /dev/null @@ -1,55 +0,0 @@ -using OneBus.Application.DTOs; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using OneBus.Application.Interfaces.Services; -using Microsoft.AspNetCore.Mvc; -using OneBus.API.Extensions; -using OneBus.Domain.Commons; -using OneBus.Domain.Commons.Result; - -namespace OneBus.API.Controllers -{ - public abstract class BaseController : BaseReadOnlyController - where TEntity : BaseEntity - where TCreateDTO : BaseCreateDTO - where TReadDTO : BaseReadDTO - where TUpdateDTO : BaseUpdateDTO - where TFilter : BaseFilter - { - protected readonly IBaseService _baseService; - - protected BaseController(IBaseService baseService) - : base(baseService) - { - _baseService = baseService; - } - - [HttpPost] - public async virtual Task CreateAsync( - [FromBody] TCreateDTO createDTO, - CancellationToken cancellationToken = default) - { - return (await _baseService.CreateAsync(createDTO, cancellationToken)).ToActionResult(); - } - - [HttpPut("{id}")] - public async virtual Task UpdateAsync( - [FromRoute] long id, - [FromBody] TUpdateDTO updateDTO, - CancellationToken cancellationToken = default) - { - if (id != updateDTO.Id) - return ConflictResult.Create(ErrorUtils.IdConflict()).ToActionResult(); - - return (await _baseService.UpdateAsync(updateDTO, cancellationToken)).ToActionResult(); - } - - [HttpDelete("{id}")] - public async virtual Task DeleteAsync( - [FromRoute] long id, - CancellationToken cancellationToken = default) - { - return (await _baseService.DeleteAsync(id, cancellationToken)).ToActionResult(); - } - } -} diff --git a/OneBus.API/Controllers/BaseReadOnlyController.cs b/OneBus.API/Controllers/BaseReadOnlyController.cs deleted file mode 100644 index 01a2aba..0000000 --- a/OneBus.API/Controllers/BaseReadOnlyController.cs +++ /dev/null @@ -1,43 +0,0 @@ -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using OneBus.API.Extensions; -using OneBus.Application.DTOs; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; - -namespace OneBus.API.Controllers -{ - [Route("api/v1/[controller]")] - [ApiController] - [Produces("application/json")] - [Authorize] - public abstract class BaseReadOnlyController : ControllerBase - where TEntity : BaseEntity - where TReadDTO : BaseReadDTO - where TFilter : BaseFilter - { - protected readonly IBaseReadOnlyService _baseReadOnlyService; - - protected BaseReadOnlyController(IBaseReadOnlyService baseReadOnlyService) - { - _baseReadOnlyService = baseReadOnlyService; - } - - [HttpGet] - public async virtual Task GetPaginedAsync( - [FromQuery] TFilter filter, - CancellationToken cancellationToken = default) - { - return (await _baseReadOnlyService.GetPaginedAsync(filter, cancellationToken)).ToActionResult(); - } - - [HttpGet("{id}")] - public async virtual Task GetByIdAsync( - [FromRoute] long id, - CancellationToken cancellationToken = default) - { - return (await _baseReadOnlyService.GetByIdAsync(id, cancellationToken)).ToActionResult(); - } - } -} diff --git a/OneBus.API/Controllers/BusController.cs b/OneBus.API/Controllers/BusController.cs deleted file mode 100644 index 84d39ee..0000000 --- a/OneBus.API/Controllers/BusController.cs +++ /dev/null @@ -1,114 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using OneBus.Application.DTOs.Bus; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Commons; -using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using Swashbuckle.AspNetCore.Annotations; - -namespace OneBus.API.Controllers -{ - [SwaggerTag("Controlador responsável por gerenciar Ônibus")] - public class BusController : BaseController - { - public BusController( - IBaseService baseService) - : base(baseService) - { - } - - /// - /// Cadastrar novo ônibus - /// - /// - /// POST de Ônibus - /// - /// Campos para cadastrar ônibus - /// - /// Ônibus cadastrado - /// Ônibus cadastrado com sucesso - /// Validação encontrou erros - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateBusDTO createDTO, CancellationToken cancellationToken = default) - { - return base.CreateAsync(createDTO, cancellationToken); - } - - /// - /// Atualizar ônibus - /// - /// - /// PUT de Ônibus - /// - /// Id do ônibus - /// Campos para atualizar ônibus - /// - /// Ônibus atualizado - /// Ônibus atualizado com sucesso - /// Validação encontrou erros - /// Ônibus não encontrado - /// Conflito entre ids - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateBusDTO updateDTO, CancellationToken cancellationToken = default) - { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Deletar ônibus - /// - /// - /// DELETE de Ônibus - /// - /// Id do ônibus - /// - /// Ônibus deletado - /// Ônibus deletado com sucesso - /// Ônibus não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) - { - return base.DeleteAsync(id, cancellationToken); - } - - /// - /// Obter ônibus paginados e filtrados - /// - /// - /// GET de Ônibus - /// - /// Filtros para aplicar - /// - /// Ônibus paginados e filtrados - /// Ônibus paginados e filtrados com sucesso - [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) - { - return base.GetPaginedAsync(filter, cancellationToken); - } - - /// - /// Obter ônibus por id - /// - /// - /// GET pelo id de ônibus - /// - /// Id do ônibus - /// - /// Ônibus encontrado - /// Ônibus encontrado com sucesso - /// Ônibus não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) - { - return base.GetByIdAsync(id, cancellationToken); - } - } -} diff --git a/OneBus.API/Controllers/BusOperationController.cs b/OneBus.API/Controllers/BusOperationController.cs deleted file mode 100644 index ea597ad..0000000 --- a/OneBus.API/Controllers/BusOperationController.cs +++ /dev/null @@ -1,114 +0,0 @@ -using Microsoft.AspNetCore.Mvc; -using OneBus.Application.DTOs.BusOperation; -using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Commons; -using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; -using Swashbuckle.AspNetCore.Annotations; - -namespace OneBus.API.Controllers -{ - [SwaggerTag("Controlador responsável por gerenciar Operações de Ônibus")] - public class BusOperationController : BaseController - { - public BusOperationController( - IBaseService baseService) - : base(baseService) - { - } - - /// - /// Cadastrar nova operação de ônibus - /// - /// - /// POST de Operação de Ônibus - /// - /// Campos para cadastrar operação de ônibus - /// - /// Operação de Ônibus cadastrada - /// Operação de Ônibus cadastrada com sucesso - /// Validação encontrou erros - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateBusOperationDTO createDTO, CancellationToken cancellationToken = default) - { - return base.CreateAsync(createDTO, cancellationToken); - } - - /// - /// Atualizar operação de ônibus - /// - /// - /// PUT de Operação de Ônibus - /// - /// Id da operação de ônibus - /// Campos para atualizar operação de ônibus - /// - /// Operação de Ônibus atualizada - /// Operação de Ônibus atualizada com sucesso - /// Validação encontrou erros - /// Operação de Ônibus não encontrada - /// Conflito entre ids - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateBusOperationDTO updateDTO, CancellationToken cancellationToken = default) - { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Deletar operação de ônibus - /// - /// - /// DELETE de Operação de Ônibus - /// - /// Id da operação de ônibus - /// - /// Operação de Ônibus deletada - /// Operação de Ônibus deletada com sucesso - /// Operação de Ônibus não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) - { - return base.DeleteAsync(id, cancellationToken); - } - - /// - /// Obter operações de ônibus paginadas e filtradas - /// - /// - /// GET de Operações de Ônibus - /// - /// Filtros para aplicar - /// - /// Operações de Ônibus paginadas e filtradas - /// Operações de Ônibus paginadas e filtradas com sucesso - [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) - { - return base.GetPaginedAsync(filter, cancellationToken); - } - - /// - /// Obter operação de ônibus por id - /// - /// - /// GET pelo id da operação de ônibus - /// - /// Id da operação de ônibus - /// - /// Operação de Ônibus encontrada - /// Operação de Ônibus encontrada com sucesso - /// Operação de Ônibus não encontrada - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) - { - return base.GetByIdAsync(id, cancellationToken); - } - } -} diff --git a/OneBus.API/Controllers/EmployeeController.cs b/OneBus.API/Controllers/EmployeeController.cs index 2a1e34c..eaf0867 100644 --- a/OneBus.API/Controllers/EmployeeController.cs +++ b/OneBus.API/Controllers/EmployeeController.cs @@ -1,21 +1,27 @@ -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using OneBus.API.Extensions; using OneBus.Application.DTOs.Employee; using OneBus.Application.Interfaces.Services; using OneBus.Domain.Commons; using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; using OneBus.Domain.Filters; using Swashbuckle.AspNetCore.Annotations; namespace OneBus.API.Controllers { + [Route("api/v1/employees")] + [ApiController] + [Produces("application/json")] + [Authorize] [SwaggerTag("Controlador responsável por gerenciar Funcionários")] - public class EmployeeController : BaseController + public class EmployeeController { - public EmployeeController( - IBaseService baseService) - : base(baseService) + private readonly IEmployeeService _employeeService; + + public EmployeeController(IEmployeeService employeeService) { + _employeeService = employeeService; } /// @@ -29,11 +35,12 @@ public EmployeeController( /// Funcionário cadastrado /// Funcionário cadastrado com sucesso /// Validação encontrou erros + [HttpPost] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateEmployeeDTO createDTO, CancellationToken cancellationToken = default) + public async Task CreateAsync([FromBody] CreateEmployeeDTO createDTO, CancellationToken cancellationToken = default) { - return base.CreateAsync(createDTO, cancellationToken); + return (await _employeeService.CreateAsync(createDTO, cancellationToken)).ToActionResult(); } /// @@ -50,14 +57,18 @@ public override Task CreateAsync([FromBody] CreateEmployeeDTO cre /// Validação encontrou erros /// Funcionário não encontrado /// Conflito entre ids + [HttpPut("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateEmployeeDTO updateDTO, CancellationToken cancellationToken = default) + public async Task UpdateAsync([FromRoute] long id, [FromBody] UpdateEmployeeDTO updateDTO, CancellationToken cancellationToken = default) { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } + if (id != updateDTO.Id) + return ConflictResult.Create(ErrorUtils.IdConflict()).ToActionResult(); + + return (await _employeeService.UpdateAsync(updateDTO, cancellationToken)).ToActionResult(); + } /// /// Deletar funcionário @@ -70,11 +81,12 @@ public override Task UpdateAsync([FromRoute] long id, [FromBody] /// Funcionário deletado /// Funcionário deletado com sucesso /// Funcionário não encontrado + [HttpDelete("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) + public async Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) { - return base.DeleteAsync(id, cancellationToken); + return (await _employeeService.DeleteAsync(id, cancellationToken)).ToActionResult(); } /// @@ -87,10 +99,11 @@ public override Task DeleteAsync([FromRoute] long id, Cancellatio /// /// Funcionários paginados e filtrados /// Funcionários paginados e filtrados com sucesso + [HttpGet] [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) + public async Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) { - return base.GetPaginedAsync(filter, cancellationToken); + return (await _employeeService.GetPaginedAsync(filter, cancellationToken)).ToActionResult(); } /// @@ -104,11 +117,12 @@ public override Task GetPaginedAsync([FromQuery] BaseFilter filte /// Funcionário encontrado /// Funcionário encontrado com sucesso /// Funcionário não encontrado + [HttpGet("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) + public async Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) { - return base.GetByIdAsync(id, cancellationToken); + return (await _employeeService.GetByIdAsync(id, cancellationToken)).ToActionResult(); } } } diff --git a/OneBus.API/Controllers/EmployeeWorkdayController.cs b/OneBus.API/Controllers/EmployeeWorkdayController.cs index 0557ccd..935566f 100644 --- a/OneBus.API/Controllers/EmployeeWorkdayController.cs +++ b/OneBus.API/Controllers/EmployeeWorkdayController.cs @@ -1,21 +1,27 @@ -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using OneBus.API.Extensions; using OneBus.Application.DTOs.EmployeeWorkday; using OneBus.Application.Interfaces.Services; using OneBus.Domain.Commons; using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; using OneBus.Domain.Filters; using Swashbuckle.AspNetCore.Annotations; namespace OneBus.API.Controllers { + [Route("api/v1/employeesWorkdays")] + [ApiController] + [Produces("application/json")] + [Authorize] [SwaggerTag("Controlador responsável por gerenciar Horários dos Funcionários")] - public class EmployeeWorkdayController : BaseController + public class EmployeeWorkdayController { - public EmployeeWorkdayController( - IBaseService baseService) - : base(baseService) + private readonly IEmployeeWorkdayService _employeeWorkdayService; + + public EmployeeWorkdayController(IEmployeeWorkdayService employeeWorkdayService) { + _employeeWorkdayService = employeeWorkdayService; } /// @@ -29,11 +35,12 @@ public EmployeeWorkdayController( /// Horário do Funcionário cadastrado /// Horário do Funcionário cadastrado com sucesso /// Validação encontrou erros + [HttpPost] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateEmployeeWorkdayDTO createDTO, CancellationToken cancellationToken = default) + public async Task CreateAsync([FromBody] CreateEmployeeWorkdayDTO createDTO, CancellationToken cancellationToken = default) { - return base.CreateAsync(createDTO, cancellationToken); + return (await _employeeWorkdayService.CreateAsync(createDTO, cancellationToken)).ToActionResult(); } /// @@ -50,13 +57,17 @@ public override Task CreateAsync([FromBody] CreateEmployeeWorkday /// Validação encontrou erros /// Horário do Funcionário não encontrado /// Conflito entre ids + [HttpPut("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateEmployeeWorkdayDTO updateDTO, CancellationToken cancellationToken = default) + public async Task UpdateAsync([FromRoute] long id, [FromBody] UpdateEmployeeWorkdayDTO updateDTO, CancellationToken cancellationToken = default) { - return base.UpdateAsync(id, updateDTO, cancellationToken); + if (id != updateDTO.Id) + return ConflictResult.Create(ErrorUtils.IdConflict()).ToActionResult(); + + return (await _employeeWorkdayService.UpdateAsync(updateDTO, cancellationToken)).ToActionResult(); } /// @@ -70,11 +81,12 @@ public override Task UpdateAsync([FromRoute] long id, [FromBody] /// Horário do Funcionário deletado /// Horário do Funcionário deletado com sucesso /// Horário do Funcionário não encontrado + [HttpDelete("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) + public async Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) { - return base.DeleteAsync(id, cancellationToken); + return (await _employeeWorkdayService.DeleteAsync(id, cancellationToken)).ToActionResult(); } /// @@ -87,10 +99,11 @@ public override Task DeleteAsync([FromRoute] long id, Cancellatio /// /// Horários dos Funcionários paginados e filtrados /// Horários dos Funcionários paginados e filtrados com sucesso + [HttpGet] [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) + public async Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) { - return base.GetPaginedAsync(filter, cancellationToken); + return (await _employeeWorkdayService.GetPaginedAsync(filter, cancellationToken)).ToActionResult(); } /// @@ -104,11 +117,12 @@ public override Task GetPaginedAsync([FromQuery] BaseFilter filte /// Horário do Funcionário encontrado /// Horário do Funcionário encontrado com sucesso /// Horário do Funcionário não encontrado + [HttpGet("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) + public async Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) { - return base.GetByIdAsync(id, cancellationToken); + return (await _employeeWorkdayService.GetByIdAsync(id, cancellationToken)).ToActionResult(); } } } diff --git a/OneBus.API/Controllers/LineController.cs b/OneBus.API/Controllers/LineController.cs index 01c78f6..c381ccd 100644 --- a/OneBus.API/Controllers/LineController.cs +++ b/OneBus.API/Controllers/LineController.cs @@ -1,21 +1,27 @@ -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using OneBus.API.Extensions; using OneBus.Application.DTOs.Line; using OneBus.Application.Interfaces.Services; using OneBus.Domain.Commons; using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; using OneBus.Domain.Filters; using Swashbuckle.AspNetCore.Annotations; namespace OneBus.API.Controllers { + [Route("api/v1/lines")] + [ApiController] + [Produces("application/json")] + [Authorize] [SwaggerTag("Controlador responsável por gerenciar Linhas")] - public class LineController : BaseController + public class LineController { - public LineController( - IBaseService baseService) - : base(baseService) + private readonly ILineService _lineService; + + public LineController(ILineService lineService) { + _lineService = lineService; } /// @@ -29,11 +35,12 @@ public LineController( /// Linha cadastrada /// Linha cadastrada com sucesso /// Validação encontrou erros + [HttpPost] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateLineDTO createDTO, CancellationToken cancellationToken = default) + public async Task CreateAsync([FromBody] CreateLineDTO createDTO, CancellationToken cancellationToken = default) { - return base.CreateAsync(createDTO, cancellationToken); + return (await _lineService.CreateAsync(createDTO, cancellationToken)).ToActionResult(); } /// @@ -50,13 +57,17 @@ public override Task CreateAsync([FromBody] CreateLineDTO createD /// Validação encontrou erros /// Linha não encontrada /// Conflito entre ids + [HttpPut("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateLineDTO updateDTO, CancellationToken cancellationToken = default) + public async Task UpdateAsync([FromRoute] long id, [FromBody] UpdateLineDTO updateDTO, CancellationToken cancellationToken = default) { - return base.UpdateAsync(id, updateDTO, cancellationToken); + if (id != updateDTO.Id) + return ConflictResult.Create(ErrorUtils.IdConflict()).ToActionResult(); + + return (await _lineService.UpdateAsync(updateDTO, cancellationToken)).ToActionResult(); } /// @@ -70,11 +81,12 @@ public override Task UpdateAsync([FromRoute] long id, [FromBody] /// Linha deletada /// Linha deletada com sucesso /// Linha não encontrada + [HttpDelete("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) + public async Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) { - return base.DeleteAsync(id, cancellationToken); + return (await _lineService.DeleteAsync(id, cancellationToken)).ToActionResult(); } /// @@ -87,10 +99,11 @@ public override Task DeleteAsync([FromRoute] long id, Cancellatio /// /// Linhas paginadas e filtradas /// Linhas paginadas e filtradas com sucesso + [HttpGet] [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) + public async Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) { - return base.GetPaginedAsync(filter, cancellationToken); + return (await _lineService.GetPaginedAsync(filter, cancellationToken)).ToActionResult(); } /// @@ -104,11 +117,12 @@ public override Task GetPaginedAsync([FromQuery] BaseFilter filte /// Linha encontrada /// Linha encontrada com sucesso /// Linha não encontrada + [HttpGet("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) + public async Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) { - return base.GetByIdAsync(id, cancellationToken); + return (await _lineService.GetByIdAsync(id, cancellationToken)).ToActionResult(); } } } diff --git a/OneBus.API/Controllers/LineTimeController.cs b/OneBus.API/Controllers/LineTimeController.cs index 6dd8092..c0a9ccf 100644 --- a/OneBus.API/Controllers/LineTimeController.cs +++ b/OneBus.API/Controllers/LineTimeController.cs @@ -1,21 +1,27 @@ -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using OneBus.API.Extensions; using OneBus.Application.DTOs.LineTime; using OneBus.Application.Interfaces.Services; using OneBus.Domain.Commons; using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; using OneBus.Domain.Filters; using Swashbuckle.AspNetCore.Annotations; namespace OneBus.API.Controllers { + [Route("api/v1/linesTimes")] + [ApiController] + [Produces("application/json")] + [Authorize] [SwaggerTag("Controlador responsável por gerenciar Horários da Linha")] - public class LineTimeController : BaseController + public class LineTimeController { - public LineTimeController( - IBaseService baseService) - : base(baseService) + private readonly ILineTimeService _lineTimeService; + + public LineTimeController(ILineTimeService lineTimeService) { + _lineTimeService = lineTimeService; } /// @@ -29,11 +35,12 @@ public LineTimeController( /// Horário de Linha cadastrado /// Horário de Linha cadastrado com sucesso /// Validação encontrou erros + [HttpPost] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateLineTimeDTO createDTO, CancellationToken cancellationToken = default) + public async Task CreateAsync([FromBody] CreateLineTimeDTO createDTO, CancellationToken cancellationToken = default) { - return base.CreateAsync(createDTO, cancellationToken); + return (await _lineTimeService.CreateAsync(createDTO, cancellationToken)).ToActionResult(); } /// @@ -50,14 +57,18 @@ public override Task CreateAsync([FromBody] CreateLineTimeDTO cre /// Validação encontrou erros /// Horário de Linha não encontrado /// Conflito entre ids + [HttpPut("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateLineTimeDTO updateDTO, CancellationToken cancellationToken = default) + public async Task UpdateAsync([FromRoute] long id, [FromBody] UpdateLineTimeDTO updateDTO, CancellationToken cancellationToken = default) { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } + if (id != updateDTO.Id) + return ConflictResult.Create(ErrorUtils.IdConflict()).ToActionResult(); + + return (await _lineTimeService.UpdateAsync(updateDTO, cancellationToken)).ToActionResult(); + } /// /// Deletar horário de linha @@ -70,11 +81,12 @@ public override Task UpdateAsync([FromRoute] long id, [FromBody] /// Horário de Linha deletado /// Horário de Linha deletado com sucesso /// Horário de Linha não encontrado + [HttpDelete("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) + public async Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) { - return base.DeleteAsync(id, cancellationToken); + return (await _lineTimeService.DeleteAsync(id, cancellationToken)).ToActionResult(); } /// @@ -87,10 +99,11 @@ public override Task DeleteAsync([FromRoute] long id, Cancellatio /// /// Horários de Linha paginados e filtrados /// Horários de Linha paginados e filtrados com sucesso + [HttpGet] [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) + public async Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) { - return base.GetPaginedAsync(filter, cancellationToken); + return (await _lineTimeService.GetPaginedAsync(filter, cancellationToken)).ToActionResult(); } /// @@ -104,11 +117,12 @@ public override Task GetPaginedAsync([FromQuery] BaseFilter filte /// Horário de Linha encontrado /// Horário de Linha encontrado com sucesso /// Horário de Linha não encontrado + [HttpGet("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) + public async Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) { - return base.GetByIdAsync(id, cancellationToken); + return (await _lineTimeService.GetByIdAsync(id, cancellationToken)).ToActionResult(); } } } diff --git a/OneBus.API/Controllers/MaintenanceController.cs b/OneBus.API/Controllers/MaintenanceController.cs index 8ebf82e..c696948 100644 --- a/OneBus.API/Controllers/MaintenanceController.cs +++ b/OneBus.API/Controllers/MaintenanceController.cs @@ -1,21 +1,27 @@ -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using OneBus.API.Extensions; using OneBus.Application.DTOs.Maintenance; using OneBus.Application.Interfaces.Services; using OneBus.Domain.Commons; using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; using OneBus.Domain.Filters; using Swashbuckle.AspNetCore.Annotations; namespace OneBus.API.Controllers { + [Route("api/v1/maintenances")] + [ApiController] + [Produces("application/json")] + [Authorize] [SwaggerTag("Controlador responsável por gerenciar Manutenções")] - public class MaintenanceController : BaseController + public class MaintenanceController { - public MaintenanceController( - IBaseService baseService) - : base(baseService) + private readonly IMaintenanceService _maintenanceService; + + public MaintenanceController(IMaintenanceService maintenanceService) { + _maintenanceService = maintenanceService; } /// @@ -29,11 +35,12 @@ public MaintenanceController( /// Manutenção cadastrada /// Manutenção cadastrada com sucesso /// Validação encontrou erros + [HttpPost] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateMaintenanceDTO createDTO, CancellationToken cancellationToken = default) + public async Task CreateAsync([FromBody] CreateMaintenanceDTO createDTO, CancellationToken cancellationToken = default) { - return base.CreateAsync(createDTO, cancellationToken); + return (await _maintenanceService.CreateAsync(createDTO, cancellationToken)).ToActionResult(); } /// @@ -50,14 +57,18 @@ public override Task CreateAsync([FromBody] CreateMaintenanceDTO /// Validação encontrou erros /// Manutenção não encontrada /// Conflito entre ids + [HttpPut("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateMaintenanceDTO updateDTO, CancellationToken cancellationToken = default) + public async Task UpdateAsync([FromRoute] long id, [FromBody] UpdateMaintenanceDTO updateDTO, CancellationToken cancellationToken = default) { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } + if (id != updateDTO.Id) + return ConflictResult.Create(ErrorUtils.IdConflict()).ToActionResult(); + + return (await _maintenanceService.UpdateAsync(updateDTO, cancellationToken)).ToActionResult(); + } /// /// Deletar manutenção @@ -70,11 +81,12 @@ public override Task UpdateAsync([FromRoute] long id, [FromBody] /// Manutenção deletada /// Manutenção deletada com sucesso /// Manutenção não encontrada + [HttpDelete("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) + public async Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) { - return base.DeleteAsync(id, cancellationToken); + return (await _maintenanceService.DeleteAsync(id, cancellationToken)).ToActionResult(); } /// @@ -87,10 +99,11 @@ public override Task DeleteAsync([FromRoute] long id, Cancellatio /// /// Manutenções paginadas e filtradas /// Manutenções paginadas e filtradas com sucesso + [HttpGet] [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) + public async Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) { - return base.GetPaginedAsync(filter, cancellationToken); + return (await _maintenanceService.GetPaginedAsync(filter, cancellationToken)).ToActionResult(); } /// @@ -104,11 +117,12 @@ public override Task GetPaginedAsync([FromQuery] BaseFilter filte /// Manutenção encontrada /// Manutenção encontrada com sucesso /// Manutenção não encontrada + [HttpGet("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) + public async Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) { - return base.GetByIdAsync(id, cancellationToken); + return (await _maintenanceService.GetByIdAsync(id, cancellationToken)).ToActionResult(); } } } diff --git a/OneBus.API/Controllers/UserController.cs b/OneBus.API/Controllers/UserController.cs index 7d2cc3a..00aad25 100644 --- a/OneBus.API/Controllers/UserController.cs +++ b/OneBus.API/Controllers/UserController.cs @@ -1,23 +1,23 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using OneBus.Application.DTOs.Login; -using OneBus.Application.DTOs.User; using OneBus.Application.Interfaces.Services; -using OneBus.Domain.Commons; -using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; -using OneBus.Domain.Filters; using Swashbuckle.AspNetCore.Annotations; namespace OneBus.API.Controllers { + [Route("api/v1/users")] + [ApiController] + [Produces("application/json")] + [Authorize] [SwaggerTag("Controlador responsável por gerenciar Usuários")] - public class UserController : BaseController + public class UserController { - public UserController( - IBaseService baseService) - : base(baseService) + private readonly IUserService _userService; + + public UserController(IUserService userService) { + _userService = userService; } /// @@ -30,103 +30,10 @@ public UserController( /// /// Usuário autenticado [AllowAnonymous] - [HttpPost("login")] + [HttpPost("logins")] public Task LoginAsync([FromBody] LoginDTO login, CancellationToken cancellationToken = default) - { - throw new NotImplementedException(); - } - - /// - /// Cadastrar novo usuário - /// - /// - /// POST de Usuário - /// - /// Campos para cadastrar usuário - /// - /// Usuário cadastrado - /// Usuário cadastrado com sucesso - /// Validação encontrou erros - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateUserDTO createDTO, CancellationToken cancellationToken = default) { - return base.CreateAsync(createDTO, cancellationToken); - } - - /// - /// Atualizar usuário - /// - /// - /// PUT de Usuário - /// - /// Id do usuário - /// Campos para atualizar usuário - /// - /// Usuário atualizado - /// Usuário atualizado com sucesso - /// Validação encontrou erros - /// Usuário não encontrado - /// Conflito entre ids - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateUserDTO updateDTO, CancellationToken cancellationToken = default) - { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } - - /// - /// Deletar usuário - /// - /// - /// DELETE de Usuário - /// - /// Id do usuário - /// - /// Usuário deletado - /// Usuário deletado com sucesso - /// Usuário não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) - { - return base.DeleteAsync(id, cancellationToken); - } - - /// - /// Obter usuários paginados e filtrados - /// - /// - /// GET de Usuários - /// - /// Filtros para aplicar - /// - /// Usuários paginados e filtrados - /// Usuários paginados e filtrados com sucesso - [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) - { - return base.GetPaginedAsync(filter, cancellationToken); - } - - /// - /// Obter usuário por id - /// - /// - /// GET pelo id de usuário - /// - /// Id do usuário - /// - /// Usuário encontrado - /// Usuário encontrado com sucesso - /// Usuário não encontrado - [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] - [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) - { - return base.GetByIdAsync(id, cancellationToken); + throw new NotImplementedException(); } } } diff --git a/OneBus.API/Controllers/VehicleController.cs b/OneBus.API/Controllers/VehicleController.cs index e72d367..eb6b78f 100644 --- a/OneBus.API/Controllers/VehicleController.cs +++ b/OneBus.API/Controllers/VehicleController.cs @@ -1,21 +1,27 @@ -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using OneBus.API.Extensions; using OneBus.Application.DTOs.Vehicle; using OneBus.Application.Interfaces.Services; using OneBus.Domain.Commons; using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; using OneBus.Domain.Filters; using Swashbuckle.AspNetCore.Annotations; namespace OneBus.API.Controllers { + [Route("api/v1/vehicles")] + [ApiController] + [Produces("application/json")] + [Authorize] [SwaggerTag("Controlador responsável por gerenciar Veículos")] - public class VehicleController : BaseController + public class VehicleController { - public VehicleController( - IBaseService baseService) - : base(baseService) + private readonly IVehicleService _vehicleService; + + public VehicleController(IVehicleService vehicleService) { + _vehicleService = vehicleService; } /// @@ -29,11 +35,12 @@ public VehicleController( /// Veículo cadastrado /// Veículo cadastrado com sucesso /// Validação encontrou erros + [HttpPost] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateVehicleDTO createDTO, CancellationToken cancellationToken = default) + public async Task CreateAsync([FromBody] CreateVehicleDTO createDTO, CancellationToken cancellationToken = default) { - return base.CreateAsync(createDTO, cancellationToken); + return (await _vehicleService.CreateAsync(createDTO, cancellationToken)).ToActionResult(); } /// @@ -50,14 +57,18 @@ public override Task CreateAsync([FromBody] CreateVehicleDTO crea /// Validação encontrou erros /// Veículo não encontrado /// Conflito entre ids + [HttpPut("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateVehicleDTO updateDTO, CancellationToken cancellationToken = default) + public async Task UpdateAsync([FromRoute] long id, [FromBody] UpdateVehicleDTO updateDTO, CancellationToken cancellationToken = default) { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } + if (id != updateDTO.Id) + return ConflictResult.Create(ErrorUtils.IdConflict()).ToActionResult(); + + return (await _vehicleService.UpdateAsync(updateDTO, cancellationToken)).ToActionResult(); + } /// /// Deletar veículo @@ -70,11 +81,12 @@ public override Task UpdateAsync([FromRoute] long id, [FromBody] /// Veículo deletado /// Veículo deletado com sucesso /// Veículo não encontrado + [HttpDelete("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) + public async Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) { - return base.DeleteAsync(id, cancellationToken); + return (await _vehicleService.DeleteAsync(id, cancellationToken)).ToActionResult(); } /// @@ -87,10 +99,11 @@ public override Task DeleteAsync([FromRoute] long id, Cancellatio /// /// Veículos paginados e filtrados /// Veículos paginados e filtrados com sucesso + [HttpGet] [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) + public async Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) { - return base.GetPaginedAsync(filter, cancellationToken); + return (await _vehicleService.GetPaginedAsync(filter, cancellationToken)).ToActionResult(); } /// @@ -104,11 +117,12 @@ public override Task GetPaginedAsync([FromQuery] BaseFilter filte /// Veículo encontrado /// Veículo encontrado com sucesso /// Veículo não encontrado + [HttpGet("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) + public async Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) { - return base.GetByIdAsync(id, cancellationToken); + return (await _vehicleService.GetByIdAsync(id, cancellationToken)).ToActionResult(); } } } diff --git a/OneBus.API/Controllers/VehicleOperationController.cs b/OneBus.API/Controllers/VehicleOperationController.cs index 1fe7627..10c6ffb 100644 --- a/OneBus.API/Controllers/VehicleOperationController.cs +++ b/OneBus.API/Controllers/VehicleOperationController.cs @@ -1,21 +1,27 @@ -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using OneBus.API.Extensions; using OneBus.Application.DTOs.VehicleOperation; using OneBus.Application.Interfaces.Services; using OneBus.Domain.Commons; using OneBus.Domain.Commons.Result; -using OneBus.Domain.Entities; using OneBus.Domain.Filters; using Swashbuckle.AspNetCore.Annotations; namespace OneBus.API.Controllers { + [Route("api/v1/vehiclesOperations")] + [ApiController] + [Produces("application/json")] + [Authorize] [SwaggerTag("Controlador responsável por gerenciar Operações de Veículos")] - public class VehicleOperationController : BaseController + public class VehicleOperationController { - public VehicleOperationController( - IBaseService baseService) - : base(baseService) + private readonly IVehicleOperationService _vehicleOperationService; + + public VehicleOperationController(IVehicleOperationService vehicleOperationService) { + _vehicleOperationService = vehicleOperationService; } /// @@ -29,11 +35,12 @@ public VehicleOperationController( /// Operação de Veículo cadastrada /// Operação de Veículo cadastrada com sucesso /// Validação encontrou erros + [HttpPost] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] - public override Task CreateAsync([FromBody] CreateVehicleOperationDTO createDTO, CancellationToken cancellationToken = default) + public async Task CreateAsync([FromBody] CreateVehicleOperationDTO createDTO, CancellationToken cancellationToken = default) { - return base.CreateAsync(createDTO, cancellationToken); + return (await _vehicleOperationService.CreateAsync(createDTO, cancellationToken)).ToActionResult(); } /// @@ -50,14 +57,18 @@ public override Task CreateAsync([FromBody] CreateVehicleOperatio /// Validação encontrou erros /// Operação de Veículo não encontrada /// Conflito entre ids + [HttpPut("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(InvalidResult), StatusCodes.Status422UnprocessableEntity)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] [ProducesResponseType(typeof(ConflictResult), StatusCodes.Status409Conflict)] - public override Task UpdateAsync([FromRoute] long id, [FromBody] UpdateVehicleOperationDTO updateDTO, CancellationToken cancellationToken = default) + public async Task UpdateAsync([FromRoute] long id, [FromBody] UpdateVehicleOperationDTO updateDTO, CancellationToken cancellationToken = default) { - return base.UpdateAsync(id, updateDTO, cancellationToken); - } + if (id != updateDTO.Id) + return ConflictResult.Create(ErrorUtils.IdConflict()).ToActionResult(); + + return (await _vehicleOperationService.UpdateAsync(updateDTO, cancellationToken)).ToActionResult(); + } /// /// Deletar operação de veículo @@ -70,11 +81,12 @@ public override Task UpdateAsync([FromRoute] long id, [FromBody] /// Operação de Veículo deletada /// Operação de Veículo deletada com sucesso /// Operação de Veículo não encontrada + [HttpDelete("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) + public async Task DeleteAsync([FromRoute] long id, CancellationToken cancellationToken = default) { - return base.DeleteAsync(id, cancellationToken); + return (await _vehicleOperationService.DeleteAsync(id, cancellationToken)).ToActionResult(); } /// @@ -87,10 +99,11 @@ public override Task DeleteAsync([FromRoute] long id, Cancellatio /// /// Operações de Veículos paginadas e filtradas /// Operações de Veículos paginadas e filtradas com sucesso + [HttpGet] [ProducesResponseType(typeof(SuccessResult>), StatusCodes.Status200OK)] - public override Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) + public async Task GetPaginedAsync([FromQuery] BaseFilter filter, CancellationToken cancellationToken = default) { - return base.GetPaginedAsync(filter, cancellationToken); + return (await _vehicleOperationService.GetPaginedAsync(filter, cancellationToken)).ToActionResult(); } /// @@ -104,11 +117,12 @@ public override Task GetPaginedAsync([FromQuery] BaseFilter filte /// Operação de Veículo encontrada /// Operação de Veículo encontrada com sucesso /// Operação de Veículo não encontrada + [HttpGet("{id}")] [ProducesResponseType(typeof(SuccessResult), StatusCodes.Status200OK)] [ProducesResponseType(typeof(NotFoundResult), StatusCodes.Status404NotFound)] - public override Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) + public async Task GetByIdAsync([FromRoute] long id, CancellationToken cancellationToken = default) { - return base.GetByIdAsync(id, cancellationToken); + return (await _vehicleOperationService.GetByIdAsync(id, cancellationToken)).ToActionResult(); } } }