Chever John 9c39c8cbd7
init: iloom WMS monorepo with K8s deployment manifests
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>
2026-06-14 11:33:31 +08:00

55 lines
1.5 KiB
Go

package service
import (
"context"
"fmt"
"github.com/muyuqingfeng/iloom/washing-service/internal/model"
"github.com/muyuqingfeng/iloom/washing-service/internal/repository"
)
type PlanService struct {
repo *repository.PlanRepo
}
func NewPlanService(repo *repository.PlanRepo) *PlanService {
return &PlanService{repo: repo}
}
func (s *PlanService) List(ctx context.Context, companyID string) ([]model.WashingPlan, error) {
return s.repo.List(ctx, companyID)
}
func (s *PlanService) GetByID(ctx context.Context, id, companyID string) (*model.WashingPlan, error) {
plan, err := s.repo.GetByID(ctx, id)
if err != nil {
return nil, err
}
if plan == nil {
return nil, fmt.Errorf("washing plan not found")
}
if plan.WashingFactoryID == nil || *plan.WashingFactoryID != companyID {
return nil, fmt.Errorf("washing plan not found")
}
return plan, nil
}
func (s *PlanService) UpdateStatus(ctx context.Context, id, companyID, status string) error {
plan, err := s.repo.GetByID(ctx, id)
if err != nil {
return err
}
if plan == nil || plan.WashingFactoryID == nil || *plan.WashingFactoryID != companyID {
return fmt.Errorf("washing plan not found")
}
return s.repo.UpdateStatus(ctx, id, status)
}
func (s *PlanService) Pending(ctx context.Context, companyID string) ([]model.WashingPlan, error) {
return s.repo.Pending(ctx, companyID)
}
func (s *PlanService) Completed(ctx context.Context, companyID string) ([]model.WashingPlan, error) {
return s.repo.Completed(ctx, companyID)
}