mirror of
https://github.com/GCMatters/hermes.git
synced 2026-02-04 05:30:13 +01:00
Fix api/auth/my_events endpoint
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using WebApp.Data;
|
||||
@@ -95,9 +95,16 @@ namespace WebApp.Endpoints
|
||||
|
||||
if(!user.IsOrganisation)
|
||||
{
|
||||
var events = await context.EventRegistrations
|
||||
|
||||
var eventIds = await context.EventRegistrations
|
||||
.Where(er => er.UserId == user.UserId)
|
||||
.Select(er => er.Event.ToEventSummaryNoErDto())
|
||||
.Select(er => er.EventId)
|
||||
.ToListAsync();
|
||||
|
||||
var events = await context.Events
|
||||
.Where(e => eventIds.Contains(e.EventId))
|
||||
.Include(e => e.Organisation)
|
||||
.Select(e => e.ToEventSummaryDto())
|
||||
.ToListAsync();
|
||||
|
||||
return Results.Ok(events);
|
||||
@@ -240,4 +247,4 @@ namespace WebApp.Endpoints
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user