generated from VLADIMIR/template
add last action delete
This commit is contained in:
@@ -110,3 +110,26 @@ func (r *ApplicationsRepo) UpdateApplicationStatus(
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *ApplicationsRepo) DeleteApplicationByTeamIdAndName(ctx context.Context, teamId int, name string) error {
|
||||
tag, err := r.pool.Exec(
|
||||
ctx,
|
||||
`DELETE FROM applications
|
||||
WHERE id IN (
|
||||
SELECT id
|
||||
FROM applications
|
||||
WHERE team_id = $1 and name = $2
|
||||
ORDER BY created_at DESC
|
||||
LIMIT 1
|
||||
)`,
|
||||
teamId,
|
||||
name,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if tag.RowsAffected() == 0 {
|
||||
return ErrApplicationNotFound
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user