mirror of
https://github.com/m5stack/StackChan.git
synced 2026-04-27 19:12:40 +00:00
server code
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package dance
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"stackChan/api/dance/v1"
|
||||
)
|
||||
|
||||
type IDanceV1 interface {
|
||||
Create(ctx context.Context, req *v1.CreateReq) (res *v1.CreateRes, err error)
|
||||
Delete(ctx context.Context, req *v1.DeleteReq) (res *v1.DeleteRes, err error)
|
||||
Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error)
|
||||
GetList(ctx context.Context, req *v1.GetListReq) (res *v1.GetListRes, err error)
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"stackChan/internal/model"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type CreateReq struct {
|
||||
g.Meta `path:"/dance" method:"post" tags:"Dance" summary:"Dance create request"`
|
||||
Mac string `json:"mac" v:"required"`
|
||||
Index int `json:"index" v:"required"`
|
||||
List []model.DanceData `json:"list" v:"required"`
|
||||
}
|
||||
|
||||
type CreateRes string
|
||||
|
||||
type DeleteReq struct {
|
||||
g.Meta `path:"/dance" method:"delete" tags:"Dance" summary:"Dance delete request"`
|
||||
Mac string `json:"mac" v:"required"`
|
||||
Index int `json:"index" v:"required"`
|
||||
}
|
||||
|
||||
type DeleteRes string
|
||||
|
||||
type UpdateReq struct {
|
||||
g.Meta `path:"/dance" method:"put" tags:"Dance" summary:"Dance put request"`
|
||||
Mac string `json:"mac" v:"required"`
|
||||
Index int `json:"index" v:"required"`
|
||||
Data []model.DanceData `json:"list" v:"required"`
|
||||
}
|
||||
|
||||
type UpdateRes string
|
||||
|
||||
type GetListReq struct {
|
||||
g.Meta `path:"/dance" method:"get" tags:"Dance" summary:"Dance get request"`
|
||||
Mac string `json:"mac" v:"required"`
|
||||
}
|
||||
|
||||
type GetListRes map[string][]model.DanceData
|
||||
@@ -0,0 +1,19 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package device
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"stackChan/api/device/v1"
|
||||
)
|
||||
|
||||
type IDeviceV1 interface {
|
||||
Create(ctx context.Context, req *v1.CreateReq) (res *v1.CreateRes, err error)
|
||||
Update(ctx context.Context, req *v1.UpdateReq) (res *v1.UpdateRes, err error)
|
||||
GetRandomDevice(ctx context.Context, req *v1.GetRandomDeviceReq) (res *v1.GetRandomDeviceRes, err error)
|
||||
GetDeviceInfo(ctx context.Context, req *v1.GetDeviceInfoReq) (res *v1.GetDeviceInfoRes, err error)
|
||||
UpdateDeviceInfo(ctx context.Context, req *v1.UpdateDeviceInfoReq) (res *v1.UpdateDeviceInfoRes, err error)
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"stackChan/internal/model"
|
||||
"stackChan/internal/model/entity"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type CreateReq struct {
|
||||
g.Meta `path:"/device" method:"post" tags:"Device" summary:"Device create request"`
|
||||
Mac string `json:"mac" v:"required" description:"Mac address"`
|
||||
Name string `json:"name,omitempty" description:"Device name"`
|
||||
}
|
||||
|
||||
type CreateRes struct {
|
||||
Id int64 `json:"id" dc:"Device id"`
|
||||
}
|
||||
|
||||
type UpdateReq struct {
|
||||
g.Meta `path:"/device" method:"put" tags:"Device" summary:"Device update request"`
|
||||
Mac string `json:"mac" v:"required" description:"Mac address"`
|
||||
Name string `json:"name" description:"Device name"`
|
||||
}
|
||||
|
||||
type UpdateRes struct{}
|
||||
|
||||
type GetRandomDeviceReq struct {
|
||||
g.Meta `path:"/device/randomList" method:"get" tags:"Device" summary:"Device get Random"`
|
||||
Mac string `json:"mac" v:"required" description:"Mac address"`
|
||||
}
|
||||
|
||||
type GetRandomDeviceRes []entity.Device
|
||||
|
||||
type GetDeviceInfoReq struct {
|
||||
g.Meta `path:"/device/info" method:"get" tags:"Device" summary:"Device Info Get request"`
|
||||
Mac string `json:"mac" v:"required" description:"Mac address"`
|
||||
}
|
||||
|
||||
type GetDeviceInfoRes model.DeviceInfo
|
||||
|
||||
type UpdateDeviceInfoReq struct {
|
||||
g.Meta `path:"/device/info" method:"put" tags:"Device" summary:"Device Info Put request"`
|
||||
Mac string `json:"mac" v:"required" description:"Mac address"`
|
||||
Name string `json:"name" description:"Device name"`
|
||||
}
|
||||
|
||||
type UpdateDeviceInfoRes string
|
||||
@@ -0,0 +1,15 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package file
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"stackChan/api/file/v1"
|
||||
)
|
||||
|
||||
type IFileV1 interface {
|
||||
File(ctx context.Context, req *v1.FileReq) (res *v1.FileRes, err error)
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
"github.com/gogf/gf/v2/net/ghttp"
|
||||
)
|
||||
|
||||
type FileReq struct {
|
||||
g.Meta `path:"/uploadFile" method:"post" tags:"File" summary:"File upload request"`
|
||||
File *ghttp.UploadFile `json:"file" v:"required" description:"File upload request"`
|
||||
Name string `json:"name" v:"required" description:"File Name"`
|
||||
Directory string `json:"directory" description:"Directory upload request"`
|
||||
}
|
||||
|
||||
type FileRes struct {
|
||||
Path string `json:"path" description:"file path"`
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package friend
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"stackChan/api/friend/v1"
|
||||
)
|
||||
|
||||
type IFriendV1 interface {
|
||||
Add(ctx context.Context, req *v1.AddReq) (res *v1.AddRes, err error)
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import "github.com/gogf/gf/v2/frame/g"
|
||||
|
||||
type AddReq struct {
|
||||
g.Meta `path:"/friend" method:"post" tags:"Friend" summary:"Friend add request"`
|
||||
Mac string `json:"mac" v:"required" description:"Mac address"`
|
||||
FriendMac string `json:"friendMac" v:"required" description:"Friend Mac address"`
|
||||
}
|
||||
|
||||
type AddRes string
|
||||
@@ -0,0 +1,20 @@
|
||||
// =================================================================================
|
||||
// Code generated and maintained by GoFrame CLI tool. DO NOT EDIT.
|
||||
// =================================================================================
|
||||
|
||||
package post
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"stackChan/api/post/v1"
|
||||
)
|
||||
|
||||
type IPostV1 interface {
|
||||
CreatePost(ctx context.Context, req *v1.CreatePostReq) (res *v1.CreatePostRes, err error)
|
||||
GetPost(ctx context.Context, req *v1.GetPostReq) (res *v1.GetPostRes, err error)
|
||||
DeletePost(ctx context.Context, req *v1.DeletePostReq) (res *v1.DeletePostRes, err error)
|
||||
CreatePostComment(ctx context.Context, req *v1.CreatePostCommentReq) (res *v1.CreatePostCommentRes, err error)
|
||||
DeletePostComment(ctx context.Context, req *v1.DeletePostCommentReq) (res *v1.DeletePostCommentRes, err error)
|
||||
GetPostComment(ctx context.Context, req *v1.GetPostCommentReq) (res *v1.GetPostCommentRes, err error)
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
/*
|
||||
SPDX-FileCopyrightText: 2026 M5Stack Technology CO LTD
|
||||
SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
package v1
|
||||
|
||||
import (
|
||||
"stackChan/internal/model"
|
||||
|
||||
"github.com/gogf/gf/v2/frame/g"
|
||||
)
|
||||
|
||||
type CreatePostReq struct {
|
||||
g.Meta `path:"/post/add" method:"post" tags:"Post" summary:"Post create request"`
|
||||
Mac string `json:"mac" v:"required" description:"Mac address"`
|
||||
ContentText string `json:"content_text" v:"required" description:"Content text"`
|
||||
ContentImage string `json:"content_image" v:"required" description:"Content image"`
|
||||
}
|
||||
|
||||
type CreatePostRes struct {
|
||||
Id int64 `json:"id"`
|
||||
}
|
||||
|
||||
type GetPostReq struct {
|
||||
g.Meta `path:"/post/get" method:"get" tags:"Post" summary:"Post get request"`
|
||||
Page int `json:"page" v:"required#Page不能为空" description:"页码"`
|
||||
PageSize int `json:"pageSize" v:"required#每页数量不能为空" description:"每页条数"`
|
||||
}
|
||||
|
||||
type GetPostRes []model.Post
|
||||
|
||||
type DeletePostReq struct {
|
||||
g.Meta `path:"/post/delete" method:"delete" tags:"Post" summary:"Post delete request"`
|
||||
Id int `json:"id" summary:"Post id"`
|
||||
}
|
||||
|
||||
type DeletePostRes string
|
||||
|
||||
type CreatePostCommentReq struct {
|
||||
g.Meta `path:"/post/comment/create" method:"post" tags:"Post" summary:"Post create comment"`
|
||||
Mac string `json:"mac" v:"required" description:"Mac address"`
|
||||
PostId int64 `json:"postId" v:"required" summary:"Post comment id"`
|
||||
Content string `json:"content" description:"评论内容"`
|
||||
}
|
||||
|
||||
type CreatePostCommentRes struct {
|
||||
Id int64 `json:"id"`
|
||||
}
|
||||
|
||||
type DeletePostCommentReq struct {
|
||||
g.Meta `path:"/post/comment/delete" method:"post" tags:"Post" summary:"Post delete comment"`
|
||||
Mac string `json:"mac" v:"required" description:"Mac address"`
|
||||
Id int `json:"id" summary:"Post comment id"`
|
||||
}
|
||||
|
||||
type DeletePostCommentRes struct{}
|
||||
|
||||
type GetPostCommentReq struct {
|
||||
g.Meta `path:"/post/comment/get" method:"get" tags:"Post" summary:"Post get comment"`
|
||||
PostId int64 `json:"postId" summary:"Post comment id"`
|
||||
Mac string `json:"mac" v:"required" description:"Mac address"`
|
||||
Page int `json:"page" summary:"Post comment page"`
|
||||
PageSize int `json:"pageSize" summary:"Post comment page"`
|
||||
}
|
||||
|
||||
type GetPostCommentRes struct {
|
||||
List []*model.PostComment `json:"list"`
|
||||
Total int `json:"total"`
|
||||
}
|
||||
Reference in New Issue
Block a user