feat: project add & list

This commit is contained in:
2026-03-18 00:40:13 +00:00
parent e33eea6d24
commit 10c2efef7d
9 changed files with 555 additions and 2 deletions
+32
View File
@@ -0,0 +1,32 @@
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)
}
+4 -1
View File
@@ -4,6 +4,7 @@ import (
"velox-bot/internal/db/services/level"
"velox-bot/internal/db/services/levelsettings"
"velox-bot/internal/db/services/meeting"
"velox-bot/internal/db/services/projects"
"velox-bot/internal/db/services/rps"
)
@@ -11,16 +12,18 @@ type Services struct {
Level *level.Service
LevelSettings *levelsettings.Service
Meeting *meeting.Service
Projects *projects.Service
RPS *rps.Service
}
var Global *Services
func NewServices(level *level.Service, levelSettings *levelsettings.Service, meeting *meeting.Service, rps *rps.Service) *Services {
func NewServices(level *level.Service, levelSettings *levelsettings.Service, meeting *meeting.Service, projects *projects.Service, rps *rps.Service) *Services {
s := &Services{
Level: level,
LevelSettings: levelSettings,
Meeting: meeting,
Projects: projects,
RPS: rps,
}
Global = s