// 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
}
