mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-28 17:50:56 +01:00
feat: updated grpc for dependencies service
This commit is contained in:
@@ -86,7 +86,6 @@ func (ctr *BaseControllerV2[T]) PutById(c *gin.Context) {
|
||||
|
||||
u := GetUserFromContextV2(c)
|
||||
m := any(&model).(interfaces.ModelV2)
|
||||
m.SetId(primitive.NewObjectID())
|
||||
m.SetUpdated(u.Id)
|
||||
|
||||
if err := ctr.modelSvc.ReplaceById(id, model); err != nil {
|
||||
@@ -170,14 +169,19 @@ func (ctr *BaseControllerV2[T]) DeleteList(c *gin.Context) {
|
||||
}
|
||||
|
||||
func (ctr *BaseControllerV2[T]) getAll(c *gin.Context) {
|
||||
models, err := ctr.modelSvc.GetMany(nil, &mongo.FindOptions{
|
||||
Sort: bson.D{{"_id", -1}},
|
||||
query := MustGetFilterQuery(c)
|
||||
sort := MustGetSortOption(c)
|
||||
if sort == nil {
|
||||
sort = bson.D{{"_id", -1}}
|
||||
}
|
||||
models, err := ctr.modelSvc.GetMany(query, &mongo.FindOptions{
|
||||
Sort: sort,
|
||||
})
|
||||
if err != nil {
|
||||
HandleErrorInternalServerError(c, err)
|
||||
return
|
||||
}
|
||||
total, err := ctr.modelSvc.Count(nil)
|
||||
total, err := ctr.modelSvc.Count(query)
|
||||
if err != nil {
|
||||
HandleErrorInternalServerError(c, err)
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user