package sql import ( "context" "tercul/internal/domain/auth" "time" "gorm.io/gorm" ) type authRepository struct { db *gorm.DB } func NewAuthRepository(db *gorm.DB) auth.AuthRepository { return &authRepository{db: db} } func (r *authRepository) StoreToken(ctx context.Context, userID uint, token string, expiresAt time.Time) error { session := &auth.UserSession{ UserID: userID, Token: token, ExpiresAt: expiresAt, } return r.db.WithContext(ctx).Create(session).Error } func (r *authRepository) DeleteToken(ctx context.Context, token string) error { return r.db.WithContext(ctx).Where("token = ?", token).Delete(&auth.UserSession{}).Error }