sun-pc 5 місяців тому
батько
коміт
ebd0f30c2f

+ 0 - 4
pack-moutai/docker-compose.yaml

@@ -49,9 +49,5 @@ services:
     restart: always
     depends_on:
       - moutai-bus
-    volumes:
-      - ./mongo-migrations:/root/projects/migrations
     environment: 
       NATS: nats://moutai-bus:4222
-      MONGO_MIGRATIONS: /root/projects/migrations==mongodb://root:moutai_zzzxxx@moutai-mongo:27017/moutai?authSource=admin
-

+ 0 - 15
pack-moutai/mongo-migrations/1_users.down.json

@@ -1,15 +0,0 @@
-[
-    {
-        "delete": "users",
-        "deletes": [
-           {
-             "q" : {
-                "_id": {
-                    "$oid": "637dde15ad5446a2050456f1"
-                }
-             },
-             "limit" : 1
-           }
-        ]
-     }
-]

+ 0 - 20
pack-moutai/mongo-migrations/1_users.up.json

@@ -1,20 +0,0 @@
-[
-    {
-        "insert": "users",
-        "documents": [
-            {
-                "_id": {
-                    "$oid": "637dde15ad5446a2050456f1"
-                },
-                "name": "管理员",
-                "loginName": "admin",
-                "avatar": "",
-                "password": "e10adc3949ba59abbe56e057f20f883e",
-                "roleId": "650965b2653077b4a74fd34d",
-                "state": 1,
-                "updateTime": "2024-10-15T08:47:05.583Z",
-                "createTime": "2024-10-15T08:47:05.583Z"
-            }
-        ]
-    }
-]

+ 0 - 15
pack-moutai/mongo-migrations/2_roles.down.json

@@ -1,15 +0,0 @@
-[
-    {
-        "delete": "roles",
-        "deletes": [
-           {
-             "q" : {
-                "_id": {
-                    "$oid": "650965b2653077b4a74fd34d"
-                }
-             },
-             "limit" : 1
-           }
-        ]
-     }
-]

+ 0 - 15
pack-moutai/mongo-migrations/2_roles.up.json

@@ -1,15 +0,0 @@
-[
-    {
-        "insert": "roles",
-        "documents": [
-            {
-                "_id": {
-                    "$oid": "650965b2653077b4a74fd34d"
-                },
-                "name": "管理员",
-                "updateTime": "2024-10-15T08:47:05.583Z",
-                "createTime": "2024-10-15T08:47:05.583Z"
-            }
-        ]
-    }
-]

+ 0 - 172
src/api/api.http

@@ -1,172 +0,0 @@
-@host = 192.168.110.131:8086/moutai
-
-
-# 角色管理
-
-### 
-# 新增角色
-POST http://{{host}}/admin/role/create HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer xxx
-
-{
-    "name": "管理员"
-}
-
-### 
-# 删除角色
-POST http://{{host}}/admin/role/delete/:id HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer xxx
-
-
-### 
-# 角色列表
-GET http://{{host}}/admin/role/list HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer xxx
-
-### 
-# 更新角色
-GET http://{{host}}/admin/role/update HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer xxx
-
-{
-	"_id": "xxx",
-    "name": "管理员"
-}
-
-
-
-# 用户管理
-
-### 
-# 用户登录
-POST http://{{host}}/user/login/password HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer xxx
-
-{
-    "loginName": "zhangsan",
-    "password": "123456"
-}
-
-### 
-# 创建用户
-POST http://{{host}}/admin/user/create HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer xxx
-
-{
-    "name": "名字",
-    "loginName": "xxx",
-    "password": "xxx",
-    "avatar": "xxx.png",
-    "roleId": "xxx"
-}
-
-### 
-# 用户详情,自己
-GET http://{{host}}/user/profile HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer xxx
-
-
-### 
-# 删除用户
-POST http://{{host}}/admin/user/delete/:id HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer xxx
-
-### 
-# 禁用用户
-POST http://{{host}}/admin/user/disable/:id HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer xxx
-
-### 
-# 取消禁用
-POST http://{{host}}/admin/user/enable/:id HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer xxx
-
-
-### 
-# 用户列表
-GET http://{{host}}/admin/user/list?page=1&size=10&query={} HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer xxx
-
-### 
-# 编辑用户
-POST http://{{host}}/admin/user/update HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer xxx
-
-{
-    "_id": "xxx",
-    "name": "名字",
-    "loginName": "xxx",
-    "password": "xxx",
-    "avatar": "xxx.png",
-    "roleId": "xxx"
-}
-
-# 分类管理
-
-### 
-# 新增分类
-POST http://{{host}}/admin/cate/create HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer xxx
-
-{
-    "name": "xxx",
-    "type": "xxx",
-}
-
-### 
-# 删除分类
-POST http://{{host}}/admin/cate/delete/:id HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer xxx
-
-
-### 
-# 分类列表
-GET http://{{host}}/admin/cate/list HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer xxx
-
-### 
-# 更新分类
-GET http://{{host}}/admin/cate/update HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer xxx
-
-{
-	"_id": "xxx",
-    "name": "管理员",
-    "type": "xx"
-}
-
-
-# 首页内容
-
-### 
-# 首页内容详情
-POST http://{{host}}/admin/home/detail HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer xxx
-
-
-### 
-# 首页内容发布
-POST http://{{host}}/admin/home/content HTTP/1.1
-Content-Type: application/json
-Authorization: Bearer xxx
-
-{
-    "content": "xxxx"
-}

+ 0 - 5
src/api/cate.go

