handlers

package
v0.0.0-...-bf31d15 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPHandler

type HTTPHandler struct {
	Api       *app.Api
	Teams     *app.TeamService
	TextTask  *app.TextTaskService
	MediaTask *app.MediaTaskService
	Users     *app.UserService
	Secs      *app.SECService
}

func NewHTTPHandler

func NewHTTPHandler(api *app.Api, teams *app.TeamService, textTask *app.TextTaskService, mediaTask *app.MediaTaskService, user *app.UserService, sec *app.SECService) *HTTPHandler

func (*HTTPHandler) AddUserInTeam

func (h *HTTPHandler) AddUserInTeam(w http.ResponseWriter, r *http.Request)

AddUserInTeam @Summary AddUserInTeam @Description Capitan of team can add user in his team @Tags team @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param request.AddMemberToTeam body request.AddMemberToTeam true "Invite to team" @Success 200 {string} string "ok" @Failure 401 {string} string "not authorized" @Failure 403 {string} string "not rights" @Failure 500 {string} string "internal server error" @Router /team/member [post]

func (*HTTPHandler) CreateRegisterOnMasterClass

func (h *HTTPHandler) CreateRegisterOnMasterClass(w http.ResponseWriter, r *http.Request)

CreateRegisterOnMasterClass @Summary CreateRegisterOnMasterClass @Description @Tags sec @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param id path string true "master class ID" @Success 200 {string} string "ok" @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 403 {string} string "not rights" @Failure 404 {string} string "not found" @Failure 409 {string} string "conflict" @Failure 423 {string} string "locked" @Failure 500 {string} string "internal server error" @Router /sec/master_class/{id} [post]

func (*HTTPHandler) CreateTeam

func (h *HTTPHandler) CreateTeam(w http.ResponseWriter, r *http.Request)

CreateTeam @Summary CreateTeam @Description User creates team and stay captain of team @Tags team @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param request.CreateTeam body request.CreateTeam true "Add team" @Success 201 {object} response.CreateTeam @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 409 {string} string "user exists" @Failure 500 {string} string "internal server error" @Router /team [post]

func (*HTTPHandler) CreateUser

func (h *HTTPHandler) CreateUser(w http.ResponseWriter, r *http.Request)

CreateUser @Summary Register @Description Register user in the system @Tags user @Accept json @Produce json @Param request.Register body request.Register true "Add account" @Success 200 {string} string "ok" @Failure 400 {string} string "bad request" @Failure 409 {string} string "user exists" @Failure 500 {string} string "internal server error" @Router /user/auth/register [post]

func (*HTTPHandler) DeleteRegisterOnMasterClass

func (h *HTTPHandler) DeleteRegisterOnMasterClass(w http.ResponseWriter, r *http.Request)

DeleteRegisterOnMasterClass @Summary DeleteRegisterOnMasterClass @Description @Tags sec @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param id path string true "master class ID" @Success 200 {string} string "ok" @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 403 {string} string "not rights" @Failure 404 {string} string "not found" @Failure 500 {string} string "internal server error" @Router /sec/master_class/{id} [delete]

func (*HTTPHandler) DeleteTeam

func (h *HTTPHandler) DeleteTeam(w http.ResponseWriter, r *http.Request)

DeleteTeam @Summary DeleteTeam @Description Delete team if team is empty (only capitan of team) @Tags team @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Success 200 {string} string "ok" @Failure 401 {string} string "not authorized" @Failure 500 {string} string "internal server error" @Router /team [delete]

func (*HTTPHandler) DeleteUserFromTeam

func (h *HTTPHandler) DeleteUserFromTeam(w http.ResponseWriter, r *http.Request)

DeleteUserFromTeam @Summary DeleteUserFromTeam @Description User can be removed from the team (not captain) @Tags team @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param request.DeleteMemberFromTeam body request.DeleteMemberFromTeam true "Delete from team" @Success 200 {string} string "ok" @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 500 {string} string "internal server error" @Router /team/member [delete]

