feat: session repository, user repository mappers flatten
This commit is contained in:
@@ -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
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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{}
|
||||
@@ -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
|
||||
}
|
||||
Reference in New Issue
Block a user