nodes

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorInvalidAuthorizationToken = ErrorResponse{Code: 100, Message: "invalid authorization token", Status: 403}
	ErrorUserNotAuthorized         = ErrorResponse{Code: 101, Message: "you are not authorized to perform this action", Status: 403}
	ErrorInvalidOAuthCode          = ErrorResponse{Code: 102, Message: "invalid oauth code", Status: 400}
	ErrorUserNotFound              = ErrorResponse{Code: 103, Message: "user not found", Status: 404}
	ErrorUserBanned                = ErrorResponse{Code: 104, Message: "user banned", Status: 403}

	ErrorModNotFound     = ErrorResponse{Code: 200, Message: "mod not found", Status: 404}
	ErrorFailedModUpload = ErrorResponse{Code: 201, Message: "failed to upload mod", Status: 500}

	ErrorVersionNotFound = ErrorResponse{Code: 300, Message: "version not found", Status: 404}
)

Functions

func RegisterModRoutes

func RegisterModRoutes(router *echo.Group)

func RegisterModsRoutes

func RegisterModsRoutes(router *echo.Group)

func RegisterOAuthRoutes

func RegisterOAuthRoutes(router *echo.Group)

func RegisterSMLRoutes

func RegisterSMLRoutes(router *echo.Group)

func RegisterUserRoutes

func RegisterUserRoutes(router *echo.Group)

func RegisterUsersRoutes

func RegisterUsersRoutes(router *echo.Group)

func RegisterVersionRoutes

func RegisterVersionRoutes(router *echo.Group)

Types

type AuthorizedDataFunction

type AuthorizedDataFunction func(user *postgres.User, c echo.Context) (data interface{}, err *ErrorResponse)

type DataFunction

type DataFunction func(c echo.Context) (data interface{}, err *ErrorResponse)

type ErrorResponse

type ErrorResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Status  int    `json:"-"`
}

func GenericUserError

func GenericUserError(err error) *ErrorResponse

type GenericResponse

type GenericResponse struct {
	Success bool        `json:"success"`
	Data    interface{} `json:"data,omitempty"`
	Error   interface{} `json:"error,omitempty"`
}

type Mod

type Mod struct {
	ID               string    `json:"id"`
	Name             string    `json:"name"`
	ShortDescription string    `json:"short_description"`
	FullDescription  string    `json:"full_description"`
	SourceURL        string    `json:"source_url"`
	CreatorID        string    `json:"creator_id"`
	Approved         bool      `json:"approved"`
	Views            uint      `json:"views"`
	Downloads        uint      `json:"downloads"`
	Hotness          uint      `json:"hotness"`
	Popularity       uint      `json:"popularity"`
	UpdatedAt        time.Time `json:"updated_at"`
	CreatedAt        time.Time `json:"created_at"`
}

func ModToMod

func ModToMod(mod *postgres.Mod, short bool) *Mod

type ModUser

type ModUser struct {
	UserID string `json:"user_id"`
	Role   string `json:"role"`
}

func ModUserToModUser

func ModUserToModUser(userMod *postgres.UserMod) *ModUser

type PublicUser

type PublicUser struct {
	ID        string    `json:"id"`
	Username  string    `json:"username"`
	Avatar    string    `json:"avatar"`
	CreatedAt time.Time `json:"created_at"`
}

func UserToPublicUser

func UserToPublicUser(user *postgres.User) *PublicUser

type SMLVersion

type SMLVersion struct {
	ID                  string    `json:"id"`
	Version             string    `json:"version"`
	SatisfactoryVersion int       `json:"satisfactory_version"`
	BootstrapVersion    *string   `json:"bootstrap_version"`
	Stability           string    `json:"stability"`
	Date                time.Time `json:"date"`
	Link                string    `json:"link"`
	Changelog           string    `json:"changelog"`
	UpdatedAt           time.Time `json:"updated_at"`
	CreatedAt           time.Time `json:"created_at"`
}

func SMLVersionToSMLVersion

func SMLVersionToSMLVersion(version *postgres.SMLVersion) *SMLVersion

type User

type User struct {
	ID        string    `json:"id"`
	Email     string    `json:"email"`
	Username  string    `json:"username"`
	Avatar    string    `json:"avatar"`
	CreatedAt time.Time `json:"created_at"`
}

func UserToPrivateUser

func UserToPrivateUser(user *postgres.User) *User

type UserMod

type UserMod struct {
	ModID string `json:"mod_id"`
	Role  string `json:"role"`
}

func UserModToUserMod

func UserModToUserMod(mod *postgres.UserMod) *UserMod

type UserSession

type UserSession struct {
	Token string `json:"token"`
}

func SessionToSession

func SessionToSession(session *postgres.UserSession) *UserSession

type Version

type Version struct {
	ID         string    `json:"id"`
	Version    string    `json:"version"`
	SMLVersion string    `json:"sml_version"`
	Changelog  string    `json:"changelog"`
	Downloads  uint      `json:"downloads"`
	Stability  string    `json:"stability"`
	ModID      string    `json:"mod_id"`
	Approved   bool      `json:"approved"`
	UpdatedAt  time.Time `json:"updated_at"`
	CreatedAt  time.Time `json:"created_at"`
}

func VersionToVersion

func VersionToVersion(version *postgres.Version) *Version

Jump to

Keyboard shortcuts

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