func (*HTTPHandler) GetAllAdminMasterClass

func (h *HTTPHandler) GetAllAdminMasterClass(w http.ResponseWriter, r *http.Request)

GetAllAdminMasterClass @Summary GetAllAdminMasterClass @Description @Tags sec @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Success 200 object response.GetSecById @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 403 {string} string "not rights" @Failure 500 {string} string "internal server error" @Router /admin/sec [get]

func (*HTTPHandler) GetAllMasterClass

func (h *HTTPHandler) GetAllMasterClass(w http.ResponseWriter, r *http.Request)

GetAllMasterClass @Summary GetAllMasterClass @Description возвращает все мастеркласы, которые еще не начались @Tags sec @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Success 200 object response.GetSecByFilter @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 500 {string} string "internal server error" @Router /sec [get]

func (*HTTPHandler) GetAllMediaTaskByTeam

func (h *HTTPHandler) GetAllMediaTaskByTeam(w http.ResponseWriter, r *http.Request)

GetAllMediaTaskByTeam @Summary Get All Media Task By Team @Description @Tags media @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Success 200 {object} response.GetAllAnswerByTeam @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 500 {string} string "internal server error" @Router /task/media/answer [get]

func (*HTTPHandler) GetAnswerOnMediaByFilter

func (h *HTTPHandler) GetAnswerOnMediaByFilter(w http.ResponseWriter, r *http.Request)

GetAnswerOnMediaByFilter @Summary Get Answer On Media By Filter @Description @Tags media @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param status query string false "string status" @Success 200 {object} response.GetAnswersOnMediaTaskByFilter @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 403 {string} string "not rights" @Failure 500 {string} string "internal server error" @Router /admin/task/media/answer [get]

func (*HTTPHandler) GetAnswerOnMediaTaskById

func (h *HTTPHandler) GetAnswerOnMediaTaskById(w http.ResponseWriter, r *http.Request)

GetAnswerOnMediaTaskById @Summary Get Answer On Media Task By MasterClassId @Description @Tags media @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param id path string true "answer ID" @Success 200 {object} response.GetAnswerOnTextTaskByID @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 403 {string} string "not rights" @Failure 500 {string} string "internal server error" @Router /admin/task/media/answer/{id} [get]

func (*HTTPHandler) GetMasterClassAdminById

func (h *HTTPHandler) GetMasterClassAdminById(w http.ResponseWriter, r *http.Request)

GetMasterClassAdminById @Summary GetMasterClassAdminById @Description возвращает все мастеркласы, которые еще не начались @Tags sec @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param id path string true "master class ID" @Success 200 object response.GetSecAdminById @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 403 {string} string "not rights" @Failure 500 {string} string "internal server error" @Router /admin/sec/{id} [get]

func (*HTTPHandler) GetMasterClassById

func (h *HTTPHandler) GetMasterClassById(w http.ResponseWriter, r *http.Request)

func (*HTTPHandler) GetMasterClassByTeam

func (h *HTTPHandler) GetMasterClassByTeam(w http.ResponseWriter, r *http.Request)

GetMasterClassByTeam @Summary GetMasterClassByTeam @Description @Tags sec @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Success 200 object response.GetSecByTeamId @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 500 {string} string "internal server error" @Router /sec/my [get]

func (*HTTPHandler) GetMediaTask

func (h *HTTPHandler) GetMediaTask(w http.ResponseWriter, r *http.Request)

GetMediaTask @Summary Get media task @Description @Tags media @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Success 200 {object} response.GetMediaTask @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 500 {string} string "internal server error" @Router /task/media [get]

func (*HTTPHandler) GetMediaTaskByTeamById

func (h *HTTPHandler) GetMediaTaskByTeamById(w http.ResponseWriter, r *http.Request)

GetMediaTaskByTeamById @Summary Get Media Task By Team By MasterClassId @Description @Tags media @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param id path string true "answer ID" @Success 200 {object} response.GetAnswerByTeamByID @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 500 {string} string "internal server error" @Router /task/media/answer/{id} [get]

