init
This commit is contained in:
17
internal/core/port/auth.go
Normal file
17
internal/core/port/auth.go
Normal file
@ -0,0 +1,17 @@
|
||||
package port
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/aykhans/oh-my-chat/internal/core/domain"
|
||||
)
|
||||
|
||||
type TokenService interface {
|
||||
CreateToken(user *domain.User) (string, error)
|
||||
VerifyToken(token string) (*domain.AuthPayload, error)
|
||||
}
|
||||
|
||||
type AuthService interface {
|
||||
LoginByEmail(ctx context.Context, email, password string) (string, error)
|
||||
LoginByUsername(ctx context.Context, username, password string) (string, error)
|
||||
}
|
26
internal/core/port/message.go
Normal file
26
internal/core/port/message.go
Normal file
@ -0,0 +1,26 @@
|
||||
package port
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/aykhans/oh-my-chat/internal/core/domain"
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type MessageProducer interface {
|
||||
ProduceMessage(ctx context.Context, message *domain.Message) error
|
||||
}
|
||||
|
||||
type MessageConsumer interface {
|
||||
ConsumeMessage(ctx context.Context, uid string, getChats func() []string, message chan<- *domain.StreamMessage) error
|
||||
}
|
||||
|
||||
type MessageRepository interface {
|
||||
CreateMessage(ctx context.Context, message *domain.Message) (*domain.Message, error)
|
||||
}
|
||||
|
||||
type MessageService interface {
|
||||
SendMessage(ctx context.Context, message *domain.Message) error
|
||||
ReceiveMessage(ctx context.Context, userID uuid.UUID, message chan<- *domain.StreamMessage) error
|
||||
CreateMessage(ctx context.Context, message *domain.Message) (*domain.Message, error)
|
||||
}
|
22
internal/core/port/user.go
Normal file
22
internal/core/port/user.go
Normal file
@ -0,0 +1,22 @@
|
||||
package port
|
||||
|
||||
import (
|
||||
"context"
|
||||
"github.com/aykhans/oh-my-chat/internal/core/domain"
|
||||
)
|
||||
|
||||
type UserRepository interface {
|
||||
CreateUser(ctx context.Context, user *domain.User) (*domain.User, error)
|
||||
GetUserByEmail(ctx context.Context, email string) (*domain.User, error)
|
||||
GetUserByUsername(ctx context.Context, username string) (*domain.User, error)
|
||||
IsUsernameExists(ctx context.Context, username string) (bool, error)
|
||||
IsEmailExists(ctx context.Context, email string) (bool, error)
|
||||
// GetUserByID(ctx context.Context, id uint64) (*domain.User, error)
|
||||
// DeleteUser(ctx context.Context, id uint64) error
|
||||
}
|
||||
|
||||
type UserService interface {
|
||||
Register(ctx context.Context, user *domain.User) (*domain.User, error)
|
||||
// GetUser(ctx context.Context, id uint64) (*domain.User, error)
|
||||
// DeleteUser(ctx context.Context, id uint64) error
|
||||
}
|
Reference in New Issue
Block a user