Reorganize project structure: - backend/cmd/openteam/ — entry point - backend/internal/ — core packages - backend/middleware/ — HTTP middleware - backend/router/ — route setup - backend/wire/ — dependency injection - backend/pkg/ — shared utilities - backend/go.mod, go.sum — Go module files Updated Makefile to work from backend/ directory. Removed old lowercase makefile.
30 lines
604 B
Go
30 lines
604 B
Go
package service
|
|
|
|
import (
|
|
"context"
|
|
"opencatd-open/internal/dao"
|
|
"opencatd-open/internal/store"
|
|
|
|
"gorm.io/gorm"
|
|
)
|
|
|
|
type TokenServiceImpl struct {
|
|
db *gorm.DB
|
|
tokenRepo *dao.TokenDAO
|
|
}
|
|
|
|
func NewTokenService(db *gorm.DB, tokenRepo *dao.TokenDAO) *TokenServiceImpl {
|
|
return &TokenServiceImpl{
|
|
db: db,
|
|
tokenRepo: tokenRepo,
|
|
}
|
|
}
|
|
|
|
func (t *TokenServiceImpl) GetByKey(ctx context.Context, key string) (*store.User, error) {
|
|
return t.tokenRepo.GetByKey(key)
|
|
}
|
|
|
|
func (t *TokenServiceImpl) GetByID(ctx context.Context, id uint64) (*store.User, error) {
|
|
return t.tokenRepo.GetByID(id)
|
|
}
|