repository

package
v0.0.0-...-5e5f065 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: ISC Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInsufficientArkhoins     = errors.New("insufficient arkhoins")
	ErrComponentNotFound        = errors.New("component not found or trashed")
	ErrComponentNotTrashed      = errors.New("component is not trashed")
	ErrComponentAlreadyTrashed  = errors.New("component is already trashed")
	ErrComponentNotPublic       = errors.New("component is not public")
	ErrComponentAlreadyPublic   = errors.New("component is already public")
	ErrComponentNotOwned        = errors.New("component is not owned")
	ErrComponentAlreadyOwned    = errors.New("component is already owned")
	ErrComponentOwnerCannotBuy  = errors.New("component owner cannot buy their own component")
	ErrComponentOwnerCannotSell = errors.New("component owner cannot sell their own component")
)
View Source
var (
	ErrNotificationAlreadyRead = errors.New("notification already marked as read")
	ErrNotificationNotRead     = errors.New("notification is not marked as read")
	ErrNotificationNotAssigned = errors.New("notification not assigned to user")
)
View Source
var (
	ErrProjectTrashed          = errors.New("project is trashed")
	ErrProjectNotTrashed       = errors.New("project is not trashed")
	ErrProjectAlreadyTrashed   = errors.New("project is already trashed")
	ErrProjectAlreadyFavorited = errors.New("project is already favorited by the user")
	ErrProjectNotFavorited     = errors.New("cannot unfavorite a project that is not favorited")
	ErrProjectIsNotAFork       = errors.New("project is not a fork")
	ErrUpstreamNotPublic       = errors.New("cannot publish this project because the upstream project is not public")
	ErrCannotAssignOwner       = errors.New("cannot assign owner")
	ErrUserNotAssigned         = errors.New("user is not assigned to the project")
)

Functions

This section is empty.

Types

type APIKeyRepository

type APIKeyRepository interface {
	Create(createModel *model.APIKey) error
	Update(key string, updateModel *model.APIKey) error
	Delete(key string) error

	GetAll(page, perPage int) (*dto.Pagination[dto.ReadAPIKey], error)
	GetByKey(key string) (*dto.ReadAPIKey, error)
	GetByOwner(owner string, page, perPage int) (*dto.Pagination[dto.ReadAPIKey], error)

	RegisterUse(key string) error
	Regenerate(oldKey, newKey string) error
}

func NewAPIKeyRepository

func NewAPIKeyRepository() APIKeyRepository

type ComponentRepository

type ComponentRepository interface {
	Create(createModel *dto.ComponentCreation) error
	Update(componentID uint, updateModel *dto.ComponentUpdate) error

	Get(issuerID uint, componentModel *model.Component) (*dto.ComponentInfo, error)
	GetPublic(issuerID uint, page, perPage int, freeOnly bool) (*dto.Pagination[dto.ComponentInfo], error)
	GetOwned(issuerID, userID uint, onlyPublic bool, page, perPage int) (*dto.Pagination[dto.ComponentInfo], error)
	GetByOwnerID(issuerID, ownerID uint, onlyPublic bool, page, perPage int) (*dto.Pagination[dto.ComponentInfo], error)
	GetHoldersByID(issuerID, userID uint, page, perPage int) (*dto.Pagination[dto.ComponentInfo], error)
	GetTrashed(ownerID uint, page, perPage int) (*dto.Pagination[dto.ComponentInfo], error)

	Search(issuerID uint, search *dto.SearchComponent, page, perPage int) (*dto.Pagination[dto.ComponentInfo], error)

	Buy(issuerID, componentID uint) error
	Sell(issuerID, componentID uint) error

	SafeDelete(componentID uint) error
	Restore(componentID uint) error
	UnsafeDelete(componentID uint) error
	ClearTrash(userID uint) error
}

func NewComponentRepository

func NewComponentRepository(userRepo UserRepository) ComponentRepository

