Initial commit: Open sourcing all of the Maple Open Technologies code.

This commit is contained in:
Bartlomiej Mika 2025-12-02 14:33:08 -05:00
commit 755d54a99d
2010 changed files with 448675 additions and 0 deletions

View file

@ -0,0 +1,33 @@
package session
import (
"time"
"codeberg.org/mapleopentech/monorepo/native/desktop/maplefile/internal/domain/session"
)
type CreateUseCase struct {
sessionRepo session.Repository
}
// ProvideCreateUseCase creates the use case for Wire
func ProvideCreateUseCase(sessionRepo session.Repository) *CreateUseCase {
return &CreateUseCase{sessionRepo: sessionRepo}
}
// Execute creates and stores a new session
func (uc *CreateUseCase) Execute(
userID, email, accessToken, refreshToken string,
expiresIn time.Duration,
) error {
sess := &session.Session{
UserID: userID,
Email: email,
AccessToken: accessToken,
RefreshToken: refreshToken,
ExpiresAt: time.Now().Add(expiresIn),
CreatedAt: time.Now(),
}
return uc.sessionRepo.Save(sess)
}