Go workspace (go.work) with 5 microservices + shared library: - gateway (8080), auth-service (8081), purchaser-service (8082) - textile-service (8083), washing-service (8084) - shared: proto definitions, common packages Infrastructure: docker-compose for local dev, K8s manifests for K3s cluster deployment (mysql/redis/etcd + traefik ingress). Frontend (iloom-flatten) added as git submodule. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
34 lines
824 B
Go
34 lines
824 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"fmt"
|
|
|
|
"github.com/muyuqingfeng/iloom/auth-service/internal/model"
|
|
"github.com/muyuqingfeng/iloom/auth-service/internal/repository"
|
|
)
|
|
|
|
type CompanyService struct {
|
|
repo *repository.CompanyRepo
|
|
}
|
|
|
|
func NewCompanyService(repo *repository.CompanyRepo) *CompanyService {
|
|
return &CompanyService{repo: repo}
|
|
}
|
|
|
|
func (s *CompanyService) GetByID(ctx context.Context, id string) (*model.Company, error) {
|
|
company, err := s.repo.GetByID(ctx, id)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("get company: %w", err)
|
|
}
|
|
if company == nil {
|
|
return nil, errors.New("company not found")
|
|
}
|
|
return company, nil
|
|
}
|
|
|
|
func (s *CompanyService) ListRelationships(ctx context.Context, companyID string) ([]model.CompanyRelationship, error) {
|
|
return s.repo.ListRelationships(ctx, companyID)
|
|
}
|