Skip to content

Commit 22eb490

Browse files
authored
chore: sort config order by update time (#337)
1 parent 75b051c commit 22eb490

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pkg/database/config.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,10 @@ func GetSourceConfigs(ctx context.Context, kind, id, config string, limit, page
183183
)
184184
}
185185

186+
query.Apply(
187+
sm.OrderBy(psql.Quote("updated_at")).Desc(),
188+
)
189+
186190
// Get total count of results
187191
totalCount := 0
188192
totalQuery := psql.Select(sm.From(query), sm.Columns("count(*)"))
@@ -271,6 +275,10 @@ func GetConditionConfigs(ctx context.Context, kind, id, config string, limit, pa
271275
)
272276
}
273277

278+
query.Apply(
279+
sm.OrderBy(psql.Quote("updated_at")).Desc(),
280+
)
281+
274282
totalCount := 0
275283
totalQuery := psql.Select(sm.From(query), sm.Columns("count(*)"))
276284
totalQueryString, totalArgs, err := totalQuery.Build(ctx)
@@ -362,6 +370,10 @@ func GetTargetConfigs(ctx context.Context, kind, id, config string, limit, page
362370
)
363371
}
364372

373+
query.Apply(
374+
sm.OrderBy(psql.Quote("updated_at")).Desc(),
375+
)
376+
365377
totalCount := 0
366378
totalQuery := psql.Select(sm.From(query), sm.Columns("count(*)"))
367379
totalQueryString, totalArgs, err := totalQuery.Build(ctx)

0 commit comments

Comments
 (0)