mirror of
https://github.com/coder/coder.git
synced 2025-07-06 15:41:45 +00:00
DELETE license API endpoint (#3697)
* DELETE license API endpoint Signed-off-by: Spike Curtis <spike@coder.com> * Fix new lint stuff Signed-off-by: Spike Curtis <spike@coder.com> Signed-off-by: Spike Curtis <spike@coder.com>
This commit is contained in:
@ -2301,6 +2301,20 @@ func (q *fakeQuerier) GetLicenses(_ context.Context) ([]database.License, error)
|
||||
return results, nil
|
||||
}
|
||||
|
||||
func (q *fakeQuerier) DeleteLicense(_ context.Context, id int32) (int32, error) {
|
||||
q.mutex.Lock()
|
||||
defer q.mutex.Unlock()
|
||||
|
||||
for index, l := range q.licenses {
|
||||
if l.ID == id {
|
||||
q.licenses[index] = q.licenses[len(q.licenses)-1]
|
||||
q.licenses = q.licenses[:len(q.licenses)-1]
|
||||
return id, nil
|
||||
}
|
||||
}
|
||||
return 0, sql.ErrNoRows
|
||||
}
|
||||
|
||||
func (q *fakeQuerier) GetUserLinkByLinkedID(_ context.Context, id string) (database.UserLink, error) {
|
||||
q.mutex.RLock()
|
||||
defer q.mutex.RUnlock()
|
||||
|
Reference in New Issue
Block a user