feat: session repository, user repository mappers flatten

This commit is contained in:
2025-09-06 14:53:14 +03:30
parent c3c7e908f0
commit 7e471fd8d9
13 changed files with 246 additions and 69 deletions
+28
View File
@@ -0,0 +1,28 @@
package domain
import (
"context"
"time"
"github.com/google/uuid"
)
type SessionRepo interface {
Create(ctx context.Context, session *UserSession) error
GetByID(ctx context.Context, id uuid.UUID) (*UserSession, error)
Delete(ctx context.Context, id uuid.UUID) error
GetUserSessions(ctx context.Context, userID uuid.UUID) ([]UserSession, error)
}
type UserSession struct {
ID uuid.UUID
UserID uuid.UUID
User User
WalletID uuid.UUID
IPaddress string
Agent string
ExpiresAt time.Time
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt *time.Time
}
+29
View File
@@ -0,0 +1,29 @@
package domain
import (
"context"
"time"
"github.com/google/uuid"
)
type UserRepo interface {
Create(ctx context.Context, user *User) error
GetByID(ctx context.Context, id uuid.UUID) (*User, error)
GetByPhone(ctx context.Context, phone string) (*User, error)
Update(ctx context.Context, user *User) error
Delete(ctx context.Context, id uuid.UUID) error
}
type User struct {
ID uuid.UUID
PubKey string
Name string
LastName string
PhoneNumber string
NationalID string
LastLogin *time.Time
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt *time.Time
}
-7
View File
@@ -1,7 +0,0 @@
package user
// Repo represents the user repository interface.
type Repo interface{}
// Service represents the user service interface.(UseCases)
type Service interface{}
-28
View File
@@ -1,28 +0,0 @@
package user
import (
"time"
"github.com/google/uuid"
)
type User struct {
ID uuid.UUID
Name string
LastName string
PhoneNumber string
NationalID string
CreatedAt time.Time
UpdatedAt time.Time
DeletedAt *time.Time
}
type UserSession struct {
ID uuid.UUID
UserID uuid.UUID
WalletID uuid.UUID
IPaddress string
Agent string
ExpiresAt time.Time
CreatedAt time.Time
}