feat(#41): admin/renders pagination + user name link + output + project name
Build backend images / build content-svc (push) Failing after 1m1s
Build backend images / build file-svc (push) Failing after 56s
Build backend images / build gateway (push) Failing after 49s
Build backend images / build identity-svc (push) Failing after 50s
Build backend images / build notification-svc (push) Failing after 49s
Build backend images / build render-svc (push) Failing after 1m2s
Build backend images / build studio-svc (push) Failing after 47s

render-svc admin-renders enriches jobs with user_name/email (cross-schema lookup to
identity.users). Page adds prev/next pagination (page_size 30). Table adds User column
(name → /admin/users?q=email) and Output column (export → /admin/exports), and shows
project_name. Verified: 21 jobs, paginated, names resolved.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
soroush.asadi
2026-06-07 05:24:47 +03:30
parent d56bcf1b23
commit fca6bcac53
4 changed files with 100 additions and 6 deletions
@@ -41,5 +41,47 @@ func (s *Store) ListAllJobs(ctx context.Context, status string, page, pageSize i
}
defer rows.Close()
jobs, err := scanJobs(rows)
if err != nil {
return nil, 0, err
}
s.attachUserInfo(ctx, jobs)
return jobs, total, err
}
// attachUserInfo fills UserName/UserEmail on each job via one cross-schema lookup
// against identity.users (same Postgres DB). Best-effort — failures leave names blank.
func (s *Store) attachUserInfo(ctx context.Context, jobs []*models.RenderJob) {
if len(jobs) == 0 {
return
}
ids := make([]string, 0, len(jobs))
seen := map[string]bool{}
for _, j := range jobs {
id := j.UserID.String()
if !seen[id] {
seen[id] = true
ids = append(ids, id)
}
}
rows, err := s.pool.Query(ctx,
`SELECT id::text, COALESCE(full_name,''), COALESCE(email,'') FROM identity.users WHERE id = ANY($1)`,
ids)
if err != nil {
return
}
defer rows.Close()
type ui struct{ name, email string }
m := map[string]ui{}
for rows.Next() {
var id, name, email string
if rows.Scan(&id, &name, &email) == nil {
m[id] = ui{name, email}
}
}
for _, j := range jobs {
if info, ok := m[j.UserID.String()]; ok {
j.UserName = info.name
j.UserEmail = info.email
}
}
}
@@ -180,6 +180,9 @@ type RenderJob struct {
CompletedAt *time.Time `json:"completed_at,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
// Admin-list enrichment (set by the handler via a cross-schema lookup, not scanned).
UserName string `json:"user_name,omitempty"`
UserEmail string `json:"user_email,omitempty"`
}
type FrameJob struct {