mirror of https://github.com/veypi/OneAuth.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
596 B
Go
29 lines
596 B
Go
// Copyright (C) 2024 veypi <i@veypi.com>
|
|
// 2025-03-04 16:08:06
|
|
// Distributed under terms of the MIT license.
|
|
|
|
package org
|
|
|
|
import (
|
|
"github.com/veypi/vbase/cfg"
|
|
"github.com/veypi/vbase/models"
|
|
"github.com/veypi/vigo"
|
|
)
|
|
|
|
type DeleteRequest struct {
|
|
OrgID string `src:"path@org_id" desc:"组织ID"`
|
|
}
|
|
|
|
func del(x *vigo.X, req *DeleteRequest) error {
|
|
var org models.Org
|
|
if err := cfg.DB().First(&org, "id = ?", req.OrgID).Error; err != nil {
|
|
return vigo.ErrNotFound
|
|
}
|
|
|
|
if err := cfg.DB().Delete(&org).Error; err != nil {
|
|
return vigo.ErrInternalServer.WithError(err)
|
|
}
|
|
|
|
return nil
|
|
}
|