Skip to content

Commit

Permalink
added equipment/instrument prop to dto (#1066)
Browse files Browse the repository at this point in the history
  • Loading branch information
VILLAN3LL3 authored Jan 1, 2025
1 parent f9b02ec commit 335bc18
Show file tree
Hide file tree
Showing 11 changed files with 55 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using AutoMapper;
using Orso.Arpa.Application.General.MappingActions;
using Orso.Arpa.Application.SelectValueApplication.Model;
using Orso.Arpa.Domain.VenueDomain.Model;
using Orso.Arpa.Infrastructure.Localization;

Expand All @@ -10,12 +11,13 @@ public class RoomEquipmentDto
{
public Guid Id { get; set; }
public Guid EquipmentId { get; set; }

[Translate(LocalizationKeys.SELECT_VALUE)]
public string Name { get; set; }

public int? Quantity { get; set; }
public string Description { get; set; }
public SelectValueDto Equipment { get; set; }
}

public class RoomEquipmentDtoMappingProfile : Profile
Expand All @@ -28,7 +30,8 @@ public RoomEquipmentDtoMappingProfile()
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.Id))
.ForMember(dest => dest.Quantity, opt => opt.MapFrom(src => src.Quantity))
.ForMember(dest => dest.EquipmentId, opt => opt.MapFrom(src => src.EquipmentId))
.ForMember(dest => dest.Equipment, opt => opt.MapFrom(src => src.Equipment))
.AfterMap<LocalizeAction<RoomEquipment, RoomEquipmentDto>>();
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using AutoMapper;
using Orso.Arpa.Application.General.MappingActions;
using Orso.Arpa.Application.SectionApplication.Model;
using Orso.Arpa.Domain.VenueDomain.Model;
using Orso.Arpa.Infrastructure.Localization;

Expand All @@ -14,6 +15,7 @@ public class RoomSectionDto
public int? Quantity { get; set; }
public Guid InstrumentId { get; set; }
public string Description { get; set; }
public SectionDto Instrument { get; set; }
}

public class RoomSectionDtoMappingProfile : Profile
Expand All @@ -26,7 +28,8 @@ public RoomSectionDtoMappingProfile()
.ForMember(dest => dest.Id, opt => opt.MapFrom(src => src.Id))
.ForMember(dest => dest.Name, opt => opt.MapFrom(src => src.Section.Name))
.ForMember(dest => dest.InstrumentId, opt => opt.MapFrom(src => src.SectionId))
.ForMember(dest => dest.Instrument, opt => opt.MapFrom(src => src.Section))
.AfterMap<LocalizeAction<RoomSection, RoomSectionDto>>();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public async Task Should_Modify()
Name = roomEquipmentToModify.Name,
Description = modifyDto.Description,
Quantity = modifyDto.Quantity,
EquipmentId = roomEquipmentToModify.EquipmentId
EquipmentId = roomEquipmentToModify.EquipmentId,
Equipment = SelectValueDtoData.Chairs
};

// Act
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public async Task Should_Modify()
Name = roomSectionToModify.Name,
Description = modifyDto.Description,
Quantity = modifyDto.Quantity,
InstrumentId = roomSectionToModify.InstrumentId
InstrumentId = roomSectionToModify.InstrumentId,
Instrument = SectionDtoData.Piano
};

// Act
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ public async Task Should_Add_RoomEquipment()
Name = "WLAN",
Description = "Neue Beschreibung",
Quantity = 10,
EquipmentId = SelectValueMappingSeedData.RoomEquipmentTypeMappings[0].Id
EquipmentId = SelectValueMappingSeedData.RoomEquipmentTypeMappings[0].Id,
Equipment = SelectValueDtoData.Wlan
};
RoomDto room = RoomDtoData.AulaWeiherhofSchule;

Expand Down Expand Up @@ -110,7 +111,8 @@ public async Task Should_Add_RoomSection()
Name = "Drum Set (Orchestra)",
Description = "Neue Beschreibung",
Quantity = 1,
InstrumentId = SectionSeedData.DrumSet.Id
InstrumentId = SectionSeedData.DrumSet.Id,
Instrument = SectionDtoData.DrumSet
};
RoomDto room = RoomDtoData.AulaWeiherhofSchule;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
using Orso.Arpa.Application.General.MappingActions;
using Orso.Arpa.Application.General.Model;
using Orso.Arpa.Application.RoomApplication.Model;
using Orso.Arpa.Application.SectionApplication.Model;
using Orso.Arpa.Application.SelectValueApplication.Model;
using Orso.Arpa.Domain.SectionDomain.Model;
using Orso.Arpa.Domain.SelectValueDomain.Model;
using Orso.Arpa.Domain.VenueDomain.Model;
using Orso.Arpa.Infrastructure.Localization;
Expand All @@ -23,6 +25,7 @@ public void Setup()
{
var services = new ServiceCollection();
services.AddSingleton<LocalizeAction<SelectValueMapping, SelectValueDto>>();
services.AddSingleton<LocalizeAction<Section, SectionDto>>();
services.AddSingleton<LocalizeAction<RoomSection, RoomSectionDto>>();
services.AddSingleton<LocalizeAction<RoomEquipment, RoomEquipmentDto>>();
services.AddSingleton(_localizerCache);
Expand All @@ -33,6 +36,7 @@ public void Setup()
cfg.AddProfile<SelectValueDtoMappingProfile>();
cfg.AddProfile<RoomSectionDtoMappingProfile>();
cfg.AddProfile<RoomEquipmentDtoMappingProfile>();
cfg.AddProfile<SectionDtoMappingProfile>();
});

