controllers

package
v0.0.0-...-21eabe8 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

* @Descripttion: * @version: * @Author: sunylin * @Date: 2020-12-20 22:54:43 * @LastEditors: sunylin * @LastEditTime: 2020-12-22 13:07:04

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContentController

type ContentController struct {
	Ctx     iris.Context
	Model   models.ContentDB
	Session *sessions.Session
}

ContentController content 控制器

func (*ContentController) DeleteBy

func (c *ContentController) DeleteBy(contentID string) (res models.CommonRes)

DeleteBy DELETE /api/content/{contentID:string} 删除指定内容

func (*ContentController) GetDetailBy

func (c *ContentController) GetDetailBy(contentID string) (res models.ContentDetailres)

GetDetailBy GET /api/content/detail/{contentID:string} 获取指定内容

func (*ContentController) GetPublic

func (c *ContentController) GetPublic() (res models.ContentPublicList)

GetPublic GET /api/content/public 获取公共内容

func (*ContentController) GetTextsBy

func (c *ContentController) GetTextsBy(userID string) (res models.ContentListByUser)

GetUsercontentBy GET /api/content/texts/{userID:string} 获取指定用户的所有内容

func (*ContentController) Options

func (c *ContentController) Options()

Options options

func (*ContentController) OptionsBy

func (c *ContentController) OptionsBy(contentID string)

OptionsBy options

func (*ContentController) OptionsDetailBy

func (c *ContentController) OptionsDetailBy(contentID string)

OptionsDetailBy OPTIONS /api/content/detail/{contentID:string} 获取指定内容

func (*ContentController) OptionsPublic

func (c *ContentController) OptionsPublic()

OptionsPublic OPTIONS /api/content/public 获取公共内容

func (*ContentController) OptionsText

func (c *ContentController) OptionsText()

OptionsText OPTIONS /api/content/text 增加文本内容

func (*ContentController) OptionsTextsBy

func (c *ContentController) OptionsTextsBy(userID string)

OptionsTextsBy OPTIONS /api/content/texts/{userID:string} 获取指定用户的所有内容

func (*ContentController) OptionsUpdate

func (c *ContentController) OptionsUpdate()

OptionsUpdate OPTIONS /api/content/update 增加文本内容

func (*ContentController) PostText

func (c *ContentController) PostText() (res models.CommonRes)

PostText POST /api/content/text 增加文本内容

func (*ContentController) PostUpdate

func (c *ContentController) PostUpdate() (res models.CommonRes)

PostUpdate POST /api/content/update 增加文本内容

type LikeController

type LikeController struct {
	Ctx     iris.Context
	Model   models.LikeDB
	Session *sessions.Session
}

func (*LikeController) GetBy

func (c *LikeController) GetBy(id string) (res LikeRes)

GetBy Get /like/{contentID} 获取用户点赞列表

func (*LikeController) OptionsBy

func (c *LikeController) OptionsBy(id string)

Options Options /like/{contentID} 对某个内容点赞

func (*LikeController) PatchBy

func (c *LikeController) PatchBy(id string) (res models.CommonRes)

​ PatchBy PATCH /like/{contentID} 取消用户对某个内容的点赞

func (*LikeController) PostBy

func (c *LikeController) PostBy(id string) (res models.CommonRes)

​PostBy POST /like/{contentID} 对某个内容点赞

type LikeRes

type LikeRes struct {
	State string
	Data  []string
}

LikeRes 用户点赞数据返回值

type LoginReq

type LoginReq struct {
	Name     string `json:"username"`
	Password string `json:"password"`
}

LoginReq POST /user/login 登陆请求

type NameReq

type NameReq struct {
	Name string `json:"name"`
}

NameReq POST /user/name 更新用户名

type NotificationController

type NotificationController struct {
	Ctx     iris.Context
	Model   models.NotifiationDB
	Session *sessions.Session
}

func (*NotificationController) DeleteBy

func (c *NotificationController) DeleteBy(notificationID string) (res models.CommonRes)

DeleteBy DELETE /api/notificaiton/{NotificationID:string} 删除指定通知

func (*NotificationController) GetAll

GetAll GET /api/notification/all 获取用户所有通知

func (*NotificationController) OptionsAll

func (c *NotificationController) OptionsAll() (res models.UserNotificationres)
type PageParams struct {
	Page   int   `url:"page"`
	PerPage int  `url:"per_page"`
}

OptionsAll OPTIONS /api/notification/all 获取用户所有通知

func (*NotificationController) OptionsBy

func (c *NotificationController) OptionsBy(notificationID string)

OptionsBy OPTIONS /api/notificaiton/{NotificationID:string} 删除指定通知

type PageParams

type PageParams struct {
	Page    int `url:"page"`
	PerPage int `url:"per_page"`
}

type RegisterReq

type RegisterReq struct {
	Name     string `json:"username"`
	Email    string `json:"email"`
	Password string `json:"password"`
}

RegisterReq POST /user/register 注册请求

type TextReq

type TextReq struct {
	Detail   string   `json:"detail"`
	Tags     []string `json:"tags"`
	IsPublic bool     `json:"isPublic"`
}

TextReq POST /api/content/text 增加文本内容

type TextUpdateReq

type TextUpdateReq struct {
	ID       string   `json:"contentID"`
	Detail   string   `json:"detail"`
	Tags     []string `json:"tags"`
	IsPublic bool     `json:"isPublic"`
}

TextUpdateReq 文本内容

type UsersController

type UsersController struct {
	Ctx     iris.Context
	Model   models.UserDB
	Session *sessions.Session
}

func (*UsersController) GetInfoBy

func (c *UsersController) GetInfoBy(id string) (res models.UserInfoRes)

GetInfo GET /user/info/{userID:string}

func (*UsersController) OptionsInfoBy

func (c *UsersController) OptionsInfoBy(id string)

OptionsInfoBy OPTIONS /user/info/{userID:string}

func (*UsersController) OptionsLogin

func (c *UsersController) OptionsLogin()

OptionsLogin Options /user/login 用户登陆

func (*UsersController) OptionsLogout

func (c *UsersController) OptionsLogout()

OptionsLogout Options user/logout 退出登陆

func (*UsersController) OptionsName

func (c *UsersController) OptionsName()

OptionsName OPTIONS /user/name

func (*UsersController) OptionsRegister

func (c *UsersController) OptionsRegister()

OptionsRegister OPTIONS /user/register 用户注册

func (*UsersController) PostLogin

func (c *UsersController) PostLogin() (res models.CommonRes)

PostLogin POST /user/login 用户登陆

func (*UsersController) PostLogout

func (c *UsersController) PostLogout() (res models.CommonRes)

PostLogout POST /user/logout 退出登陆

func (*UsersController) PostName

func (c *UsersController) PostName() (res models.CommonRes)

PostName POST /user/name 更新用户名 (Token required)

func (*UsersController) PostRegister

func (c *UsersController) PostRegister() (res models.CommonRes)

PostRegister POST /user/register 用户注册

Jump to

Keyboard shortcuts

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