mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Add endpoints to get computers by sound synthesizers.
This commit is contained in:
@@ -58,6 +58,24 @@ public class SoundSynthsByMachineController(MarechaiContext context) : Controlle
|
||||
.ThenBy(g => g.Name)
|
||||
.ToListAsync();
|
||||
|
||||
[HttpGet("by-sound-synth/{soundSynthId:int}")]
|
||||
[AllowAnonymous]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
[ProducesResponseType(StatusCodes.Status400BadRequest)]
|
||||
public Task<List<SoundSynthByMachineDto>> GetBySoundSynth(int soundSynthId) => context.SoundByMachine
|
||||
.Where(g => g.SoundSynthId == soundSynthId)
|
||||
.Select(g => new SoundSynthByMachineDto
|
||||
{
|
||||
Id = g.Id,
|
||||
Name = g.Machine.Name,
|
||||
CompanyName = g.Machine.Company.Name,
|
||||
SoundSynthId = g.SoundSynthId,
|
||||
MachineId = g.MachineId
|
||||
})
|
||||
.OrderBy(g => g.CompanyName)
|
||||
.ThenBy(g => g.Name)
|
||||
.ToListAsync();
|
||||
|
||||
[HttpDelete("{id:long}")]
|
||||
[Authorize(Roles = "Admin,UberAdmin")]
|
||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
||||
|
||||
Reference in New Issue
Block a user