fix: delete desktop release oss objects
This commit is contained in:
@@ -328,6 +328,28 @@ func (r *DesktopClientReleaseRepository) SetEnabled(ctx context.Context, id int6
|
||||
RETURNING `+desktopClientReleaseColumns, enabled, actorID, id))
|
||||
}
|
||||
|
||||
func (r *DesktopClientReleaseRepository) HasObjectReference(ctx context.Context, objectKey string, excludeID int64) (bool, error) {
|
||||
if objectKey == "" {
|
||||
return false, nil
|
||||
}
|
||||
var exists bool
|
||||
err := r.pool.QueryRow(ctx, `
|
||||
SELECT EXISTS (
|
||||
SELECT 1
|
||||
FROM ops.desktop_client_releases
|
||||
WHERE id <> $1
|
||||
AND (
|
||||
(download_source = 'oss' AND oss_object_key = $2)
|
||||
OR
|
||||
(updater_download_source = 'oss' AND updater_oss_object_key = $2)
|
||||
)
|
||||
)`, excludeID, objectKey).Scan(&exists)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
return exists, nil
|
||||
}
|
||||
|
||||
func (r *DesktopClientReleaseRepository) Delete(ctx context.Context, id int64) error {
|
||||
cmd, err := r.pool.Exec(ctx, `DELETE FROM ops.desktop_client_releases WHERE id = $1`, id)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user