ServiceProvider serviceProvider = services.BuildServiceProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
using Orso.Arpa.Application.ProjectApplication.Model;
using Orso.Arpa.Application.RoleApplication.Model;
using Orso.Arpa.Application.RoomApplication.Model;
using Orso.Arpa.Application.SectionApplication.Model;
using Orso.Arpa.Application.SelectValueApplication.Model;
using Orso.Arpa.Application.UrlApplication.Model;
using Orso.Arpa.Application.VenueApplication.Model;
using Orso.Arpa.Domain.AppointmentDomain.Model;
using Orso.Arpa.Domain.SectionDomain.Model;
using Orso.Arpa.Domain.SelectValueDomain.Model;
using Orso.Arpa.Domain.UserDomain.Model;
using Orso.Arpa.Domain.VenueDomain.Model;
Expand All @@ -33,6 +35,7 @@ public void Setup()
var services = new ServiceCollection();
_ = services.AddSingleton<LocalizeAction<SelectValueMapping, SelectValueDto>>();
_ = services.AddSingleton<LocalizeAction<Role, RoleDto>>();
_ = services.AddSingleton<LocalizeAction<Section, SectionDto>>();
services.AddSingleton<LocalizeAction<RoomSection, RoomSectionDto>>();
services.AddSingleton<LocalizeAction<RoomEquipment, RoomEquipmentDto>>();
_ = services.AddSingleton(_localizerCache);
Expand All @@ -49,6 +52,7 @@ public void Setup()
cfg.AddProfile<SelectValueDtoMappingProfile>();
cfg.AddProfile<RoomSectionDtoMappingProfile>();
cfg.AddProfile<RoomEquipmentDtoMappingProfile>();
cfg.AddProfile<SectionDtoMappingProfile>();
});

ServiceProvider serviceProvider = services.BuildServiceProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@
using Orso.Arpa.Application.General.MappingActions;
using Orso.Arpa.Application.General.Model;
using Orso.Arpa.Application.RoomApplication.Model;
using Orso.Arpa.Application.SectionApplication.Model;
using Orso.Arpa.Application.SelectValueApplication.Model;
using Orso.Arpa.Application.VenueApplication.Model;
using Orso.Arpa.Domain.SectionDomain.Model;
using Orso.Arpa.Domain.SelectValueDomain.Model;
using Orso.Arpa.Domain.VenueDomain.Model;
using Orso.Arpa.Infrastructure.Localization;
Expand All @@ -27,6 +29,8 @@ public void Setup()
_ = services.AddSingleton<LocalizeAction<SelectValueMapping, SelectValueDto>>();
services.AddSingleton<LocalizeAction<RoomSection, RoomSectionDto>>();
services.AddSingleton<LocalizeAction<RoomEquipment, RoomEquipmentDto>>();
services.AddSingleton<LocalizeAction<Section, SectionDto>>();
services.AddSingleton<LocalizeAction<SelectValueMapping, SelectValueDto>>();
_ = services.AddSingleton(_localizerCache);
_ = services.AddAutoMapper(cfg =>
{
Expand All @@ -37,6 +41,8 @@ public void Setup()
cfg.AddProfile<SelectValueDtoMappingProfile>();
cfg.AddProfile<RoomSectionDtoMappingProfile>();
cfg.AddProfile<RoomEquipmentDtoMappingProfile>();
cfg.AddProfile<SelectValueDtoMappingProfile>();
cfg.AddProfile<SectionDtoMappingProfile>();
});

ServiceProvider serviceProvider = services.BuildServiceProvider();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public static RoomEquipmentDto AulaWeiherhofSchuleChairs
Name = "Chairs",
Quantity = 100,
Description = null,
EquipmentId = Guid.Parse("efe41455-e9d5-4bcc-94b8-086a5926df96")
EquipmentId = Guid.Parse("efe41455-e9d5-4bcc-94b8-086a5926df96"),
Equipment = SelectValueDtoData.Chairs
};
}
}
Expand All @@ -30,7 +31,8 @@ public static RoomEquipmentDto AulaWeiherhofSchuleStage
Name = "Stage",
Quantity = 1,
Description = "Bühne mit Beleuchtung",
EquipmentId = Guid.Parse("5e49bb48-fadd-48d9-bac5-dd567002b978")
EquipmentId = Guid.Parse("5e49bb48-fadd-48d9-bac5-dd567002b978"),
Equipment = SelectValueDtoData.Stage
};
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ public static RoomSectionDto AulaWeiherhofSchulePiano
Name = "Piano",
Quantity = 1,
Description = null,
InstrumentId = Guid.Parse("8ed82e0e-0354-4192-8f26-5a2437e9208d")
InstrumentId = Guid.Parse("8ed82e0e-0354-4192-8f26-5a2437e9208d"),
Instrument = SectionDtoData.Piano
};
}
}
Expand Down
18 changes: 18 additions & 0 deletions Tests/Orso.Arpa.Tests.Shared/DtoTestData/SelectValueDtoData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -251,5 +251,23 @@ public static IList<SelectValueDto> ProjectGenres
Name = "Ensemble position",
Description = ""
};

public static SelectValueDto Chairs => new() {
Id = Guid.Parse("efe41455-e9d5-4bcc-94b8-086a5926df96"),
Name = "Chairs",
Description = ""
};

public static SelectValueDto Stage => new() {
Id = Guid.Parse("5e49bb48-fadd-48d9-bac5-dd567002b978"),
Name = "Stage",
Description = ""
};

public static SelectValueDto Wlan => new() {
Id = Guid.Parse("eec36685-52a5-42a4-969d-aa7946f3b14b"),
Name = "WLAN",
Description = ""
};
}
}

0 comments on commit 335bc18

Please sign in to comment.