Skip to content

Commit

Permalink
solves #180. Artist searchable
Browse files Browse the repository at this point in the history
  • Loading branch information
deinelieblings committed Aug 20, 2024
1 parent 820cd7d commit 2eb2a32
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions dao/taking.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,18 +109,18 @@ func TakingUpdate(ctx context.Context, i *models.TakingUpdate, token *vcapool.Ac
return
}

func TakingGet(ctx context.Context, query *models.TakingQuery, token *vcapool.AccessToken) (result *[]models.Taking, listSize int64, err error) {
func TakingGet(ctx context.Context, query *models.TakingQuery, token *vcapool.AccessToken) (result []models.Taking, listSize int64, err error) {
if err = models.TakingPermission(token); err != nil {
return
}
result = new([]models.Taking)
result = []models.Taking{}
filter := query.PermittedFilter(token)
sort := query.Sort()
pipeline := models.TakingPipeline().SortFields(sort).Match(filter).Sort(sort).Skip(query.Skip, 0).Limit(query.Limit, 100).Pipe
if err = TakingCollection.Aggregate(
ctx,
pipeline,
result,
&result,
); err != nil {
return
}
Expand Down
2 changes: 1 addition & 1 deletion handlers/token/artist.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (i *ArtistHandler) Update(cc echo.Context) (err error) {
func (i *ArtistHandler) Delete(cc echo.Context) (err error) {
c := cc.(vcago.Context)
body := new(models.ArtistParam)
if c.BindAndValidate(body); err != nil {
if err = c.BindAndValidate(body); err != nil {
return c.ErrorResponse(err)
}
token := new(vcapool.AccessToken)
Expand Down
2 changes: 1 addition & 1 deletion handlers/token/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ func (i *LoginHandler) Callback(cc echo.Context) (err error) {
func (i *LoginHandler) LoginAPI(cc echo.Context) (err error) {
c := cc.(vcago.Context)
body := new(models.UserEmail)
if c.BindAndValidate(body); err != nil {
if err = c.BindAndValidate(body); err != nil {
return
}
result := new(models.User)
Expand Down
2 changes: 1 addition & 1 deletion handlers/token/organizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ func (i *OrganizerHandler) Update(cc echo.Context) (err error) {
func (i *OrganizerHandler) Delete(cc echo.Context) (err error) {
c := cc.(vcago.Context)
body := new(models.OrganizerParam)
if c.BindAndValidate(body); err != nil {
if err = c.BindAndValidate(body); err != nil {
return c.ErrorResponse(err)
}
token := new(vcapool.AccessToken)
Expand Down
2 changes: 1 addition & 1 deletion handlers/token/taking.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (i TakingHandler) Get(cc echo.Context) (err error) {
if err = c.AccessToken(token); err != nil {
return
}
result := new([]models.Taking)
var result []models.Taking
var listSize int64
if result, listSize, err = dao.TakingGet(c.Ctx(), body, token); err != nil {
return
Expand Down
2 changes: 1 addition & 1 deletion models/taking.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ func TakingPipeline() *vmdb.Pipeline {
pipe.Lookup(SourceCollection, "_id", "taking_id", "sources")
pipe.LookupUnwind(CrewCollection, "crew_id", "_id", "crew")
pipe.LookupUnwind(EventCollection, "_id", "taking_id", "event")
//pipe.LookupList(ArtistCollection, "event.artist_ids", "_id", "event.artists")
pipe.Lookup(ArtistCollection, "event.artist_ids", "_id", "event.artists")
pipe.Append(bson.D{{Key: "$addFields", Value: bson.D{
{Key: "state.wait.amount", Value: bson.D{{Key: "$sum", Value: "$wait.money.amount"}}},
}}})
Expand Down

0 comments on commit 2eb2a32

Please sign in to comment.