Merge branch 'dev' into 'main'
added sort to VerificationRepository.GetByUserID See merge request backend/verification!7
This commit is contained in:
commit
4349f2b865
@ -204,8 +204,10 @@ func (r *VerificationRepository) GetByUserId(ctx context.Context, userID string)
|
|||||||
"user_id": userID,
|
"user_id": userID,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
opts := options.FindOne().SetSort(bson.D{{Key: "updated_at", Value: -1}})
|
||||||
|
|
||||||
var result models.Verification
|
var result models.Verification
|
||||||
err := r.mongo.FindOne(ctx, filter).Decode(&result)
|
err := r.mongo.FindOne(ctx, filter, opts).Decode(&result)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == mongo.ErrNoDocuments {
|
if err == mongo.ErrNoDocuments {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
Loading…
Reference in New Issue
Block a user