Update PaginateExecutionsParams return type to include related names

This commit is contained in:
Luis Eduardo Jeréz Girón
2024-07-24 07:38:13 -06:00
parent 667ce52e9d
commit 3a3f46f257
2 changed files with 6 additions and 2 deletions

View File

@@ -18,7 +18,7 @@ type PaginateExecutionsParams struct {
func (s *Service) PaginateExecutions(
ctx context.Context, params PaginateExecutionsParams,
) (paginateutil.PaginateResponse, []dbgen.Execution, error) {
) (paginateutil.PaginateResponse, []dbgen.ExecutionsServicePaginateExecutionsRow, error) {
page := max(params.Page, 1)
limit := min(max(params.Limit, 1), 100)

View File

@@ -24,7 +24,11 @@ AND
);
-- name: ExecutionsServicePaginateExecutions :many
SELECT executions.*
SELECT
executions.*,
backups.name AS backup_name,
databases.name AS database_name,
destinations.name AS destination_name
FROM executions
JOIN backups ON backups.id = executions.backup_id
JOIN databases ON databases.id = backups.database_id