Introduces invite, verify, accept, resend, and revoke flows using team_members and invitation tokens, sends the branded invitation template, and requires account activation before team login. Co-authored-by: Cursor <cursoragent@cursor.com>
42 lines
984 B
Go
42 lines
984 B
Go
package team
|
|
|
|
import (
|
|
"Yimaru-Backend/internal/ports"
|
|
emailtemplates "Yimaru-Backend/internal/services/emailtemplates"
|
|
"Yimaru-Backend/internal/services/messenger"
|
|
"time"
|
|
)
|
|
|
|
type Service struct {
|
|
teamStore ports.TeamStore
|
|
refreshExpirySec int
|
|
emailTemplateSvc *emailtemplates.Service
|
|
messengerSvc *messenger.Service
|
|
inviteBaseURL string
|
|
inviteExpiry time.Duration
|
|
}
|
|
|
|
func NewService(
|
|
teamStore ports.TeamStore,
|
|
refreshExpirySeconds int,
|
|
emailTemplateSvc *emailtemplates.Service,
|
|
messengerSvc *messenger.Service,
|
|
inviteBaseURL string,
|
|
inviteExpiry time.Duration,
|
|
) *Service {
|
|
if refreshExpirySeconds <= 0 {
|
|
refreshExpirySeconds = 7 * 24 * 3600
|
|
}
|
|
if inviteExpiry <= 0 {
|
|
inviteExpiry = 7 * 24 * time.Hour
|
|
}
|
|
return &Service{
|
|
teamStore: teamStore,
|
|
refreshExpirySec: refreshExpirySeconds,
|
|
emailTemplateSvc: emailTemplateSvc,
|
|
messengerSvc: messengerSvc,
|
|
inviteBaseURL: inviteBaseURL,
|
|
inviteExpiry: inviteExpiry,
|
|
}
|
|
}
|