models

package
v0.0.0-...-f94e68e Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthResponse

type AuthResponse struct {
	*User
	AccessToken  string `json:"access_token" example:"eyJhbGciOiJIUzI1NiIs.eyJzdWIilIn0.iTNuOHMObmeRmKU"` // JWT Access Token used to access protected resources.
	RefreshToken string `json:"refresh_token" example:"eyJhbGciOI6IkpXVCJ9.eyJzdk5EbifQ.4CfEaMw6Ur_fszI"` // JWT Refresh Token used to obtain a new Access Token when it expires.
}

AuthResponse represents the response returned upon successful authentication.

type Collection

type Collection struct {
	ID          int       `json:"id" example:"1"`      // Unique identifier for the collection.
	UserID      int       `json:"user_id" example:"1"` // Identifier of the user who created the collection.
	IsFavorite  bool      `json:"is_favorite" example:"false"`
	Name        string    `json:"name" validate:"required,min=3,max=100" example:"My collection"`                   // Name of the collection; required, between 3 and 100 characters.
	Description string    `json:"description,omitempty" validate:"omitempty,max=500" example:"This is description"` // Description of the collection; optional, up to 500 characters.
	TotalFilms  int       `json:"total_films" example:"5"`                                                          // Total number of films in the collection.
	CreatedAt   time.Time `json:"created_at" example:"2024-09-04T13:37:24.87653+05:00"`                             // Timestamp when the collection was created.
	UpdatedAt   time.Time `json:"updated_at" example:"2024-09-04T13:37:24.87653+05:00"`                             // Timestamp when the collection was last updated.
}

Collection represents a collection of films created by a user.

type CollectionFilm

type CollectionFilm struct {
	Collection Collection `json:"collection"`                                           // Identifier of the collection.
	Film       Film       `json:"film"`                                                 // Identifier of the film.
	AddedAt    time.Time  `json:"added_at" example:"2024-09-04T13:37:24.87653+05:00"`   // Timestamp when the film was added to the collection.
	UpdatedAt  time.Time  `json:"updated_at" example:"2024-09-04T13:37:24.87653+05:00"` // Timestamp when the association was last updated.
}

CollectionFilm represents the association between a film and a collection.

type CollectionFilms

type CollectionFilms struct {
	Collection Collection `json:"collection"` // Identifier of the collection.
	Films      []Film     `json:"films"`      // Identifier of the film.
}

CollectionFilms represents the association between a film and a collection.

type Credentials

type Credentials struct {
	TelegramID int    `json:"telegram_id,omitempty"`
	Username   string `json:"username" validate:"required,username,min=3,max=20" example:"john_doe"`                   // Username of the user; must be unique and valid.
	Email      string `json:"email,omitempty" validate:"omitempty,email,min=6,max=254" example:"john_doe@example.com"` // Email address of the user; must be a valid email format.
	Password   string `json:"password,omitempty" validate:"required,password,min=8,max=128" swaggerignore:"true"`      // Password for the user account; omitted in responses for security.
}

Credentials represents the information required for user registration and authentication.

type Film

type Film struct {
	ID          int       `json:"id"  example:"1"`     // Unique identifier for the film.
	UserID      int       `json:"user_id" example:"1"` // Identifier of the user who added the film.
	IsFavorite  bool      `json:"is_favorite" example:"false"`
	Title       string    `json:"title" validate:"required,min=3,max=100" example:"My film"`                           // Title of the film; required, between 3 and 100 characters.
	Year        int       `json:"year,omitempty" validate:"omitempty,gte=1888,lte=2100" example:"2001"`                // Release year of the film; optional, must be between 1888 and 2100.
	Genre       string    `json:"genre,omitempty" validate:"omitempty,max=100" example:"Horror"`                       // Genre of the film; optional.
	Description string    `json:"description,omitempty" validate:"omitempty,max=1000" example:"This is description"`   // Description of the film; optional, up to 1000 characters.
	Rating      float64   `json:"rating,omitempty" validate:"omitempty,gte=1,lte=10" example:"6.7"`                    // Rating of the film; optional, must be between 1 and 10.
	ImageURL    string    `json:"image_url,omitempty" validate:"omitempty,url" example:"https://placeimg.com/640/480"` // URL of the film's image; optional, must be a valid URL.
	Comment     string    `json:"comment,omitempty" validate:"omitempty,max=500" example:"This is comment"`            // User's comment of the film; optional, up to 500 characters.
	IsViewed    bool      `json:"is_viewed" example:"true"`                                                            // Indicates if the user has viewed the film.
	UserRating  float64   `json:"user_rating,omitempty" validate:"omitempty,gte=1,lte=10" example:"5.5"`               // User's rating of the film; optional, between 1 and 10.
	Review      string    `json:"review,omitempty" validate:"omitempty,max=500" example:"This is review"`              // User's review of the film; optional, up to 500 characters.
	URL         string    `json:"url,omitempty" validate:"omitempty,url" example:"https://www.imdb.com/video"`         // URL for additional film information (e.g., IMDb or trailer); optional, must be valid.
	CreatedAt   time.Time `json:"created_at" example:"2024-09-04T13:37:24.87653+05:00"`                                // Timestamp when the film was added.
	UpdatedAt   time.Time `json:"updated_at" example:"2024-09-04T13:37:24.87653+05:00"`                                // Timestamp when the film details were last updated.
}

Film represents a film with its details and user-specific attributes.

type FilmsQueryInput

type FilmsQueryInput struct {
	filters.Filters
	Title             string
	ExcludeCollection int
	Rating            string
	Year              string
	IsViewed          *bool
	UserRating        string
	HasURL            *bool
	IsFavorite        *bool
}

FilmsQueryInput holds the parameters for querying films, including title, rating range, and filter options.

type JWTClaims

type JWTClaims struct {
	Sub string `json:"sub"`
	jwt.StandardClaims
}

JWTClaims defines the structure of JWT claims for user authentication by credentials.

type User

type User struct {
	ID         int       `json:"id" example:"1"` // Unique identifier for the user.
	TelegramID int       `json:"telegram_id,omitempty" example:"123456789"`
	Username   string    `json:"username,omitempty" validate:"omitempty,username,min=3,max=20" example:"john_doe"`        // Username of the user; must be unique and valid.
	Email      string    `json:"email,omitempty" validate:"omitempty,email,min=6,max=254" example:"john_doe@example.com"` // Email address of the user; must be a valid email format.
	Password   string    `json:"password,omitempty" swaggerignore:"true"`                                                 // Password for the user account; omitted in responses for security.
	CreatedAt  time.Time `json:"created_at" example:"2024-09-04T13:37:24.87653+05:00"`                                    // Timestamp when the user was created.
	Version    int       `json:"-"`                                                                                       // Internal version tracking; not included in JSON responses.
}

User represents the user data stored in the system.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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