From be5a5a08710c3dd3f118c105748b5621387b1eea Mon Sep 17 00:00:00 2001 From: Dennis Kleber Date: Wed, 26 Feb 2025 16:00:51 +0100 Subject: [PATCH 1/3] solves #226 --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index d495b2e..793da9f 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module pool-backend go 1.21 require ( - github.com/Viva-con-Agua/vcago v1.5.7 + github.com/Viva-con-Agua/vcago v1.5.11 github.com/google/uuid v1.6.0 github.com/labstack/echo/v4 v4.12.0 go.mongodb.org/mongo-driver v1.17.0 diff --git a/go.sum b/go.sum index 3fef7f4..b5df64f 100644 --- a/go.sum +++ b/go.sum @@ -33,8 +33,8 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/Viva-con-Agua/vcago v1.5.7 h1:QYcyqn+q0qq3dhj0xSfy4Ajgn/6x0kzne/2M+4aru0o= -github.com/Viva-con-Agua/vcago v1.5.7/go.mod h1:uJ7sBZk8IOEJbHgZ97uY+WE6TLMGkhiPvey3CxFOs4A= +github.com/Viva-con-Agua/vcago v1.5.11 h1:AqMnaQuDZNxSymmLf/OFREi12IcRG/Kx/PItljSMiZk= +github.com/Viva-con-Agua/vcago v1.5.11/go.mod h1:uJ7sBZk8IOEJbHgZ97uY+WE6TLMGkhiPvey3CxFOs4A= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= From b685e6ce2e82f3218f789c8786590f30e74e5fb2 Mon Sep 17 00:00:00 2001 From: Eike Broda Date: Thu, 27 Feb 2025 18:42:18 +0100 Subject: [PATCH 2/3] Add a route to get artists with api token --- handlers/token/artist.go | 1 + 1 file changed, 1 insertion(+) diff --git a/handlers/token/artist.go b/handlers/token/artist.go index fd05513..3ed3249 100644 --- a/handlers/token/artist.go +++ b/handlers/token/artist.go @@ -18,6 +18,7 @@ func (i *ArtistHandler) Routes(group *echo.Group) { group.Use(i.Context) group.POST("", i.Create, accessCookie) group.GET("", i.Get, accessCookie) + group.GET("/api_token", i.Get, vcago.KeyAuthMiddleware()) group.GET("/:id", i.GetByID, accessCookie) group.PUT("", i.Update, accessCookie) group.DELETE("/:id", i.Delete, accessCookie) From 24a009caadcbbd878272b47f44c62532e5baf906 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20K=C3=A4stle?= Date: Thu, 27 Feb 2025 21:47:22 +0100 Subject: [PATCH 3/3] filter asp events and set participations right --- dao/participation.go | 3 +++ models/event.go | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dao/participation.go b/dao/participation.go index d6cc13e..b6dd686 100644 --- a/dao/participation.go +++ b/dao/participation.go @@ -28,6 +28,9 @@ func ParticipationInsert(ctx context.Context, i *models.ParticipationCreate, tok } if _, err = EventApplicationsUpdate(ctx, &models.EventApplicationsUpdate{ID: i.EventID, Applications: models.EventApplications{ Requested: event.Applications.Requested + 1, + Confirmed: event.Applications.Confirmed, + Rejected: event.Applications.Rejected, + Withdrawn: event.Applications.Withdrawn, Total: event.Applications.Total + 1, }}); err != nil { return diff --git a/models/event.go b/models/event.go index 301eae0..e78d7e0 100644 --- a/models/event.go +++ b/models/event.go @@ -592,10 +592,15 @@ func (i *EventParam) PublicFilter() bson.D { func (i *EventQuery) FilterAsp(token *AccessToken) bson.D { filter := vmdb.NewFilter() if token.PoolRoles.Validate(ASPEventRole) { - filter.EqualString("crew_id", token.CrewID) + status := bson.A{} + status = append(status, bson.D{{Key: "event_asp_id", Value: token.ID}}) + status = append(status, bson.D{{Key: "crew_id", Value: token.CrewID}}) + filter.Append(bson.E{Key: "$or", Value: status}) } else { filter.EqualString("event_asp_id", token.ID) } + filter.GteInt64("end_at", fmt.Sprint(time.Now().AddDate(0, -6, 0).Unix())) + filter.EqualStringList("event_state.state", []string{"published", "finished"}) return filter.Bson() }