func (*HTTPHandler) GetProfile

func (h *HTTPHandler) GetProfile(w http.ResponseWriter, r *http.Request)

GetProfile @Summary GetProfile @Description Get the user information about yourself @Tags user @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Success 200 {object} response.UserProfile @Failure 401 {string} string "not authorized" @Failure 500 {string} string "internal server error" @Router /user [get]

func (*HTTPHandler) GetSecById

func (h *HTTPHandler) GetSecById(w http.ResponseWriter, r *http.Request)

GetSecById @Summary GetSecById @Description @Tags sec @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param id path string true "sec ID" @Success 200 object response.GetSecById @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 500 {string} string "internal server error" @Router /sec/{id} [get]

func (*HTTPHandler) GetTeam

func (h *HTTPHandler) GetTeam(w http.ResponseWriter, r *http.Request)

GetTeam @Summary GetTeam @Description User gets info about team @Tags team @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Success 200 {object} response.GetTeam @Failure 401 {string} string "not authorized" @Failure 500 {string} string "internal server error" @Router /team [get]

func (*HTTPHandler) GetTeamById

func (h *HTTPHandler) GetTeamById(w http.ResponseWriter, r *http.Request)

GetTeamById @Summary GetTeamById @Description Get info about team by id @Tags team @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param id path string true "team ID" @Success 200 {string} string "ok" @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 403 {string} string "not rights" @Failure 500 {string} string "internal server error" @Router /admin/team/{id} [get]

func (*HTTPHandler) GetTeamsByFilter

func (h *HTTPHandler) GetTeamsByFilter(w http.ResponseWriter, r *http.Request)

GetTeamsByFilter @Summary GetTeamsByFilter @Description Get all info about team @Tags team @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param count query int false "int count" @Success 200 {string} string "ok" @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 403 {string} string "not rights" @Failure 500 {string} string "internal server error" @Router /admin/team [get]

func (*HTTPHandler) GetTextTask

func (h *HTTPHandler) GetTextTask(w http.ResponseWriter, r *http.Request)

GetTextTask @Summary CreateAnswerOnTextTask @Description @Tags text @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Success 200 object response.GetTextTask @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 423 {string} string "locked" @Failure 500 {string} string "internal server error" @Router /task/text [get]

func (*HTTPHandler) GetUserById

func (h *HTTPHandler) GetUserById(w http.ResponseWriter, r *http.Request)

GetUserById @Summary GetUserById @Description Get info about users by id (only admin) @Tags user @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param id path string true "user ID" @Success 200 {string} string "ok" @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 403 {string} string "not rights" @Failure 500 {string} string "internal server error" @Router /admin/user/{id} [get]

func (*HTTPHandler) GetUsersByFilter

func (h *HTTPHandler) GetUsersByFilter(w http.ResponseWriter, r *http.Request)

GetUsersByFilter @Summary GetUsersByFilter @Description Get info about users by filter (only admin) @Tags user @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param team query bool false "boolean team" @Param count query int true "count members in team" @Success 200 {string} string "ok" @Failure 400 {string} string "bad request" @Failure 403 {string} string "not rights" @Failure 401 {string} string "not authorized" @Failure 500 {string} string "internal server error" @Router /admin/user [get]

func (*HTTPHandler) GivesPointsTeam

func (h *HTTPHandler) GivesPointsTeam(w http.ResponseWriter, r *http.Request)

GivesPointsTeam @Summary GivesPointsTeam @Description @Tags team @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Success 200 {string} string "ok" @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 403 {string} string "not rights" @Failure 500 {string} string "internal server error" @Router /admin/team/{id}/point/give [put]

func (*HTTPHandler) Login

func (h *HTTPHandler) Login(w http.ResponseWriter, r *http.Request)

