fix: allow desktop release version history
This commit is contained in:
@@ -199,6 +199,56 @@ func (r *DesktopClientReleaseRepository) FindEnabled(ctx context.Context, target
|
||||
target.Platform, target.Channel, target.Arch))
|
||||
}
|
||||
|
||||
func (r *DesktopClientReleaseRepository) ListEnabledByTarget(ctx context.Context, target DesktopClientReleaseTarget) ([]domain.DesktopClientRelease, error) {
|
||||
rows, err := r.pool.Query(ctx, `
|
||||
SELECT `+desktopClientReleaseColumns+`
|
||||
FROM ops.desktop_client_releases
|
||||
WHERE platform = $1
|
||||
AND channel = $2
|
||||
AND enabled = TRUE
|
||||
AND (arch = $3 OR arch = 'universal')
|
||||
ORDER BY CASE WHEN arch = $3 THEN 0 ELSE 1 END, updated_at DESC, id DESC`,
|
||||
target.Platform, target.Channel, target.Arch)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
items := []domain.DesktopClientRelease{}
|
||||
for rows.Next() {
|
||||
item, scanErr := scanDesktopClientRelease(rows)
|
||||
if scanErr != nil {
|
||||
return nil, scanErr
|
||||
}
|
||||
items = append(items, *item)
|
||||
}
|
||||
return items, rows.Err()
|
||||
}
|
||||
|
||||
func (r *DesktopClientReleaseRepository) ListEnabledByChannel(ctx context.Context, channel string) ([]domain.DesktopClientRelease, error) {
|
||||
rows, err := r.pool.Query(ctx, `
|
||||
SELECT `+desktopClientReleaseColumns+`
|
||||
FROM ops.desktop_client_releases
|
||||
WHERE channel = $1
|
||||
AND enabled = TRUE
|
||||
ORDER BY channel ASC, platform ASC, arch ASC, updated_at DESC, id DESC`,
|
||||
channel)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer rows.Close()
|
||||
|
||||
items := []domain.DesktopClientRelease{}
|
||||
for rows.Next() {
|
||||
item, scanErr := scanDesktopClientRelease(rows)
|
||||
if scanErr != nil {
|
||||
return nil, scanErr
|
||||
}
|
||||
items = append(items, *item)
|
||||
}
|
||||
return items, rows.Err()
|
||||
}
|
||||
|
||||
func (r *DesktopClientReleaseRepository) Create(ctx context.Context, in UpsertDesktopClientReleaseInput) (*domain.DesktopClientRelease, error) {
|
||||
return scanDesktopClientRelease(r.pool.QueryRow(ctx, `
|
||||
INSERT INTO ops.desktop_client_releases (
|
||||
|
||||
Reference in New Issue
Block a user