server

package
v0.0.0-...-9305a47 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetValidator

func GetValidator() *validator.Validate

Types

type Auth

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

func NewAuth

func NewAuth(cfg *config.Config, auth serviceAuth.IAuth) *Auth

func (*Auth) Login

func (s *Auth) Login(w http.ResponseWriter, r *http.Request)

swagger:route POST /api/v1/auth/login Auth AuthLoginRequest

Login form

Responses:
  200: AuthLoginResponse

func (*Auth) Logout

func (s *Auth) Logout(w http.ResponseWriter, r *http.Request)

swagger:route POST /api/v1/auth/logout Auth AuthLogoutRequest

Close the current session

Responses:
  200: AuthLogoutResponse

func (*Auth) Register

func (s *Auth) Register(w http.ResponseWriter, r *http.Request)

swagger:route POST /api/v1/auth/register Auth AuthRegisterRequest

Registration form

Responses:
  200: AuthRegisterResponse

func (*Auth) RegisterPrivateRouter

func (s *Auth) RegisterPrivateRouter(router *mux.Router, middleware ...mux.MiddlewareFunc)

func (*Auth) RegisterPublicRouter

func (s *Auth) RegisterPublicRouter(router *mux.Router)

func (*Auth) User

func (s *Auth) User(w http.ResponseWriter, r *http.Request)

swagger:route GET /api/v1/auth/user Auth AuthUserRequest

Getting information about the current user

Responses:
  200: AuthUserResponse

type AuthLoginRequest

type AuthLoginRequest struct {
	// In: body
	Body struct {
		dto.LoginDTO
	}
}

swagger:parameters AuthLoginRequest

type AuthLoginResponse

type AuthLoginResponse struct {
}

swagger:response AuthLoginResponse

type AuthLogoutRequest

type AuthLogoutRequest struct {
}

swagger:parameters AuthLogoutRequest

type AuthLogoutResponse

type AuthLogoutResponse struct {
}

swagger:response AuthLogoutResponse

type AuthRegisterRequest

type AuthRegisterRequest struct {
	// In: body
	Body struct {
		dto.RegisterDTO
	}
}

swagger:parameters AuthRegisterRequest

type AuthRegisterResponse

type AuthRegisterResponse struct {
}

swagger:response AuthRegisterResponse

type AuthUserRequest

type AuthUserRequest struct {
}

swagger:parameters AuthUserRequest

type AuthUserResponse

type AuthUserResponse struct {
	// In: body
	Body struct {
		Data *entity.User `json:"data"`
	}
}

swagger:response AuthUserResponse

type Invite

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

func NewInvite

func NewInvite(invite serviceInvite.IInvite) *Invite

func (*Invite) Generate

func (s *Invite) Generate(w http.ResponseWriter, r *http.Request)

swagger:route GET /api/v1/invites/generate Invite InviteGenerateRequest

Generate a new invitation code

Responses:
  200: InviteGenerateResponse

func (*Invite) RegisterPrivateRouter

func (s *Invite) RegisterPrivateRouter(router *mux.Router, middleware ...mux.MiddlewareFunc)

func (*Invite) Revoke

func (s *Invite) Revoke(w http.ResponseWriter, r *http.Request)

swagger:route DELETE /api/v1/invites/revoke Invite InviteRevokeRequest

Revoke the generated invitation code

Responses:
  200: InviteRevokeResponse

type InviteGenerateRequest

type InviteGenerateRequest struct {
}

swagger:parameters InviteGenerateRequest

type InviteGenerateResponse

type InviteGenerateResponse struct {
	// In: body
	Body struct {
		Data string `json:"data"`
	}
}

swagger:response InviteGenerateResponse

type InviteRevokeRequest

type InviteRevokeRequest struct {
}

swagger:parameters InviteRevokeRequest

type InviteRevokeResponse

type InviteRevokeResponse struct {
}

swagger:response InviteRevokeResponse

type JSONResponse

type JSONResponse struct {
	Message any `json:"message,omitempty"`
	Data    any `json:"data,omitempty"`
	Error   any `json:"error,omitempty"`
}

type Post

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

func NewPost

func NewPost(post servicePost.IPost) *Post

func (*Post) Create

func (s *Post) Create(w http.ResponseWriter, r *http.Request)

swagger:route POST /api/v1/posts Post PostCreateRequest

Post creation form

Responses:
  201: PostCreateResponse

func (*Post) Edit

func (s *Post) Edit(w http.ResponseWriter, r *http.Request)

swagger:route PUT /api/v1/posts/{id} Post PostEditRequest

Edit post form

Responses:
  200: PostEditResponse

func (*Post) Feed

func (s *Post) Feed(w http.ResponseWriter, r *http.Request)

