mirror of
https://github.com/GCMatters/hermes.git
synced 2026-02-04 13:40: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 System.Text;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using WebApp.Data;
|
using WebApp.Data;
|
||||||
@@ -95,9 +95,16 @@ namespace WebApp.Endpoints
|
|||||||
|
|
||||||
if(!user.IsOrganisation)
|
if(!user.IsOrganisation)
|
||||||
{
|
{
|
||||||
var events = await context.EventRegistrations
|
|
||||||
|
var eventIds = await context.EventRegistrations
|
||||||
.Where(er => er.UserId == user.UserId)
|
.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();
|
.ToListAsync();
|
||||||
|
|
||||||
return Results.Ok(events);
|
return Results.Ok(events);
|
||||||
|
|||||||
Reference in New Issue
Block a user