Login @Summary Login @Description Login in the system @Tags user @Accept json @Produce json @Param request.Login body request.Login true "Login account" @Success 200 {string} string "ok" @Failure 400 {string} string "bad request" @Failure 401 {string} string "user does not exist" @Failure 500 {string} string "internal server error" @Router /user/auth/login [post]

func (*HTTPHandler) Logout

func (h *HTTPHandler) Logout(w http.ResponseWriter, r *http.Request)

Logout @Summary Logout @Description Logout in the system @Tags user @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Success 200 {string} string "ok" @Failure 401 {string} string "not authorized" @Failure 500 {string} string "internal server error" @Router /user/logout [delete]

func (*HTTPHandler) SpendPointsTeam

func (h *HTTPHandler) SpendPointsTeam(w http.ResponseWriter, r *http.Request)

SpendPointsTeam @Summary SpendPointsTeam @Description @Tags team @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param request.UpdateSpendPoints body request.UpdateSpendPoints true "Spend points team" @Success 200 {string} string "ok" @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 403 {string} string "not rights" @Failure 500 {string} string "internal server error" @Router /admin/team/{id}/point/spend [put]

func (*HTTPHandler) UpdateAnswerOnMediaTaskById

func (h *HTTPHandler) UpdateAnswerOnMediaTaskById(w http.ResponseWriter, r *http.Request)

UpdateAnswerOnMediaTaskById @Summary Update Answer On Media Task By MasterClassId @Description @Tags media @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param request.UpdateAnswerOnMediaTask body request.UpdateAnswerOnMediaTask true "Add answer on media task" @Success 200 {string} string "ok" @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 403 {string} string "not rights" @Failure 404 {string} string "not found" @Failure 500 {string} string "internal server error" @Router /task/media/answer [post]

func (*HTTPHandler) UpdateAnswerOnTextTaskById

func (h *HTTPHandler) UpdateAnswerOnTextTaskById(w http.ResponseWriter, r *http.Request)

UpdateAnswerOnTextTaskById @Summary UpdateAnswerOnTextTaskById @Description @Tags text @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param request.UpdateAnswerOnTextTaskByID body request.UpdateAnswerOnTextTaskByID true "send answer" @Success 200 object response.UpdateAnswerOnTextTaskByID @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 403 {string} string "not rights" @Failure 418 {string} string "I'm a teapot" @Failure 500 {string} string "internal server error" @Router /task/text/answer [post]

func (*HTTPHandler) UpdateProfile

func (h *HTTPHandler) UpdateProfile(w http.ResponseWriter, r *http.Request)

UpdateProfile @Summary UpdateProfile @Description Update the user information about yourself @Tags user @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param request.ChangeProfile body request.ChangeProfile true "Change profile" @Success 200 {string} string "ok" @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 500 {string} string "internal server error" @Router /user [put]

func (*HTTPHandler) UpdateStatusAnswerOnMediaTask

func (h *HTTPHandler) UpdateStatusAnswerOnMediaTask(w http.ResponseWriter, r *http.Request)

UpdateStatusAnswerOnMediaTask @Summary Update Status Answer On Media Task @Description @Tags media @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param id path string true "answer ID" @Param request.UpdatePointsOnAnswerOnMediaTask body request.UpdatePointsOnAnswerOnMediaTask true "Check answer on media task" @Success 200 {string} string "ok" @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 403 {string} string "not rights" @Failure 500 {string} string "internal server error" @Router /admin/task/media/answer/{id} [post]

func (*HTTPHandler) UpdateTeam

func (h *HTTPHandler) UpdateTeam(w http.ResponseWriter, r *http.Request)

UpdateTeam @Summary UpdateTeam @Description Update info about team (only capitan of team) @Tags team @Accept json @Produce json @Security ApiKeyAuth @Param Authorization header string true "Authorization" @Param request.UpdateTeam body request.UpdateTeam true "Change team" @Success 200 {string} string "ok" @Failure 400 {string} string "bad request" @Failure 401 {string} string "not authorized" @Failure 500 {string} string "internal server error" @Router /team [put]

Jump to

Keyboard shortcuts

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