swagger:route GET /api/v1/posts/feed Post PostFeedRequest

Get feed

Responses:
  200: PostFeedResponse

func (*Post) List

func (s *Post) List(w http.ResponseWriter, r *http.Request)

swagger:route GET /api/v1/posts Post PostListRequest

Get a list of posts for the current user

Responses:
  200: PostListResponse

func (*Post) PublicGet

func (s *Post) PublicGet(w http.ResponseWriter, r *http.Request)

swagger:route GET /api/v1/posts/{id} Post PostPublicGetRequest

Get public post

Responses:
  200: PostPublicGetResponse

func (*Post) RegisterPrivateRouter

func (s *Post) RegisterPrivateRouter(router *mux.Router, middleware ...mux.MiddlewareFunc)

func (*Post) RegisterPublicRouter

func (s *Post) RegisterPublicRouter(router *mux.Router, middleware ...mux.MiddlewareFunc)

type PostCreateRequest

type PostCreateRequest struct {
	// In: body
	Body struct {
		dto.CreatePostDTO
	}
}

swagger:parameters PostCreateRequest

type PostCreateResponse

type PostCreateResponse struct {
	// In: body
	Body struct {
		Data *entity.Post `json:"data"`
	}
}

swagger:response PostCreateResponse

type PostEditRequest

type PostEditRequest struct {
	// In: path
	ID int32 `json:"id"`
	// In: body
	Body struct {
		dto.EditPostDTO
	}
}

swagger:parameters PostEditRequest

type PostEditResponse

type PostEditResponse struct {
	// In: body
	Body struct {
		Data *entity.Post `json:"data"`
	}
}

swagger:response PostEditResponse

type PostFeedRequest

type PostFeedRequest struct {
	// In: query
	dto.FeedPostDTO
}

swagger:parameters PostFeedRequest

type PostFeedResponse

type PostFeedResponse struct {
	// In: body
	Body struct {
		Data []*entity.Post `json:"data"`
	}
}

swagger:response PostFeedResponse

type PostListRequest

type PostListRequest struct {
	// In: query
	dto.ListPostDTO
}

swagger:parameters PostListRequest

type PostListResponse

type PostListResponse struct {
	// In: body
	Body struct {
		Data []*entity.Post `json:"data"`
	}
}

swagger:response PostListResponse

type PostPublicGetRequest

type PostPublicGetRequest struct {
	// In: path
	ID int32 `json:"id"`
}

swagger:parameters PostPublicGetRequest

type PostPublicGetResponse

type PostPublicGetResponse struct {
	// In: body
	Body struct {
		Data *entity.Post `json:"data"`
	}
}

swagger:response PostPublicGetResponse

type User

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

func NewUser

func NewUser(user serviceUser.IUser) *User

func (*User) Get

func (s *User) Get(w http.ResponseWriter, r *http.Request)

swagger:route GET /api/v1/user/{id} User UserGetRequest

Getting information about a user by ID

Responses:
  200: UserGetResponse

func (*User) Password

func (s *User) Password(w http.ResponseWriter, r *http.Request)

swagger:route PUT /api/v1/user/password User UserPasswordRequest

Updating the password for a user

Responses:
  200: UserPasswordResponse

func (*User) Profile

func (s *User) Profile(w http.ResponseWriter, r *http.Request)

swagger:route PUT /api/v1/user/profile User UserProfileRequest

Updating user information

Responses:
  200: UserProfileResponse

func (*User) RegisterPrivateRouter

func (s *User) RegisterPrivateRouter(router *mux.Router, middleware ...mux.MiddlewareFunc)

func (*User) RegisterPublicRouter

func (s *User) RegisterPublicRouter(router *mux.Router, middleware ...mux.MiddlewareFunc)

type UserGetRequest

type UserGetRequest struct {
	// In: path
	ID int32 `json:"id"`
}

swagger:parameters UserGetRequest

type UserGetResponse

type UserGetResponse struct {
	// In: body
	Body struct {
		Data *entity.User `json:"data"`
	}
}

swagger:response UserGetResponse

type UserPasswordRequest

type UserPasswordRequest struct {
	// In: body
	Body struct {
		dto.UpdatePasswordDTO
	}
}

swagger:parameters UserPasswordRequest

type UserPasswordResponse

type UserPasswordResponse struct {
}

swagger:response UserPasswordResponse

type UserProfileRequest

type UserProfileRequest struct {
	// In: body
	Body struct {
		dto.UpdateProfileDTO
	}
}

swagger:parameters UserProfileRequest

type UserProfileResponse

type UserProfileResponse struct {
}

swagger:response UserProfileResponse

Jump to

Keyboard shortcuts

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