add: some user api and all api desc
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
package config
|
||||
|
||||
import "github.com/zeromicro/go-zero/zrpc"
|
||||
|
||||
type Config struct {
|
||||
zrpc.RpcServerConf
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"juwan-backend/app/objectstory/rpc/internal/svc"
|
||||
"juwan-backend/app/objectstory/rpc/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type GetFileUrlLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewGetFileUrlLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GetFileUrlLogic {
|
||||
return &GetFileUrlLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// 获取文件访问链接(处理私有文件的鉴权)
|
||||
func (l *GetFileUrlLogic) GetFileUrl(in *pb.GetFileUrlReq) (*pb.GetFileUrlResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.GetFileUrlResp{}, nil
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package logic
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"juwan-backend/app/objectstory/rpc/internal/svc"
|
||||
"juwan-backend/app/objectstory/rpc/pb"
|
||||
|
||||
"github.com/zeromicro/go-zero/core/logx"
|
||||
)
|
||||
|
||||
type UploadLogic struct {
|
||||
ctx context.Context
|
||||
svcCtx *svc.ServiceContext
|
||||
logx.Logger
|
||||
}
|
||||
|
||||
func NewUploadLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UploadLogic {
|
||||
return &UploadLogic{
|
||||
ctx: ctx,
|
||||
svcCtx: svcCtx,
|
||||
Logger: logx.WithContext(ctx),
|
||||
}
|
||||
}
|
||||
|
||||
// 简单上传(适合小文件,或保存元数据)
|
||||
func (l *UploadLogic) Upload(in *pb.UploadFileMetadataReq) (*pb.UploadFileResp, error) {
|
||||
// todo: add your logic here and delete this line
|
||||
|
||||
return &pb.UploadFileResp{}, nil
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
// Code generated by goctl. DO NOT EDIT.
|
||||
// goctl 1.9.2
|
||||
// Source: objectstory.proto
|
||||
|
||||
package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"juwan-backend/app/objectstory/rpc/internal/logic"
|
||||
"juwan-backend/app/objectstory/rpc/internal/svc"
|
||||
"juwan-backend/app/objectstory/rpc/pb"
|
||||
)
|
||||
|
||||
type FileServiceServer struct {
|
||||
svcCtx *svc.ServiceContext
|
||||
pb.UnimplementedFileServiceServer
|
||||
}
|
||||
|
||||
func NewFileServiceServer(svcCtx *svc.ServiceContext) *FileServiceServer {
|
||||
return &FileServiceServer{
|
||||
svcCtx: svcCtx,
|
||||
}
|
||||
}
|
||||
|
||||
// 简单上传(适合小文件,或保存元数据)
|
||||
func (s *FileServiceServer) Upload(ctx context.Context, in *pb.UploadFileMetadataReq) (*pb.UploadFileResp, error) {
|
||||
l := logic.NewUploadLogic(ctx, s.svcCtx)
|
||||
return l.Upload(in)
|
||||
}
|
||||
|
||||
// 获取文件访问链接(处理私有文件的鉴权)
|
||||
func (s *FileServiceServer) GetFileUrl(ctx context.Context, in *pb.GetFileUrlReq) (*pb.GetFileUrlResp, error) {
|
||||
l := logic.NewGetFileUrlLogic(ctx, s.svcCtx)
|
||||
return l.GetFileUrl(in)
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package svc
|
||||
|
||||
import "juwan-backend/app/objectstory/rpc/internal/config"
|
||||
|
||||
type ServiceContext struct {
|
||||
Config config.Config
|
||||
}
|
||||
|
||||
func NewServiceContext(c config.Config) *ServiceContext {
|
||||
return &ServiceContext{
|
||||
Config: c,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user