endpoints

package
v0.0.0-...-cd399ba Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCreateCourseHandler

func NewCreateCourseHandler(s domain.ServiceInterface, opts ...kithttp.ServerOption) *kithttp.Server

NewCreateCourseHandler creates new course handler @Summary Create course @Description Create a new course @Tags courses @Accept json @Produce json @Param course body CreateCourseRequest true "Add Course" @Success 200 {object} CreateCourseResponse @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /courses [post].

func NewDeleteCourseHandler

func NewDeleteCourseHandler(s domain.ServiceInterface, opts ...kithttp.ServerOption) *kithttp.Server

NewDeleteCourseHandler deletes course handler @Summary Delete course @Description Delete a new course @Tags courses @Produce json @Param uuid path string true "Course UUID" Format(uuid) @Success 200 {object} DeleteCourseResponse @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /courses/{uuid} [delete].

func NewFindCourseHandler

func NewFindCourseHandler(s domain.ServiceInterface, opts ...kithttp.ServerOption) *kithttp.Server

NewFindCourseHandler find course handler @Summary Find course @Description Find a new course @Tags courses @Produce json @Param uuid path string true "Course UUID" Format(uuid) @Success 200 {object} FindCourseResponse @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /courses/{uuid} [get].

func NewListCoursesHandler

func NewListCoursesHandler(s domain.ServiceInterface, opts ...kithttp.ServerOption) *kithttp.Server

NewListCoursesHandler list courses handler @Summary List courses @Description List a new courses @Tags courses @Produce json @Success 200 {object} ListCoursesResponse @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /courses [get].

func NewUpdateCourseHandler

func NewUpdateCourseHandler(s domain.ServiceInterface, opts ...kithttp.ServerOption) *kithttp.Server

NewUpdateCourseHandler updates new course handler @Summary Update course @Description Update a course @Tags courses @Accept json @Produce json @Param uuid path string true "Course UUID" Format(uuid) @Param course body UpdateCourseRequest true "Update Course" @Success 200 {object} UpdateCourseResponse @Failure 400 {object} error @Failure 404 {object} error @Failure 500 {object} error @Router /courses/{uuid} [put].

Types

type CourseResponse

type CourseResponse struct {
	UUID        uuid.UUID `json:"uuid"`
	Code        string    `json:"code"`
	Name        string    `json:"name"`
	Underline   string    `json:"underline"`
	Image       string    `json:"image,omitempty"`
	ImageCover  string    `json:"image_cover,omitempty"`
	Excerpt     string    `json:"excerpt"`
	Description string    `json:"description,omitempty"`
	CreatedAt   time.Time `json:"created_at"`
	UpdatedAt   time.Time `json:"updated_at"`
}

type CreateCourseRequest

type CreateCourseRequest struct {
	Code        string `json:"code"        validate:"required,max=15"`
	Name        string `json:"name"        validate:"required,max=100"`
	Underline   string `json:"underline"   validate:"required,max=100"`
	Image       string `json:"image"`
	ImageCover  string `json:"image_cover"`
	Excerpt     string `json:"excerpt"     validate:"required,max=140"`
	Description string `json:"description" validate:"required,max=255"`
}

type CreateCourseResponse

type CreateCourseResponse struct {
	Course *CourseResponse `json:"course"`
}

type DeleteCourseRequest

type DeleteCourseRequest struct {
	UUID uuid.UUID `json:"uuid" validate:"required"`
}

type DeleteCourseResponse

type DeleteCourseResponse struct {
	Course *DeletedCourseResponse `json:"course"`
}

type DeletedCourseResponse

type DeletedCourseResponse struct {
	UUID      uuid.UUID `json:"uuid"`
	DeletedAt time.Time `json:"deleted_at"`
}

type FindCourseRequest

type FindCourseRequest struct {
	UUID uuid.UUID `json:"uuid"`
}

type FindCourseResponse

type FindCourseResponse struct {
	Course *CourseResponse `json:"course"`
}

type ListCoursesResponse

type ListCoursesResponse struct {
	Courses []CourseResponse `json:"courses"`
}

type UpdateCourseRequest

type UpdateCourseRequest struct {
	UUID        uuid.UUID `json:"uuid"        validate:"required"`
	Code        string    `json:"code"        validate:"required,max=100"`
	Name        string    `json:"name"        validate:"required,max=100"`
	Underline   string    `json:"underline"   validate:"required,max=100"`
	Image       string    `json:"image"`
	ImageCover  string    `json:"image_cover"`
	Excerpt     string    `json:"excerpt"     validate:"required,max=140"`
	Description string    `json:"description" validate:"required,max=255"`
}

type UpdateCourseResponse

type UpdateCourseResponse struct {
	Course *CourseResponse `json:"course"`
}

Jump to

Keyboard shortcuts

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