repository

package
v0.0.0-...-48705a9 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrHallNotFound = errors.New("hall not found")
)
View Source
var (
	ErrMovieNotFound = errors.New("movie not found")
)
View Source
var ErrRecordNotFound = mongo.ErrNoDocuments
View Source
var (
	ErrRepertoireNotFound = errors.New("repertoire not found")
)
View Source
var (
	ErrReservationNotFound = errors.New("reservation not found")
)

Functions

This section is empty.

Types

type AddReservationParams

type AddReservationParams struct {
	Username    string    `json:"username" binding:"required"`
	MovieID     string    `json:"movieId" binding:"required"`
	Date        time.Time `json:"date" binding:"required"`
	Time        string    `json:"time" binding:"required"`
	Hall        string    `json:"hall" binding:"required"`
	ReservSeats []string  `json:"reservSeats" binding:"required"`
}

TransferTxParams contains the input parameters of the transfer transaction

type MongoStore

type MongoStore struct {
	// contains filtered or unexported fields
}

func (*MongoStore) AddMovie

func (r *MongoStore) AddMovie(ctx context.Context, movie *models.Movie) (*models.Movie, error)

AddMovie adds a new movie to the MongoDB collection

func (*MongoStore) AddRepertoire

func (r *MongoStore) AddRepertoire(ctx context.Context, repertoire *models.Repertoire) (*models.Repertoire, error)

AddRepertoire adds a new repertoire to the MongoDB collection

func (*MongoStore) AddReservation

func (r *MongoStore) AddReservation(ctx context.Context, req AddReservationParams) (*models.Reservation, error)

func (*MongoStore) CancelReservation

func (r *MongoStore) CancelReservation(ctx context.Context, resId string) error

func (*MongoStore) DeleteHall

func (r *MongoStore) DeleteHall(ctx context.Context, id string) error

DeleteHall deletes a hall by ID from the MongoDB collection

func (*MongoStore) DeleteMovie

func (r *MongoStore) DeleteMovie(ctx context.Context, id string) error

DeleteMovie deletes a movie by ID from the MongoDB collection

func (*MongoStore) DeleteRepertoire

func (r *MongoStore) DeleteRepertoire(ctx context.Context, id string) error

DeleteRepertoire deletes a repertoire based on its ID

func (*MongoStore) DeleteRepertoireForMovie

func (r *MongoStore) DeleteRepertoireForMovie(ctx context.Context, movieId string) error

DeleteRepertoire deletes a repertoire based on its ID

func (*MongoStore) DeleteReservation

func (r *MongoStore) DeleteReservation(ctx context.Context, id string) error

DeleteReservation deletes a reservation based on its ID

func (*MongoStore) GetAllRepertoireForMovie

func (r *MongoStore) GetAllRepertoireForMovie(ctx context.Context, movieId string, startDate time.Time, endDate time.Time) ([]models.Repertoire, error)

GetRepertoire returns a repertoires based on its movieId

func (*MongoStore) GetAllReservationsForUser

func (r *MongoStore) GetAllReservationsForUser(ctx context.Context, username string) ([]models.Reservation, error)

GetReservation returns a all reservation based on username

func (*MongoStore) GetHall

func (r *MongoStore) GetHall(ctx context.Context, name string) ([]models.Hall, error)

GetHall returns a hall by Name from the MongoDB collection

func (*MongoStore) GetHallById

func (r *MongoStore) GetHallById(ctx context.Context, id string) (*models.Hall, error)

func (*MongoStore) GetMovie

func (r *MongoStore) GetMovie(ctx context.Context, id string) (*models.Movie, error)

GetMovie returns a movie by ID from the MongoDB collection

func (*MongoStore) GetRepertoire

func (r *MongoStore) GetRepertoire(ctx context.Context, id string) (*models.Repertoire, error)

GetRepertoire returns a repertoire based on its ID

func (*MongoStore) GetRepertoireByMovieDateTimeHall

func (r *MongoStore) GetRepertoireByMovieDateTimeHall(ctx context.Context, movieId string, dateValue time.Time, timeValue string, hallValue string) (models.Repertoire, error)

GetRepertoire returns a repertoire based on its ID

func (*MongoStore) GetReservationById

func (r *MongoStore) GetReservationById(ctx context.Context, id string) (*models.Reservation, error)

GetReservationById returns a reservations based on its ID

func (*MongoStore) GetUserByUsername

func (r *MongoStore) GetUserByUsername(ctx context.Context, username string) (*models.User, error)

Get returns a user by username

func (*MongoStore) InsertHall

