service

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Anime

type Anime struct {
	ID                int64            `json:"id"`
	Title             string           `json:"title"`
	AlternativeTitles alternativeTitle `json:"alternative_titles"`
	Picture           string           `json:"picture"`
	StartDate         date             `json:"start_date"`
	EndDate           date             `json:"end_date"`
	Synopsis          string           `json:"synopsis"`
	Background        string           `json:"background"`
	NSFW              bool             `json:"nsfw"`
	Type              entity.Type      `json:"type" swaggertype:"string"`
	Status            entity.Status    `json:"status" swaggertype:"string"`
	Episode           episode          `json:"episode"`
	Season            *season          `json:"season"`
	Broadcast         *broadcast       `json:"broadcast"`
	Source            entity.Source    `json:"source" swaggertype:"string"`
	Rating            entity.Rating    `json:"rating" swaggertype:"string"`
	Mean              float64          `json:"mean"`
	Rank              int              `json:"rank"`
	Popularity        int              `json:"popularity"`
	Member            int              `json:"member"`
	Voter             int              `json:"voter"`
	Stats             stats            `json:"stats"`
	Genres            []genre          `json:"genres"`
	Pictures          []string         `json:"pictures"`
	Related           []related        `json:"related"`
	Studios           []studio         `json:"studio"`
	UpdatedAt         time.Time        `json:"updated_at"`
}

Anime is anime model.

type GetUserAnimeRequest added in v0.2.0

type GetUserAnimeRequest struct {
	Username string `validate:"required" mod:"trim,lcase"`
	Page     int    `validate:"required,gte=1" mod:"default=1"`
	Limit    int    `validate:"required,gte=-1" mod:"default=20"`
}

GetUserAnimeRequest is get user anime request model.

type Pagination added in v0.2.0

type Pagination struct {
	Page  int `json:"page"`
	Limit int `json:"limit"`
	Total int `json:"total"`
}

Pagination is pagination model.

type Service

type Service interface {
	GetAnimeByID(ctx context.Context, id int64) (*Anime, int, error)
	UpdateAnimeByID(ctx context.Context, id int64) (int, error)

	GetUserAnime(ctx context.Context, data GetUserAnimeRequest) ([]UserAnime, *Pagination, int, error)
	GetUserAnimeRelations(ctx context.Context, username string) (*UserAnimeRelation, int, error)
	UpdateUserAnime(ctx context.Context, username string) (int, error)

	ConsumeMessage(ctx context.Context, msg entity.Message) error

	QueueOldReleasingAnime(ctx context.Context, limit int) (int, int, error)
	QueueOldFinishedAnime(ctx context.Context, limit int) (int, int, error)
	QueueOldNotYetAnime(ctx context.Context, limit int) (int, int, error)
	QueueMissingAnime(ctx context.Context, limit int) (int, int, error)
	QueueOldUserAnime(ctx context.Context, limit int) (int, int, error)
}

Service contains functions for service.

type UserAnime added in v0.2.0

type UserAnime struct {
	AnimeID   int64         `json:"anime_id"`
	Status    entity.Status `json:"status" swaggertype:"string"`
	Score     int           `json:"score"`
	Episode   int           `json:"episode"`
	Tags      []string      `json:"tags"`
	Comment   string        `json:"comment"`
	UpdatedAt time.Time     `json:"updated_at"`
}

UserAnime is user anime model.

type UserAnimeRelation added in v0.3.0

type UserAnimeRelation struct {
	Nodes []userAnimeRelationNode `json:"nodes"`
	Links []userAnimeRelationLink `json:"links"`
}

UserAnimeRelation is user anime relation model.

Jump to

Keyboard shortcuts

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