Skip to content

Commit

Permalink
Merge pull request #13 from Viva-con-Agua/feature/default_id_filter
Browse files Browse the repository at this point in the history
added default filter for IDParam
  • Loading branch information
deinelieblings authored Sep 27, 2024
2 parents 581bbe7 + 0843b15 commit 66929e3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion vmod/defaults.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
package vmod

import "mime/multipart"
import (
"mime/multipart"

"go.mongodb.org/mongo-driver/bson"
)

// IDParam data struct for handling '/:id'.
// ID needs to be a uuid.
type IDParam struct {
ID string `param:"id" validate:"uuid"`
}

func (i *IDParam) Filter() bson.D {
return bson.D{{Key: "_id", Value: i.ID}}
}

// DeletedResponse used for handling response in deleted case.
type DeletedResponse struct {
ID string `json:"id"`
Expand Down

0 comments on commit 66929e3

Please sign in to comment.