bbrecs

package
v0.0.0-...-e752ecf Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseRec

type BaseRec struct {
	ID    uuid.UUID `json:"id"`
	Title string    `json:"title"`
	// Tags enum #allow user creation?
	Author      User    `json:"author"`
	Description string  `json:"description"`
	UserPhotos  []Photo `json:"userPhotos"`
}

type Comment

type Comment struct {
	ID        uuid.UUID `json:"id"`
	User      User      `json:"user"`
	Content   string    `json:"content"`
	CreatedAt time.Time `json:"createdAt"`
	UpdatedAt time.Time `json:"updatedAt"`
}

type Group

type Group struct {
	ID        uuid.UUID `json:"id"`
	Name      string    `json:"name"`
	CreatedAt time.Time `json:"createdAt" db:"created_at"`
	UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
}
type GroupInviteLink struct {
	Code      string    `json:"code"`
	ExpiresAt time.Time `json:"expiresAt" db:"expires_at"`
	User      User
	Group     Group
}

type GroupService

type GroupService interface {
	CreateGroup(c context.Context, name string) (*Group, error)
}

type GroupUserService

type GroupUserService interface {
	GetGroupUsers(c context.Context, GroupID uuid.UUID) ([]*User, error)
	AddUserToGroup(c context.Context, GroupID uuid.UUID, UserID uuid.UUID) error
	RemoveUserFromGroup(c context.Context, GroupID uuid.UUID, UserID uuid.UUID) error
}

type NewUserFields

type NewUserFields struct {
	FirstName   string `json:"firstName" db:"first_name"`
	LastName    string `json:"lastName" db:"last_name"`
	PhoneNumber string `json:"phoneNumber" db:"phone_number"`
}

type Photo

type Photo struct {
	ID   uuid.UUID `json:"id"`
	Data []byte    `json:"data"`
	// DefaultQuality = 75
	Options jpeg.Options
}

type User

type User struct {
	ID uuid.UUID `json:"id"`
	NewUserFields
	CreatedAt time.Time `json:"createdAt" db:"created_at"`
	UpdatedAt time.Time `json:"updatedAt" db:"updated_at"`
}

func GenerateUser

func GenerateUser(userData NewUserFields) (*User, error)

type UserService

type UserService interface {
	CreateUser(c context.Context, user *User) (*User, error)
	GetUserByID(c context.Context, userID uuid.UUID) (*User, error)
	GetUsers(c context.Context) ([]*User, error)
	GetUserGroups(c context.Context, userID uuid.UUID) ([]Group, error)
	UpdateUser(c context.Context, userID uuid.UUID, fields UserUpdateFields) (*User, error)
}

type UserUpdateFields

type UserUpdateFields struct {
	NewUserFields
}

Jump to

Keyboard shortcuts

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