func (r *MongoStore) InsertHall(ctx context.Context, hall *models.Hall) (*models.Hall, error)

AddHall adds a new hall to the MongoDB collection

func (*MongoStore) InsertReservation

func (r *MongoStore) InsertReservation(ctx context.Context, reservation *models.Reservation) (*models.Reservation, error)

AddReservation adds a new reservation to the MongoDB collection

func (*MongoStore) InsertUser

func (r *MongoStore) InsertUser(ctx context.Context, user *models.User) (*models.User, error)

AddHall adds a new hall to the MongoDB collection

func (*MongoStore) ListHalls

func (r *MongoStore) ListHalls(ctx context.Context) ([]models.Hall, error)

ListHalls returns all halls from the MongoDB collection

func (*MongoStore) ListMovies

func (r *MongoStore) ListMovies(ctx context.Context) ([]models.Movie, error)

ListMovies returns all movies from the MongoDB collection

func (*MongoStore) ListRepertoires

func (r *MongoStore) ListRepertoires(ctx context.Context) ([]models.Repertoire, error)

ListRepertoires returns all repertoires from the MongoDB collection

func (*MongoStore) SearchMovies

func (r *MongoStore) SearchMovies(ctx context.Context, movieId string) ([]models.Movie, error)

GetHall returns a hall by ID from the MongoDB collection

func (*MongoStore) UpdateHall

func (r *MongoStore) UpdateHall(ctx context.Context, id string, hall models.Hall) (models.Hall, error)

UpdateHall updates a hall by ID in the MongoDB collection

func (*MongoStore) UpdateMovie

func (r *MongoStore) UpdateMovie(ctx context.Context, id string, movie *models.Movie) (*models.Movie, error)

UpdateMovie updates a movie by ID in the MongoDB collection

func (*MongoStore) UpdateRepertoire

func (r *MongoStore) UpdateRepertoire(ctx context.Context, id string, repertoire models.Repertoire) (*models.Repertoire, error)

UpdateRepertoire updates a repertoire based on its ID

type Store

type Store interface {
	GetUserByUsername(ctx context.Context, username string) (*models.User, error)
	InsertUser(ctx context.Context, user *models.User) (*models.User, error)

	InsertHall(ctx context.Context, hall *models.Hall) (*models.Hall, error)
	ListHalls(ctx context.Context) ([]models.Hall, error)
	GetHall(ctx context.Context, name string) ([]models.Hall, error)
	GetHallById(ctx context.Context, id string) (*models.Hall, error)
	UpdateHall(ctx context.Context, id string, hall models.Hall) (models.Hall, error)
	DeleteHall(ctx context.Context, id string) error

	AddMovie(ctx context.Context, movie *models.Movie) (*models.Movie, error)
	ListMovies(ctx context.Context) ([]models.Movie, error)
	GetMovie(ctx context.Context, id string) (*models.Movie, error)
	UpdateMovie(ctx context.Context, id string, movie *models.Movie) (*models.Movie, error)
	DeleteMovie(ctx context.Context, id string) error
	SearchMovies(ctx context.Context, movieId string) ([]models.Movie, error)

	AddRepertoire(ctx context.Context, repertoire *models.Repertoire) (*models.Repertoire, error)
	ListRepertoires(ctx context.Context) ([]models.Repertoire, error)
	GetRepertoire(ctx context.Context, id string) (*models.Repertoire, error)
	GetRepertoireByMovieDateTimeHall(ctx context.Context, movieId string, dateValue time.Time, timeValue string, hallValue string) (models.Repertoire, error)
	GetAllRepertoireForMovie(ctx context.Context, movieId string, startDate time.Time, endDate time.Time) ([]models.Repertoire, error)
	UpdateRepertoire(ctx context.Context, id string, repertoire models.Repertoire) (*models.Repertoire, error)
	DeleteRepertoire(ctx context.Context, id string) error
	DeleteRepertoireForMovie(ctx context.Context, movieId string) error

	InsertReservation(ctx context.Context, reservation *models.Reservation) (*models.Reservation, error)
	GetReservationById(ctx context.Context, id string) (*models.Reservation, error)
	GetAllReservationsForUser(ctx context.Context, username string) ([]models.Reservation, error)
	DeleteReservation(ctx context.Context, id string) error

	AddReservation(ctx context.Context, req AddReservationParams) (*models.Reservation, error)
	CancelReservation(ctx context.Context, resId string) error
}

func NewStore

func NewStore(client *mongo.Client, dbName string) Store

Jump to

Keyboard shortcuts

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