type FollowRepository

type FollowRepository interface {
	Exists(followingID, followerID uint) (bool, error)

	Follow(followingID, followerID uint) error
	Unfollow(followingID, followerID uint) error

	GetFollowers(userID uint, page, perPage int) (*dto.Pagination[dto.Follower], error)
	GetFollowing(userID uint, page, perPage int) (*dto.Pagination[dto.Follower], error)
	GetFollowersCount(userID uint) (int64, error)
	GetFollowingCount(userID uint) (int64, error)
}

func NewFollowRepository

func NewFollowRepository() FollowRepository

type NotificationRepository

type NotificationRepository interface {
	Create(createModel dto.CreateNotification) (uint, error)

	GetForUser(userID uint, onlyUnread bool, page, perPage int) (*dto.Pagination[dto.NotificationInfo], error)
	GetUnreadCount(userID uint) (int64, error)

	SendToAll(notificationID uint) error
	SendToIDs(notificationID uint, usersID []uint) error

	UnsendToAll(notificationID uint) error
	UnsendToIDs(notificationID uint, usersID []uint) error

	MarkAsRead(issuer dto.UserProfile, notificationID uint) error
	MarkAsUnread(issuer dto.UserProfile, notificationID uint) error
}

func NewNotificationRepository

func NewNotificationRepository() NotificationRepository

type PasswordResetRepository

type PasswordResetRepository interface {
	Request(email string) (*model.PasswordResetKey, error)
	Reset(key, newPassword string) error
	IsKeyValid(key string) (*dto.PasswordResetInfo, bool, error)
}

func NewPasswordResetRepository

func NewPasswordResetRepository() PasswordResetRepository

type PermissionRepository

type PermissionRepository interface {
	GetByUser(userID uint) ([]*model.Permission, error)
}

func NewPermissionRepository

func NewPermissionRepository() PermissionRepository

type ProjectRepository

type ProjectRepository interface {
	Create(createModel *dto.ProjectCreation) (uint, error)
	Update(projectID uint, updateModel *dto.ProjectUpdate) error
	Unlink(projectID uint) error

	Assign(userID uint, projectID uint, allowList *dto.ProjectAssign) error

	Get(issuerID uint, projectModel *model.Project) (*dto.ProjectInfo, error)
	GetByOwner(issuerID, userID uint, onlyPublic bool, page, perPage int) (*dto.Pagination[dto.ProjectInfo], error)
	GetPublic(issuerID uint, page, perPage int) (*dto.Pagination[dto.ProjectInfo], error)
	GetFavorited(issuerID, userID uint, onlyPublic bool, page, perPage int) (*dto.Pagination[dto.ProjectInfo], error)
	GetTrashed(ownerID uint, page, perPage int) (*dto.Pagination[dto.ProjectInfo], error)

	Search(issuerID uint, options *dto.SearchProject, page, perPage int) (*dto.Pagination[dto.ProjectInfo], error)

	GetContent(projectID uint) (any, error)
	SaveContent(projectID uint, content any) error

	Favorite(projectID, userID uint) error
	Unfavorite(projectID, userID uint) error

	SafeDelete(projectID uint) error
	Restore(projectID uint) error
	UnsafeDelete(projectID uint) error
	ClearTrash(userID uint) error
}

func NewProjectRepository

func NewProjectRepository(userRepo UserRepository) ProjectRepository

type UserRepository

type UserRepository interface {
	Create(*model.User) error

	Update(uint, *dto.UserUpdate) error

	UnsafeGet(*model.User) (*model.User, error)
	Get(*model.User) (*dto.UserProfile, error)

	Search(issuerID uint, search *dto.SearchUser, page, perpage int) (*dto.Pagination[dto.UserProfile], error)

	Delete(uint) error
}

func NewUserRepository

func NewUserRepository() UserRepository

Jump to

Keyboard shortcuts

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