domain

package
v0.0.0-...-b98cd92 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 10, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const UserKey = userKey("UserKey")

Variables

This section is empty.

Functions

This section is empty.

Types

type Envelope

type Envelope map[string]any

type ErrAlreadyExists

type ErrAlreadyExists error

type ErrBadlyFormattedJson

type ErrBadlyFormattedJson error

type ErrEditConflict

type ErrEditConflict error

type ErrInvalidCredentials

type ErrInvalidCredentials error

type ErrNoRecord

type ErrNoRecord error

type ErrServer

type ErrServer error

type Error

type Error map[string]string

type Image

type Image struct {
	ID        int64  `json:"id"`
	Name      string `json:"name"`
	ImageData []byte `json:"image_data"`
}

type RepositoryProvider

type RepositoryProvider interface {
	CreateImage(base64File, name string) (int64, error)
	GetImage(id int64) (*string, *string, error)
	CreateUser(email, name string, avatarId *int64, passwordHash []byte) error
	GetUser(email string) (*User, error)
	CreateToken(userId int64, hash []byte, expiry time.Time) error
	GetUserFromToken(token []byte) (*User, error)
	CreateTask(title, description, status string, assignee int64) error
	GetAllTasks(status string) ([]*Task, error)
}

type ServiceProvider

type ServiceProvider interface {
	CreateImage(file io.ReadCloser) (int64, error)
	GetImage(id int64) (*Image, error)
	CreateTask(title, description, status string, assignee int64) error
	GetAllTasks(status string) ([]*Task, error)
	Authenticate(token string) (*User, error)
	CreateToken(userId int64) (*string, error)
	GetUser(email, password string) (*User, error)
	CreateUser(email, name, password string, avatarId *int64) error
}

type Task

type Task struct {
	ID          int64     `json:"id"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	CreatedAt   time.Time `json:"createdAt"`
	UpdatedAt   time.Time `json:"updatedAt"`
	Assignee    *User     `json:"assignee"`
	Status      string    `json:"status"`
}

type Token

type Token struct {
	UserID int64
	Expiry time.Time
	// contains filtered or unexported fields
}

type User

type User struct {
	ID           int64     `json:"id"`
	Email        string    `json:"email"`
	PasswordHash []byte    `json:"-"`
	Name         string    `json:"name"`
	CreatedAt    time.Time `json:"createdAt"`
	AvatarID     *int64    `json:"avatarId"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL