services

package
v0.0.0-...-b5d40b6 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TIME_OVERLAP_ERROR = "time overlap between the show Start and End Time"
	INVALID_UUID_ERROR = "%s should have a valid UUID"
)
View Source
const (
	EmailRegex       = "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]+)*$"
	PhoneNumberRegex = "\\+[1-9]{1}[0-9]{0,2}-[2-9]{1}[0-9]{2}-[2-9]{1}[0-9]{2}-[0-9]{4}$"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CinemaHallDTO

type CinemaHallDTO struct {
	CinemaId     string
	CinemaHallId string
	TotalSeat    int
}

type CinemaHallModel

type CinemaHallModel struct {
	Name        string            `json:"name"`
	TotalSeat   int               `json:"totalSeat"`
	CinemaSeats []CinemaSeatModel `json:"cinemaSeats"`
}

type CinemaHallRequest

type CinemaHallRequest struct {
	Id    string            `param:"Id"`
	Halls []CinemaHallModel `json:"halls"`
}

type CinemaHallResponse

type CinemaHallResponse struct {
	CinemaId string `json:"CinemaId"`
}

type CinemaSeatDTO

type CinemaSeatDTO struct {
	CinemaHallId string
	SeatNumber   int
}

type CinemaSeatModel

type CinemaSeatModel struct {
	SeatNumber int            `json:"seatNumber"`
	Type       enums.SeatType `json:"type"`
}

type CinemaService

type CinemaService struct {
	DB *gorm.DB
}

func (CinemaService) AddCinemaHall

func (cinemaService CinemaService) AddCinemaHall(request CinemaHallRequest) (CinemaHallResponse, []error)

func (CinemaService) AddCinemaSeat

func (cinemaService CinemaService) AddCinemaSeat(request CreateCinemaSeatRequest) (CreateCinemaSeatResponse, []error)

func (CinemaService) CreateCinema

func (cinemaService CinemaService) CreateCinema(request CreateCinemaRequest) CreateCinemaResponse

type CityModelResponse

type CityModelResponse struct {
	Id           string `json:"id"`
	Name         string `json:"name"`
	State        string `json:"state"`
	IsDeprecated bool   `json:"isDeprecated"`
}

type CityService

type CityService struct {
	DB *gorm.DB
}

func (CityService) GetCityById

func (cityService CityService) GetCityById(request GetCityByIdRequest) (GetCityByIdResponse, error)

type CreateCinemaRequest

type CreateCinemaRequest struct {
	Name              string            `json:"name"`
	CityId            string            `json:"cityId"`
	TotalCinemalHalls int               `json:"totalCinemalHalls"`
	Address           string            `json:"address"`
	Longitude         float32           `json:"longitude"`
	Latitude          float32           `json:"latitude"`
	Halls             []CinemaHallModel `json:"halls"`
}

type CreateCinemaResponse

type CreateCinemaResponse struct {
	CinemaId   string `json:"CinemaId"`
	Errors     []error
	StatusCode int
}

type CreateCinemaSeatRequest

type CreateCinemaSeatRequest struct {
	Id           string            `param:"Id"`
	CinemaHallId string            `param:"cinemaHallId"`
	Seats        []CinemaSeatModel `json:"cinemaSeats"`
}

type CreateCinemaSeatResponse

type CreateCinemaSeatResponse struct {
	StatusCode int
}

type CreateShowRequest

type CreateShowRequest struct {
	ShowTimes    []ShowDateTime `json:"showTimes"`
	CinemaHallId string         `json:"cinemaHallId"`
	MovieId      string         `json:"movieId"`
}

type CreateShowResponse

type CreateShowResponse struct {
	ShowIds    []string `json:"showIds"`
	StatusCode int
}

type CreateUserRequest

type CreateUserRequest struct {
	FirstName   string  `json:"firstName"`
	LastName    string  `json:"lastName"`
	Email       string  `json:"email"`
	Password    string  `json:"password"`
	PhoneNumber string  `json:"phoneNumber"`
	CityId      string  `json:"cityId"`
	Address     string  `json:"address"`
	Longitude   float32 `json:"longitude"`
	Latitude    float32 `json:"latitude"`
}

type CreateUserResponse

type CreateUserResponse struct {
	UserId     string  `json:"userId"`
	Errors     []error `json:"errors"`
	StatusCode int     `json:"statusCode"`
}

type GetCityByIdRequest

type GetCityByIdRequest struct {
	Id string `param:"id"`
}

type GetCityByIdResponse

type GetCityByIdResponse struct {
	City       CityModelResponse
	StatusCode int
}

type GetMovieByIdRequest

type GetMovieByIdRequest struct {
	Id string `param:"id" validate:"required"`
}

type GetMovieByIdResponse

type GetMovieByIdResponse struct {
	StatusCode int
	Movie      MovieDataResponse `json:"movie"`
}

type GetMoviesRequest

type GetMoviesRequest struct {
	Page       int    `query:"page"`
	PageLength int    `query:"pageLength"`
	SortBy     string `query:"sortBy"`
	Order      string `query:"order"`
}

type GetMoviesResponse

type GetMoviesResponse struct {
	Page                int                 `json:"page"`
	PerPage             int                 `json:"perPage"`
	TotalResults        int64               `json:"totalResults"`
	RequestedPageLength int                 `json:"requestedPageLength"`
	Movies              []MovieDataResponse `json:"movies"`
}

type GetSearchRequest

type GetSearchRequest struct {
	Term string `query:"term"`
}

type GetSearchResponse

type GetSearchResponse struct {
	StatusCode int
	Result     []MovieDataResponse `json:"results"`
}

type GetShowsByLocationRequest

type GetShowsByLocationRequest struct {
	UserId string `json:"userId"`
}

type GetShowsByLocationResponse

type GetShowsByLocationResponse struct {
	Results    []ShowsDTO
	StatusCode int
}

type MovieDataResponse

type MovieDataResponse struct {
	Id          string    `json:"id"`
	Title       string    `json:"title"`
	Description string    `json:"description"`
	Language    string    `json:"language"`
	ReleaseDate time.Time `json:"releaseDate"`
	Genre       int       `json:"genre"`
	Popularity  float32   `json:"popularity"`
	VoteCount   int       `json:"voteCount"`
}

type MovieService

type MovieService struct {
	DB *gorm.DB
}

func (MovieService) GetMovieById

func (movieService MovieService) GetMovieById(request GetMovieByIdRequest) (GetMovieByIdResponse, error)

func (MovieService) GetMovies

func (movieService MovieService) GetMovies(request GetMoviesRequest) (GetMoviesResponse, error)

func (MovieService) SearchMovie

func (movieService MovieService) SearchMovie(request GetSearchRequest) (GetSearchResponse, error)

type ShowDateTime

type ShowDateTime struct {
	StartDateTime time.Time `json:"startDate"`
	EndDateTime   time.Time `json:"endDate"`
}

type ShowService

type ShowService struct {
	DB *gorm.DB
}

func (ShowService) CreateShow

func (showService ShowService) CreateShow(request CreateShowRequest) (CreateShowResponse, []error)

func (ShowService) GetShowsByUserLocation

func (showService ShowService) GetShowsByUserLocation(request GetShowsByLocationRequest) (GetShowsByLocationResponse, error)

type ShowsDTO

type ShowsDTO struct {
	ShowId string    `json:"showId"`
	Date   time.Time `json:"showDate"`

	MovieId     string              `json:"movieId"`
	Title       string              `json:"movieTitle"`
	Description string              `json:"movieDescription"`
	Language    string              `json:"language"`
	Genre       int                 `json:"genre"`
	StartTime   time.Time           `json:"showStartTime"`
	EndTime     time.Time           `json:"showEndTime"`
	AddressLine string              `json:"address"`
	Coordinates entities.Coordinate `json:"coordinates"`
	Distance    float64             `json:"distance"`
	// contains filtered or unexported fields
}

type UserDTO

type UserDTO struct {
	UserId       string
	IsDeprecated bool
	Coordinates  entities.Coordinate
	CityId       string
}

type UserService

type UserService struct {
	DB *gorm.DB
}

func (UserService) CreateUser

func (userService UserService) CreateUser(request CreateUserRequest) CreateUserResponse

Jump to

Keyboard shortcuts

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