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.
OneAuth/api/org/get.go

24 lines
511 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 GetRequest struct {
OrgID string `src:"path@org_id" desc:"组织ID"`
}
func get(x *vigo.X, req *GetRequest) (*models.Org, error) {
var org models.Org
if err := cfg.DB().First(&org, "id = ?", req.OrgID).Error; err != nil {
return nil, vigo.ErrNotFound
}
return &org, nil
}