33 lines
913 B
Go
33 lines
913 B
Go
package projects
|
|
|
|
import (
|
|
"context"
|
|
|
|
"velox-bot/internal/db/repos/projectsrepo"
|
|
)
|
|
|
|
type Service struct {
|
|
repo *projectsrepo.Repo
|
|
}
|
|
|
|
func New(repo *projectsrepo.Repo) *Service {
|
|
return &Service{repo: repo}
|
|
}
|
|
|
|
func (s *Service) CreateProject(ctx context.Context, guildID, creatorID int64, name, description string) (int64, error) {
|
|
return s.repo.CreateProject(ctx, guildID, creatorID, name, description)
|
|
}
|
|
|
|
func (s *Service) AddHelper(ctx context.Context, projectID, userID int64) error {
|
|
return s.repo.AddHelper(ctx, projectID, userID)
|
|
}
|
|
|
|
func (s *Service) ListActiveWithMembers(ctx context.Context, guildID int64, limit int) ([]*projectsrepo.ProjectWithMembers, error) {
|
|
return s.repo.ListActiveProjectsWithMembers(ctx, guildID, limit)
|
|
}
|
|
|
|
func (s *Service) ProjectExistsInGuild(ctx context.Context, guildID, projectID int64) (bool, error) {
|
|
return s.repo.ProjectExistsInGuild(ctx, guildID, projectID)
|
|
}
|
|
|