@@ -19,7 +19,6 @@ func CategoryCreate(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	if err != nil {
 		return nil, err
 	}
-	category.TypeId = -1
 	category.CreateTime = time.Now()
 	category.UpdateTime = time.Now()
 	return repo.RepoAddDoc(apictx.CreateRepoCtx(), repo.CollectionCategories, &category)
@@ -38,10 +37,6 @@ func DeleteCategory(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 // CategoryList 获取分类列表
 func CategoryList(c *gin.Context, apictx *ApiSession) (interface{}, error) {
 	page, size, query := UtilQueryPageSize(c)
-	if _, ok := query["type"]; !ok {
-		query["typeId"] = -1
-	}
-
 	return repo.RepoPageSearch(apictx.CreateRepoCtx(), &repo.PageSearchOptions{
 		CollectName: repo.CollectionCategories,
 		Page:        page,

+ 0 - 76
src/db/model/material.go

@@ -1,76 +0,0 @@
-package model
-
-import (
-	"time"
-
-	"go.mongodb.org/mongo-driver/bson/primitive"
-)
-
-// ImageFormat represents the image format information
-type ImageFormat struct {
-	Ext         string  `bson:"ext,omitempty" json:"ext,omitempty"`
-	URL         string  `bson:"url,omitempty" json:"url,omitempty"`
-	Hash        string  `bson:"hash,omitempty" json:"hash,omitempty"`
-	Mime        string  `bson:"mime,omitempty" json:"mime,omitempty"`
-	Name        string  `bson:"name,omitempty" json:"name,omitempty"`
-	Path        *string `bson:"path,omitempty" json:"path,omitempty"`
-	Size        float64 `bson:"size,omitempty" json:"size,omitempty"`
-	Width       int     `bson:"width,omitempty" json:"width,omitempty"`
-	Height      int     `bson:"height,omitempty" json:"height,omitempty"`
-	SizeInBytes int     `bson:"size_in_bytes,omitempty" json:"sizeInBytes,omitempty"`
-}
-
-// Formats represents different sizes of image formats
-type Formats struct {
-	Large     *ImageFormat `bson:"large,omitempty" json:"large,omitempty"`
-	Small     *ImageFormat `bson:"small,omitempty" json:"small,omitempty"`
-	Medium    *ImageFormat `bson:"medium,omitempty" json:"medium,omitempty"`
-	Thumbnail *ImageFormat `bson:"thumbnail,omitempty" json:"thumbnail,omitempty"`
-}
-
-// ImageAttributes represents the image attributes
-type ImageAttributes struct {
-	Name             string    `bson:"name,omitempty" json:"name,omitempty"`
-	AlternativeText  *string   `bson:"alternative_text,omitempty" json:"alternativeText,omitempty"`
-	Caption          *string   `bson:"caption,omitempty" json:"caption,omitempty"`
-	Width            int       `bson:"width,omitempty" json:"width,omitempty"`
-	Height           int       `bson:"height,omitempty" json:"height,omitempty"`
-	Formats          Formats   `bson:"formats,omitempty" json:"formats,omitempty"`
-	Hash             string    `bson:"hash,omitempty" json:"hash,omitempty"`
-	Ext              string    `bson:"ext,omitempty" json:"ext,omitempty"`
-	Mime             string    `bson:"mime,omitempty" json:"mime,omitempty"`
-	Size             float64   `bson:"size,omitempty" json:"size,omitempty"`
-	URL              string    `bson:"url,omitempty" json:"url,omitempty"`
-	PreviewURL       *string   `bson:"preview_url,omitempty" json:"previewUrl,omitempty"`
-	Provider         string    `bson:"provider,omitempty" json:"provider,omitempty"`
-	ProviderMetadata *string   `bson:"provider_metadata,omitempty" json:"provider_metadata,omitempty"`
-	CreatedAt        time.Time `bson:"created_at,omitempty" json:"createdAt,omitempty"`
-	UpdatedAt        time.Time `bson:"updated_at,omitempty" json:"updatedAt,omitempty"`
-}
-
-// ImageData represents the image data structure
-type ImageData struct {
-	ID         int             `bson:"id,omitempty" json:"id,omitempty"`
-	Attributes ImageAttributes `bson:"attributes,omitempty" json:"attributes,omitempty"`
-}
-
-// Image represents the image wrapper structure
-type Image struct {
-	Data ImageData `bson:"data,omitempty" json:"data,omitempty"`
-}
-
-// Background represents the background material model that exactly matches the JSON structure
-type Material struct {
-	Id         primitive.ObjectID `bson:"_id,omitempty" json:"_id,omitempty"`
-	Cid        primitive.ObjectID `bson:"cid,omitempty" json:"cid,omitempty"`
-	ID         int                `bson:"id,omitempty" json:"id,omitempty"`
-	Type       int                `bson:"type,omitempty" json:"type,omitempty"`
-	Attributes struct {
-		Name        string    `bson:"name,omitempty" json:"name,omitempty"`
-		Desc        *string   `bson:"desc,omitempty" json:"desc,omitempty"`
-		CreatedAt   time.Time `bson:"created_at,omitempty" json:"createdAt,omitempty"`
-		UpdatedAt   time.Time `bson:"updated_at,omitempty" json:"updatedAt,omitempty"`
-		PublishedAt time.Time `bson:"published_at,omitempty" json:"publishedAt,omitempty"`
-		Img         Image     `bson:"img,omitempty" json:"img,omitempty"`
-	} `bson:"attributes,omitempty" json:"attributes,omitempty"`
-}

+ 0 - 1
src/main.go

@@ -32,7 +32,6 @@ func BuildApp() *dig.Container {
 }
 
 func main() {
-	comm.AppMongoMiration()
 	flag.Parse()
 	app := BuildApp()
 	err := app.Invoke(func(svc *api.Service, bus *comm.NatsBus) error {