Skip to content

BillionMail gives you open-source MailServer, NewsLetter, Email Marketing — fully self-hosted, dev-friendly, and free from monthly fees. Join the discord: https://discord.gg/asfXzBUhZr

Add Authorization header to various request types

lotka4feace097d5
diff --git a/core/api/askai/v1/chat.go b/core/api/askai/v1/chat.go
index 70ec6172..b591a6b9 100644
--- a/core/api/askai/v1/chat.go
+++ b/core/api/askai/v1/chat.go
@@ -7,10 +7,11 @@ import (
)
type CreateChatReq struct {
- g.Meta `path:"/askai/chat/create_chat" method:"post" tags:"AskAi" summary:"create chat"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
- AddType int `json:"add_type" dc:"add type" v:"required#add type is required"` // 1: add chat, 2: add knowledge base file
- TempName string `json:"temp_name" dc:"temporary name" v:"required#temporary name is required"` // Temporary name for the chat or knowledge base file
+ g.Meta `path:"/askai/chat/create_chat" method:"post" tags:"AskAi" summary:"create chat"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ AddType int `json:"add_type" dc:"add type" v:"required#add type is required"` // 1: add chat, 2: add knowledge base file
+ TempName string `json:"temp_name" dc:"temporary name" v:"required#temporary name is required"` // Temporary name for the chat or knowledge base file
}
type CreateChatRes struct {
@@ -18,7 +19,8 @@ type CreateChatRes struct {
}
type GetChatListReq struct {
- g.Meta `path:"/askai/chat/get_chat_list" method:"post" tags:"AskAi" summary:"get chat list"`
+ g.Meta `path:"/askai/chat/get_chat_list" method:"post" tags:"AskAi" summary:"get chat list"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
}
type GetChatListRes struct {
@@ -27,8 +29,9 @@ type GetChatListRes struct {
// InfoReq is the request structure for retrieving chat information in AskAi.
type InfoReq struct {
- g.Meta `path:"/askai/chat/info" method:"post" tags:"AskAi" summary:"get chat info"`
- ChatId string `json:"chatId" dc:"chat id" v:"required#chat id is required"`
+ g.Meta `path:"/askai/chat/info" method:"post" tags:"AskAi" summary:"get chat info"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ ChatId string `json:"chatId" dc:"chat id" v:"required#chat id is required"`
}
type InfoRes struct {
@@ -37,20 +40,22 @@ type InfoRes struct {
// ChatReq is the request structure for sending a chat message in AskAi.
type ChatReq struct {
- g.Meta `path:"/askai/chat/chat" method:"post,get" tags:"AskAi" summary:"send chat message"`
- ChatId string `json:"chatId" dc:"chat id" v:"required#chat id is required"`
- SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
- ModelId string `json:"model_id" dc:"model id" v:"required#model id is required"`
- Content string `json:"content" dc:"content" v:"required#content is required"`
- IsText bool `json:"is_text" dc:"is text"` // true: text, false: json
+ g.Meta `path:"/askai/chat/chat" method:"post,get" tags:"AskAi" summary:"send chat message"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ ChatId string `json:"chatId" dc:"chat id" v:"required#chat id is required"`
+ SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
+ ModelId string `json:"model_id" dc:"model id" v:"required#model id is required"`
+ Content string `json:"content" dc:"content" v:"required#content is required"`
+ IsText bool `json:"is_text" dc:"is text"` // true: text, false: json
}
type ChatRes struct {
api_v1.StandardRes
}
type RemoveChatReq struct {
- g.Meta `path:"/askai/chat/remove_chat" method:"post" tags:"AskAi" summary:"remove chat"`
- ChatId string `json:"chatId" dc:"chat id" v:"required#chat id is required"`
+ g.Meta `path:"/askai/chat/remove_chat" method:"post" tags:"AskAi" summary:"remove chat"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ ChatId string `json:"chatId" dc:"chat id" v:"required#chat id is required"`
}
type RemoveChatRes struct {
api_v1.StandardRes
@@ -58,8 +63,9 @@ type RemoveChatRes struct {
// StopReq is the request structure for stopping a chat in AskAi.
type StopReq struct {
- g.Meta `path:"/askai/chat/stop" method:"post" tags:"AskAi" summary:"stop chat"`
- ChatId string `json:"chatId" dc:"chat id" v:"required#chat id is required"`
+ g.Meta `path:"/askai/chat/stop" method:"post" tags:"AskAi" summary:"stop chat"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ ChatId string `json:"chatId" dc:"chat id" v:"required#chat id is required"`
}
type StopRes struct {
api_v1.StandardRes
@@ -67,8 +73,9 @@ type StopRes struct {
// GetHtmlReq is the request structure for retrieving HTML content in AskAi.
type GetHtmlReq struct {
- g.Meta `path:"/askai/chat/get_html" method:"post" tags:"AskAi" summary:"get html content"`
- ChatId string `json:"chatId" dc:"chat id" v:"required#chat id is required"`
+ g.Meta `path:"/askai/chat/get_html" method:"post" tags:"AskAi" summary:"get html content"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ ChatId string `json:"chatId" dc:"chat id" v:"required#chat id is required"`
}
type GetHtmlRes struct {
api_v1.StandardRes
@@ -76,9 +83,10 @@ type GetHtmlRes struct {
// ModifyHtmlReq is the request structure for modifying HTML content in AskAi.
type ModifyHtmlReq struct {
- g.Meta `path:"/askai/chat/modify_html" method:"post" tags:"AskAi" summary:"modify html content"`
- ChatId string `json:"chatId" dc:"chat id" v:"required#chat id is required"`
- Content string `json:"content" dc:"content" v:"required#content is required"`
+ g.Meta `path:"/askai/chat/modify_html" method:"post" tags:"AskAi" summary:"modify html content"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ ChatId string `json:"chatId" dc:"chat id" v:"required#chat id is required"`
+ Content string `json:"content" dc:"content" v:"required#content is required"`
}
type ModifyHtmlRes struct {
api_v1.StandardRes
@@ -86,9 +94,10 @@ type ModifyHtmlRes struct {
// CopyChatReq is the request structure for copying a chat in AskAi.
type CopyChatReq struct {
- g.Meta `path:"/askai/chat/copy_chat" method:"post" tags:"AskAi" summary:"copy chat"`
- ChatId string `json:"chatId" dc:"chat id" v:"required#chat id is required"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ g.Meta `path:"/askai/chat/copy_chat" method:"post" tags:"AskAi" summary:"copy chat"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ ChatId string `json:"chatId" dc:"chat id" v:"required#chat id is required"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
}
type CopyChatRes struct {
diff --git a/core/api/askai/v1/project.go b/core/api/askai/v1/project.go
index 6f539b6c..a4e82f94 100644
--- a/core/api/askai/v1/project.go
+++ b/core/api/askai/v1/project.go
@@ -8,9 +8,10 @@ import (
// CreateReq is the request structure for creating a new project configuration in AskAi.
type CreateReq struct {
- g.Meta `path:"/askai/project/create" method:"post" tags:"AskAi" summary:"create project config"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
- Urls []string `json:"urls" dc:"urls"`
+ g.Meta `path:"/askai/project/create" method:"post" tags:"AskAi" summary:"create project config"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ Urls []string `json:"urls" dc:"urls"`
}
type CreateRes struct {
api_v1.StandardRes
@@ -18,8 +19,9 @@ type CreateRes struct {
// GetBaseInfoReq is the request structure for retrieving the base information of a project in AskAi.
type GetBaseInfoReq struct {
- g.Meta `path:"/askai/project/get_base_info" method:"post" tags:"AskAi" summary:"get project base info"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ g.Meta `path:"/askai/project/get_base_info" method:"post" tags:"AskAi" summary:"get project base info"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
}
type GetBaseInfoRes struct {
api_v1.StandardRes
@@ -28,6 +30,7 @@ type GetBaseInfoRes struct {
// ModifyBaseInfoReq is the request structure for modifying the base information of a project in AskAi.
type ModifyBaseInfoReq struct {
g.Meta `path:"/askai/project/modify_base_info" method:"post" tags:"AskAi" summary:"modify project base info"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
ProjectName string `json:"project_name" dc:"project name" v:"required#project name is required"`
Description string `json:"description" dc:"project description"`
@@ -43,11 +46,12 @@ type ModifyBaseInfoRes struct {
// ModifyKnowledgeBaseFileReq is the request structure for modifying a knowledge base file in AskAi.
type ModifyKnowledgeBaseFileReq struct {
- g.Meta `path:"/askai/project/modify_knowledge_base_file" method:"post" tags:"AskAi" summary:"modify knowledge base file"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
- Kid string `json:"kid" dc:"knowledge base file id" v:"required#knowledge base file id is required"`
- Title string `json:"title" dc:"title" v:"required#title is required"`
- Content string `json:"content" dc:"content" v:"required#content is required"`
+ g.Meta `path:"/askai/project/modify_knowledge_base_file" method:"post" tags:"AskAi" summary:"modify knowledge base file"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ Kid string `json:"kid" dc:"knowledge base file id" v:"required#knowledge base file id is required"`
+ Title string `json:"title" dc:"title" v:"required#title is required"`
+ Content string `json:"content" dc:"content" v:"required#content is required"`
}
type ModifyKnowledgeBaseFileRes struct {
api_v1.StandardRes
@@ -55,10 +59,11 @@ type ModifyKnowledgeBaseFileRes struct {
// CreateKnowledgeBaseFileReq is the request structure for creating a new knowledge base file in AskAi.
type CreateKnowledgeBaseFileReq struct {
- g.Meta `path:"/askai/project/create_knowledge_base_file" method:"post" tags:"AskAi" summary:"create knowledge base file"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
- Title string `json:"title" dc:"title" v:"required#title is required"`
- Content string `json:"content" dc:"content" v:"required#content is required"`
+ g.Meta `path:"/askai/project/create_knowledge_base_file" method:"post" tags:"AskAi" summary:"create knowledge base file"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ Title string `json:"title" dc:"title" v:"required#title is required"`
+ Content string `json:"content" dc:"content" v:"required#content is required"`
}
type CreateKnowledgeBaseFileRes struct {
api_v1.StandardRes
@@ -66,9 +71,10 @@ type CreateKnowledgeBaseFileRes struct {
// RemoveKnowledgeBaseFileReq is the request structure for removing a knowledge base file in AskAi.
type RemoveKnowledgeBaseFileReq struct {
- g.Meta `path:"/askai/project/remove_knowledge_base_file" method:"post" tags:"AskAi" summary:"remove knowledge base file"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
- Kid string `json:"kid" dc:"knowledge base file id" v:"required#knowledge base file id is required"`
+ g.Meta `path:"/askai/project/remove_knowledge_base_file" method:"post" tags:"AskAi" summary:"remove knowledge base file"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ Kid string `json:"kid" dc:"knowledge base file id" v:"required#knowledge base file id is required"`
}
type RemoveKnowledgeBaseFileRes struct {
api_v1.StandardRes
@@ -76,8 +82,9 @@ type RemoveKnowledgeBaseFileRes struct {
// GetCompanyProfileReq is the request structure for retrieving the company profile in AskAi.
type GetCompanyProfileReq struct {
- g.Meta `path:"/askai/project/get_company_profile" method:"post" tags:"AskAi" summary:"get company profile"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ g.Meta `path:"/askai/project/get_company_profile" method:"post" tags:"AskAi" summary:"get company profile"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
}
type GetCompanyProfileRes struct {
api_v1.StandardRes
@@ -86,6 +93,7 @@ type GetCompanyProfileRes struct {
// ModifyCompanyProfileReq is the request structure for modifying the company profile in AskAi.
type ModifyCompanyProfileReq struct {
g.Meta `path:"/askai/project/modify_company_profile" method:"post" tags:"AskAi" summary:"modify company profile"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
LegalCompanyName string `json:"legal_company_name" dc:"legal company name"`
Website string `json:"website" dc:"website"`
@@ -101,8 +109,9 @@ type ModifyCompanyProfileRes struct {
// GetStyleConfigReq is the request structure for retrieving the style configuration of a project in AskAi.
type GetStyleConfigReq struct {
- g.Meta `path:"/askai/project/get_style_config" method:"post" tags:"AskAi" summary:"get style config"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ g.Meta `path:"/askai/project/get_style_config" method:"post" tags:"AskAi" summary:"get style config"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
}
type GetStyleConfigRes struct {
@@ -112,6 +121,7 @@ type GetStyleConfigRes struct {
// ModifyStyleConfigReq is the request structure for modifying the style configuration of a project in AskAi.
type ModifyStyleConfigReq struct {
g.Meta `path:"/askai/project/modify_style_config" method:"post" tags:"AskAi" summary:"modify style config"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
AccentColor string `json:"accent_color" dc:"accent color"`
TextColor string `json:"text_color" dc:"text color"`
@@ -128,8 +138,9 @@ type ModifyStyleConfigRes struct {
// GetSitemapReq is the request structure for retrieving the sitemap of a project in AskAi.
type GetSitemapReq struct {
- g.Meta `path:"/askai/project/get_sitemap" method:"post" tags:"AskAi" summary:"get sitemap"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ g.Meta `path:"/askai/project/get_sitemap" method:"post" tags:"AskAi" summary:"get sitemap"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
}
type GetSitemapRes struct {
api_v1.StandardRes
@@ -137,9 +148,10 @@ type GetSitemapRes struct {
// RemoveSitemapNodeReq is the request structure for removing a node from the sitemap of a project in AskAi.
type RemoveSitemapNodeReq struct {
- g.Meta `path:"/askai/project/remove_sitemap_node" method:"post" tags:"AskAi" summary:"remove sitemap node"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
- UriPath string `json:"uri_path" dc:"uri path" v:"required#uri path is required"`
+ g.Meta `path:"/askai/project/remove_sitemap_node" method:"post" tags:"AskAi" summary:"remove sitemap node"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ UriPath string `json:"uri_path" dc:"uri path" v:"required#uri path is required"`
}
type RemoveSitemapNodeRes struct {
@@ -148,10 +160,11 @@ type RemoveSitemapNodeRes struct {
// AddSitemapNodeReq is the request structure for adding a node to the sitemap of a project in AskAi.
type AddSitemapNodeReq struct {
- g.Meta `path:"/askai/project/add_sitemap_node" method:"post" tags:"AskAi" summary:"add sitemap node"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
- Title string `json:"title" dc:"title" v:"required#title is required"`
- UriPath string `json:"uri_path" dc:"uri path" v:"required#uri path is required"`
+ g.Meta `path:"/askai/project/add_sitemap_node" method:"post" tags:"AskAi" summary:"add sitemap node"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ Title string `json:"title" dc:"title" v:"required#title is required"`
+ UriPath string `json:"uri_path" dc:"uri path" v:"required#uri path is required"`
}
type AddSitemapNodeRes struct {
api_v1.StandardRes
@@ -159,8 +172,9 @@ type AddSitemapNodeRes struct {
// GetFooterReq is the request structure for retrieving the footer configuration of a project in AskAi.
type GetFooterReq struct {
- g.Meta `path:"/askai/project/get_footer" method:"post" tags:"AskAi" summary:"get footer config"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ g.Meta `path:"/askai/project/get_footer" method:"post" tags:"AskAi" summary:"get footer config"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
}
type GetFooterRes struct {
api_v1.StandardRes
@@ -169,6 +183,7 @@ type GetFooterRes struct {
// ModifyFooterReq is the request structure for modifying the footer configuration of a project in AskAi.
type ModifyFooterReq struct {
g.Meta `path:"/askai/project/modify_footer" method:"post" tags:"AskAi" summary:"modify footer config"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
CopyrightText string `json:"copyright_text" dc:"copyright text" v:"required#copyright text is required"`
Disclaimer string `json:"disclaimer" dc:"disclaimer" v:"required#disclaimer is required"`
@@ -179,8 +194,9 @@ type ModifyFooterRes struct {
// GetPromptReq is the request structure for retrieving the prompt configuration of a project in AskAi.
type GetPromptReq struct {
- g.Meta `path:"/askai/project/get_prompt" method:"post" tags:"AskAi" summary:"get prompt config"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ g.Meta `path:"/askai/project/get_prompt" method:"post" tags:"AskAi" summary:"get prompt config"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
}
type GetPromptRes struct {
api_v1.StandardRes
@@ -188,9 +204,10 @@ type GetPromptRes struct {
// ModifyPromptReq is the request structure for modifying the prompt configuration of a project in AskAi.
type ModifyPromptReq struct {
- g.Meta `path:"/askai/project/modify_prompt" method:"post" tags:"AskAi" summary:"modify prompt config"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
- Prompt string `json:"prompt" dc:"prompt" v:"required#prompt is required"`
+ g.Meta `path:"/askai/project/modify_prompt" method:"post" tags:"AskAi" summary:"modify prompt config"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ Prompt string `json:"prompt" dc:"prompt" v:"required#prompt is required"`
}
type ModifyPromptRes struct {
api_v1.StandardRes
@@ -198,12 +215,13 @@ type ModifyPromptRes struct {
// UploadImageReq is the request structure for uploading an image to a project in AskAi.
type UploadImageReq struct {
- g.Meta `path:"/askai/project/upload_image" method:"post" tags:"AskAi" summary:"upload image"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
- Image string `json:"image" dc:"image" v:"required#image is required"`
- Filename string `json:"filename" dc:"filename" v:"required#filename is required"`
- AltText string `json:"alt_text" dc:"alt text" v:"required#alt text is required"`
- ImageTag string `json:"image_tag" dc:"image tag" v:"required#image tag is required" d:"Image tag is used to identify the image in the project, e.g., 'logo', 'banner', etc."`
+ g.Meta `path:"/askai/project/upload_image" method:"post" tags:"AskAi" summary:"upload image"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ Image string `json:"image" dc:"image" v:"required#image is required"`
+ Filename string `json:"filename" dc:"filename" v:"required#filename is required"`
+ AltText string `json:"alt_text" dc:"alt text" v:"required#alt text is required"`
+ ImageTag string `json:"image_tag" dc:"image tag" v:"required#image tag is required" d:"Image tag is used to identify the image in the project, e.g., 'logo', 'banner', etc."`
}
type UploadImageRes struct {
@@ -212,11 +230,12 @@ type UploadImageRes struct {
// ModifyImageReq is the request structure for modifying an existing image in a project in AskAi.
type ModifyImageReq struct {
- g.Meta `path:"/askai/project/modify_image" method:"post" tags:"AskAi" summary:"modify image"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
- ImageId string `json:"image_id" dc:"image id" v:"required#image id is required"`
- AltText string `json:"alt_text" dc:"alt text" v:"required#alt text is required"`
- ImageTag string `json:"image_tag" dc:"image tag" v:"required#image tag is required" d:"Image tag is used to identify the image in the project, e.g., 'logo', 'banner', etc."`
+ g.Meta `path:"/askai/project/modify_image" method:"post" tags:"AskAi" summary:"modify image"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ ImageId string `json:"image_id" dc:"image id" v:"required#image id is required"`
+ AltText string `json:"alt_text" dc:"alt text" v:"required#alt text is required"`
+ ImageTag string `json:"image_tag" dc:"image tag" v:"required#image tag is required" d:"Image tag is used to identify the image in the project, e.g., 'logo', 'banner', etc."`
}
type ModifyImageRes struct {
api_v1.StandardRes
@@ -224,9 +243,10 @@ type ModifyImageRes struct {
// RemoveImageReq is the request structure for removing an image from a project in AskAi.
type RemoveImageReq struct {
- g.Meta `path:"/askai/project/remove_image" method:"post" tags:"AskAi" summary:"remove image"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
- ImageId string `json:"image_id" dc:"image id" v:"required#image id is required"`
+ g.Meta `path:"/askai/project/remove_image" method:"post" tags:"AskAi" summary:"remove image"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ ImageId string `json:"image_id" dc:"image id" v:"required#image id is required"`
}
type RemoveImageRes struct {
@@ -235,8 +255,9 @@ type RemoveImageRes struct {
// GetImagesReq is the request structure for retrieving images associated with a project in AskAi.
type GetImagesReq struct {
- g.Meta `path:"/askai/project/get_images" method:"post" tags:"AskAi" summary:"get images"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ g.Meta `path:"/askai/project/get_images" method:"post" tags:"AskAi" summary:"get images"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
}
type GetImagesRes struct {
@@ -245,8 +266,9 @@ type GetImagesRes struct {
// GetProjectStatusReq is the request structure for retrieving the status of a project in AskAi.
type GetProjectStatusReq struct {
- g.Meta `path:"/askai/project/get_project_status" method:"post" tags:"AskAi" summary:"get project status"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ g.Meta `path:"/askai/project/get_project_status" method:"post" tags:"AskAi" summary:"get project status"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
}
type GetProjectStatusRes struct {
api_v1.StandardRes
@@ -254,9 +276,10 @@ type GetProjectStatusRes struct {
// SetProjectStatusReq is the request structure for setting the status of a project in AskAi.
type SetProjectStatusReq struct {
- g.Meta `path:"/askai/project/set_project_status" method:"post" tags:"AskAi" summary:"set project status"`
- Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
- Status bool `json:"status" dc:"status" v:"required#status is required"`
+ g.Meta `path:"/askai/project/set_project_status" method:"post" tags:"AskAi" summary:"set project status"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" dc:"domain" v:"required#domain is required"`
+ Status bool `json:"status" dc:"status" v:"required#status is required"`
}
type SetProjectStatusRes struct {
diff --git a/core/api/askai/v1/supplier.go b/core/api/askai/v1/supplier.go
index 8fca32f1..302f89ca 100644
--- a/core/api/askai/v1/supplier.go
+++ b/core/api/askai/v1/supplier.go
@@ -17,8 +17,9 @@ type ListRes struct {
// ModelsReq is the request structure for listing AI models of a specific supplier.
type ModelsReq struct {
- g.Meta `path:"/askai/supplier/models" method:"get,post" tags:"AskAi" summary:"list ai models"`
- SupplierName string `json:"supplier_name" dc:"supplier name"`
+ g.Meta `path:"/askai/supplier/models" method:"get,post" tags:"AskAi" summary:"list ai models"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ SupplierName string `json:"supplier_name" dc:"supplier name"`
}
type ModelsRes struct {
@@ -27,12 +28,13 @@ type ModelsRes struct {
// AddModelReq is the request structure for adding a new AI model to a supplier.
type AddModelReq struct {
- g.Meta `path:"/askai/supplier/add_model" method:"post" tags:"AskAi" summary:"add ai model"`
- SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
- Title string `json:"title" dc:"model title" v:"required#model title is required"`
- ModelId string `json:"model_id" dc:"model id" v:"required#model id is required"`
- MaxTokens int `json:"max_tokens" dc:"max tokens" v:"required#max tokens is required"`
- Capability []string `json:"capability" dc:"capability" v:"required#capability is required"`
+ g.Meta `path:"/askai/supplier/add_model" method:"post" tags:"AskAi" summary:"add ai model"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
+ Title string `json:"title" dc:"model title" v:"required#model title is required"`
+ ModelId string `json:"model_id" dc:"model id" v:"required#model id is required"`
+ MaxTokens int `json:"max_tokens" dc:"max tokens" v:"required#max tokens is required"`
+ Capability []string `json:"capability" dc:"capability" v:"required#capability is required"`
}
type AddModelRes struct {
@@ -41,9 +43,10 @@ type AddModelRes struct {
// RemoveModelReq is the request structure for removing an AI model from a supplier.
type RemoveModelReq struct {
- g.Meta `path:"/askai/supplier/remove_model" method:"post" tags:"AskAi" summary:"remove ai model"`
- SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
- ModelId string `json:"model_id" dc:"model id" v:"required#model id is required"`
+ g.Meta `path:"/askai/supplier/remove_model" method:"post" tags:"AskAi" summary:"remove ai model"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
+ ModelId string `json:"model_id" dc:"model id" v:"required#model id is required"`
}
type RemoveModelRes struct {
@@ -52,10 +55,11 @@ type RemoveModelRes struct {
// SetSupplierConfigReq is the request structure for setting the configuration of an AI model supplier.
type SetSupplierConfigReq struct {
- g.Meta `path:"/askai/supplier/set_supplier_config" method:"post" tags:"AskAi" summary:"set supplier config"`
- SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
- BaseUrl string `json:"base_url" dc:"base url" v:"required#base url is required"`
- ApiKey string `json:"api_key" dc:"api key" v:"required#api key is required"`
+ g.Meta `path:"/askai/supplier/set_supplier_config" method:"post" tags:"AskAi" summary:"set supplier config"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
+ BaseUrl string `json:"base_url" dc:"base url" v:"required#base url is required"`
+ ApiKey string `json:"api_key" dc:"api key" v:"required#api key is required"`
}
type SetSupplierConfigRes struct {
@@ -64,10 +68,11 @@ type SetSupplierConfigRes struct {
// TestingReq is the request structure for testing the configuration of an AI model supplier.
type TestingReq struct {
- g.Meta `path:"/askai/supplier/testing" method:"post" tags:"AskAi" summary:"test supplier config"`
- SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
- BaseUrl string `json:"base_url" dc:"base url" v:"required#base url is required"`
- ApiKey string `json:"api_key" dc:"api key" v:"required#api key is required"`
+ g.Meta `path:"/askai/supplier/testing" method:"post" tags:"AskAi" summary:"test supplier config"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
+ BaseUrl string `json:"base_url" dc:"base url" v:"required#base url is required"`
+ ApiKey string `json:"api_key" dc:"api key" v:"required#api key is required"`
}
type TestingRes struct {
api_v1.StandardRes
@@ -75,8 +80,9 @@ type TestingRes struct {
// GetSupplierConfigReq is the request structure for retrieving the configuration of an AI model supplier.
type GetSupplierConfigReq struct {
- g.Meta `path:"/askai/supplier/get_supplier_config" method:"post" tags:"AskAi" summary:"get supplier config"`
- SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
+ g.Meta `path:"/askai/supplier/get_supplier_config" method:"post" tags:"AskAi" summary:"get supplier config"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
}
type GetSupplierConfigRes struct {
@@ -85,9 +91,10 @@ type GetSupplierConfigRes struct {
// SetSupplierStatusReq is the request structure for setting the status of an AI model supplier.
type SetSupplierStatusReq struct {
- g.Meta `path:"/askai/supplier/set_supplier_status" method:"post" tags:"AskAi" summary:"set supplier status"`
- SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
- Status bool `json:"status" dc:"status" v:"required#status is required"`
+ g.Meta `path:"/askai/supplier/set_supplier_status" method:"post" tags:"AskAi" summary:"set supplier status"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
+ Status bool `json:"status" dc:"status" v:"required#status is required"`
}
type SetSupplierStatusRes struct {
@@ -96,10 +103,11 @@ type SetSupplierStatusRes struct {
// SetModelStatusReq is the request structure for setting the status of an AI model.
type SetModelStatusReq struct {
- g.Meta `path:"/askai/supplier/set_model_status" method:"post" tags:"AskAi" summary:"set model status"`
- SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
- ModelId string `json:"model_id" dc:"model id" v:"required#model id is required"`
- Status bool `json:"status" dc:"status" v:"required#status is required"`
+ g.Meta `path:"/askai/supplier/set_model_status" method:"post" tags:"AskAi" summary:"set model status"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
+ ModelId string `json:"model_id" dc:"model id" v:"required#model id is required"`
+ Status bool `json:"status" dc:"status" v:"required#status is required"`
}
type SetModelStatusRes struct {
api_v1.StandardRes
@@ -108,6 +116,7 @@ type SetModelStatusRes struct {
// AddSupplierReq is the request structure for adding a new AI supplier.
type AddSupplierReq struct {
g.Meta `path:"/askai/supplier/add_supplier" method:"post" tags:"AskAi" summary:"add ai supplier"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
SupplierTitle string `json:"supplier_title" dc:"supplier title" v:"required#supplier title is required"`
SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
BaseUrl string `json:"base_url" dc:"base url" v:"required#base url is required"`
@@ -120,8 +129,9 @@ type AddSupplierRes struct {
// RemoveSupplierReq is the request structure for removing an AI supplier.
type RemoveSupplierReq struct {
- g.Meta `path:"/askai/supplier/remove_supplier" method:"post" tags:"AskAi" summary:"remove ai supplier"`
- SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
+ g.Meta `path:"/askai/supplier/remove_supplier" method:"post" tags:"AskAi" summary:"remove ai supplier"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
}
type RemoveSupplierRes struct {
@@ -130,10 +140,11 @@ type RemoveSupplierRes struct {
// SetModelTitleReq is the request structure for setting the title of an AI model.
type SetModelTitleReq struct {
- g.Meta `path:"/askai/supplier/set_model_title" method:"post" tags:"AskAi" summary:"set model title"`
- SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
- ModelId string `json:"model_id" dc:"model id" v:"required#model id is required"`
- Title string `json:"title" dc:"title" v:"required#title is required"`
+ g.Meta `path:"/askai/supplier/set_model_title" method:"post" tags:"AskAi" summary:"set model title"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
+ ModelId string `json:"model_id" dc:"model id" v:"required#model id is required"`
+ Title string `json:"title" dc:"title" v:"required#title is required"`
}
type SetModelTitleRes struct {
@@ -142,10 +153,11 @@ type SetModelTitleRes struct {
// SetModelCapabilityReq is the request structure for setting the capabilities of an AI model.
type SetModelCapabilityReq struct {
- g.Meta `path:"/askai/supplier/set_model_capability" method:"post" tags:"AskAi" summary:"set model capability"`
- SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
- ModelId string `json:"model_id" dc:"model id" v:"required#model id is required"`
- Capability []string `json:"capability" dc:"capability" v:"required#capability is required" d:"llm,vision,tools,text-to-image"`
+ g.Meta `path:"/askai/supplier/set_model_capability" method:"post" tags:"AskAi" summary:"set model capability"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
+ ModelId string `json:"model_id" dc:"model id" v:"required#model id is required"`
+ Capability []string `json:"capability" dc:"capability" v:"required#capability is required" d:"llm,vision,tools,text-to-image"`
}
type SetModelCapabilityRes struct {
api_v1.StandardRes
@@ -153,12 +165,13 @@ type SetModelCapabilityRes struct {
// ModifyModelReq is the request structure for modifying an AI model's details.
type ModifyModelReq struct {
- g.Meta `path:"/askai/supplier/modify_model" method:"post" tags:"AskAi" summary:"modify model"`
- SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
- ModelId string `json:"model_id" dc:"model id" v:"required#model id is required"`
- MaxTokens int `json:"max_tokens" dc:"max tokens" v:"required#max tokens is required"`
- Capability []string `json:"capability" dc:"capability" v:"required#capability is required" d:"llm,vision,tools,text-to-image"`
- Title string `json:"title" dc:"title" v:"required#title is required"`
+ g.Meta `path:"/askai/supplier/modify_model" method:"post" tags:"AskAi" summary:"modify model"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ SupplierName string `json:"supplier_name" dc:"supplier name" v:"required#supplier name is required"`
+ ModelId string `json:"model_id" dc:"model id" v:"required#model id is required"`
+ MaxTokens int `json:"max_tokens" dc:"max tokens" v:"required#max tokens is required"`
+ Capability []string `json:"capability" dc:"capability" v:"required#capability is required" d:"llm,vision,tools,text-to-image"`
+ Title string `json:"title" dc:"title" v:"required#title is required"`
}
type ModifyModelRes struct {
@@ -167,7 +180,8 @@ type ModifyModelRes struct {
// StatusReq is the request structure for retrieving the status of an AI model supplier's configuration.
type StatusReq struct {
- g.Meta `path:"/askai/supplier/status" method:"get,post" tags:"AskAi" summary:"get supplier config status"`
+ g.Meta `path:"/askai/supplier/status" method:"get,post" tags:"AskAi" summary:"get supplier config status"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
}
type StatusRes struct {
api_v1.StandardRes
diff --git a/core/api/batch_mail/v1/api_mail.go b/core/api/batch_mail/v1/api_mail.go
index ed5b2848..6853e4f8 100644
--- a/core/api/batch_mail/v1/api_mail.go
+++ b/core/api/batch_mail/v1/api_mail.go
@@ -140,11 +140,12 @@ type ApiTemplatesDeleteRes struct {
}
type ApiMailSendReq struct {
- g.Meta `path:"/batch_mail/api/send" method:"post" tags:"ApiMail" summary:"call api send mail"`
- ApiKey string `json:"x-api-key" dc:"API Key" in:"header"`
- Addresser string `json:"addresser" dc:"addresser"`
- Recipient string `json:"recipient" dc:"recipient"`
- Attribs map[string]string `json:"attribs" dc:"Custom properties"`
+ g.Meta `path:"/batch_mail/api/send" method:"post" tags:"ApiMail" summary:"call api send mail"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ ApiKey string `json:"x-api-key" dc:"API Key" in:"header"`
+ Addresser string `json:"addresser" dc:"addresser"`
+ Recipient string `json:"recipient" dc:"recipient"`
+ Attribs map[string]string `json:"attribs" dc:"Custom properties"`
}
type ApiMailSendRes struct {
@@ -152,11 +153,12 @@ type ApiMailSendRes struct {
}
type ApiMailBatchSendReq struct {
- g.Meta `path:"/batch_mail/api/batch_send" method:"post" tags:"ApiMail" summary:"call api batch send mail"`
- ApiKey string `json:"x-api-key" dc:"API Key" in:"header"`
- Addresser string `json:"addresser" dc:"addresser"`
- Recipients []string `json:"recipients" dc:"recipients"`
- Attribs map[string]string `json:"attribs" dc:"Custom properties"`
+ g.Meta `path:"/batch_mail/api/batch_send" method:"post" tags:"ApiMail" summary:"call api batch send mail"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ ApiKey string `json:"x-api-key" dc:"API Key" in:"header"`
+ Addresser string `json:"addresser" dc:"addresser"`
+ Recipients []string `json:"recipients" dc:"recipients"`
+ Attribs map[string]string `json:"attribs" dc:"Custom properties"`
}
type ApiMailBatchSendRes struct {
diff --git a/core/api/batch_mail/v1/unsubscribe.go b/core/api/batch_mail/v1/unsubscribe.go
index 6cde6277..3baa6424 100644
--- a/core/api/batch_mail/v1/unsubscribe.go
+++ b/core/api/batch_mail/v1/unsubscribe.go
@@ -7,9 +7,10 @@ import (
// UnsubscribeReq defines the unsubscribe request parameters
type UnsubscribeReq struct {
- g.Meta `path:"/unsubscribe" method:"post" tags:"Unsubscribe" summary:"Unsubscribe from mailing lists"`
- Jwt string `json:"jwt" v:"required" dc:"JWT token containing unsubscribe information"`
- GroupId []int `json:"group_id" dc:"Group IDs to unsubscribe from (optional, if empty will unsubscribe from all groups)"`
+ g.Meta `path:"/unsubscribe" method:"post" tags:"Unsubscribe" summary:"Unsubscribe from mailing lists"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Jwt string `json:"jwt" v:"required" dc:"JWT token containing unsubscribe information"`
+ GroupId []int `json:"group_id" dc:"Group IDs to unsubscribe from (optional, if empty will unsubscribe from all groups)"`
}
// UnsubscribeRes defines the unsubscribe response
@@ -18,8 +19,9 @@ type UnsubscribeRes struct {
}
type GetUserGroupsReq struct {
- g.Meta `path:"/unsubscribe/user_group" method:"post" tags:"Unsubscribe" summary:"get user groups"`
- Email string `json:"email" dc:"user email"`
+ g.Meta `path:"/unsubscribe/user_group" method:"post" tags:"Unsubscribe" summary:"get user groups"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Email string `json:"email" dc:"user email"`
}
type GetUserGroupsRes struct {
@@ -28,8 +30,9 @@ type GetUserGroupsRes struct {
}
type UnsubscribeNewReq struct {
- g.Meta `path:"/unsubscribe_new" method:"post" tags:"Unsubscribe" summary:"New unsubscribe API - direct unsubscribe"`
- Jwt string `json:"jwt" v:"required" dc:"JWT token containing unsubscribe information"`
+ g.Meta `path:"/unsubscribe_new" method:"post" tags:"Unsubscribe" summary:"New unsubscribe API - direct unsubscribe"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Jwt string `json:"jwt" v:"required" dc:"JWT token containing unsubscribe information"`
}
type UnsubscribeNewRes struct {
diff --git a/core/api/languages/v1/languages.go b/core/api/languages/v1/languages.go
index 881289b2..32d43a24 100644
--- a/core/api/languages/v1/languages.go
+++ b/core/api/languages/v1/languages.go
@@ -6,8 +6,9 @@ import (
)
type SetLanguageReq struct {
- g.Meta `path:"/languages/set" method:"post" tags:"Languages" summary:"Set Language"`
- Language string `json:"language" v:"required" dc:"Language"`
+ g.Meta `path:"/languages/set" method:"post" tags:"Languages" summary:"Set Language"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Language string `json:"language" v:"required" dc:"Language"`
}
type SetLanguageRes struct {
@@ -22,7 +23,8 @@ type LanguageInfo struct {
}
type GetLanguageReq struct {
- g.Meta `path:"/languages/get" method:"get" tags:"Languages" summary:"Get Language"`
+ g.Meta `path:"/languages/get" method:"get" tags:"Languages" summary:"Get Language"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
}
type GetLanguageRes struct {
diff --git a/core/api/mail_services/v1/common.go b/core/api/mail_services/v1/common.go
index 775d807f..4faa59c5 100644
--- a/core/api/mail_services/v1/common.go
+++ b/core/api/mail_services/v1/common.go
@@ -16,8 +16,9 @@ var (
)
type GetConfigFileReq struct {
- g.Meta `path:"/services/get_config" method:"post" summary:"get config file"`
- ServiceType string `json:"service_type" v:"required" desc:"service type"`
+ g.Meta `path:"/services/get_config" method:"post" summary:"get config file"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ ServiceType string `json:"service_type" v:"required" desc:"service type"`
}
type GetConfigFileRes struct {
@@ -33,9 +34,10 @@ type GetConfigFileRes struct {
}
type SaveConfigFileReq struct {
- g.Meta `path:"/services/save_config" method:"post" summary:"save config file"`
- ServiceType string `json:"service_type" v:"required" desc:"service type"`
- Content string `json:"content" v:"required" desc:"file content"`
+ g.Meta `path:"/services/save_config" method:"post" summary:"save config file"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ ServiceType string `json:"service_type" v:"required" desc:"service type"`
+ Content string `json:"content" v:"required" desc:"file content"`
}
type SaveConfigFileRes struct {
diff --git a/core/api/mail_services/v1/mail_bcc.go b/core/api/mail_services/v1/mail_bcc.go
index 8ef1bd16..8e0c38d3 100644
--- a/core/api/mail_services/v1/mail_bcc.go
+++ b/core/api/mail_services/v1/mail_bcc.go
@@ -17,12 +17,13 @@ type BmBcc struct {
}
type GetBccListReq struct {
- g.Meta `path:"/mail_bcc/list" method:"get" summary:"get mail bcc list"`
- Type string `json:"type" desc:"bcc type: sender/recipient, not set means get all"`
- Domain string `json:"domain" desc:"domain filter"`
- SearchKey string `json:"search_key" desc:"search key"`
- PageNum int `json:"page_num" d:"1" desc:"page num"`
- PageSize int `json:"page_size" d:"20" desc:"page size"`
+ g.Meta `path:"/mail_bcc/list" method:"get" summary:"get mail bcc list"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Type string `json:"type" desc:"bcc type: sender/recipient, not set means get all"`
+ Domain string `json:"domain" desc:"domain filter"`
+ SearchKey string `json:"search_key" desc:"search key"`
+ PageNum int `json:"page_num" d:"1" desc:"page num"`
+ PageSize int `json:"page_size" d:"20" desc:"page size"`
}
type GetBccListRes struct {
@@ -34,12 +35,13 @@ type GetBccListRes struct {
}
type AddBccReq struct {
- g.Meta `path:"/mail_bcc/add" method:"post" summary:"add mail bcc"`
- Type string `json:"type" v:"required|in:sender,recipient" dc:"bcc type: sender or recipient"`
- Address string `json:"address" v:"required" dc:"email address or domain"`
- Goto string `json:"goto" v:"required|email" dc:"forward target address"`
- Domain string `json:"domain" dc:"domain"`
- Active int `json:"active" d:"1" dc:"status: 1-enabled, 0-disabled"`
+ g.Meta `path:"/mail_bcc/add" method:"post" summary:"add mail bcc"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Type string `json:"type" v:"required|in:sender,recipient" dc:"bcc type: sender or recipient"`
+ Address string `json:"address" v:"required" dc:"email address or domain"`
+ Goto string `json:"goto" v:"required|email" dc:"forward target address"`
+ Domain string `json:"domain" dc:"domain"`
+ Active int `json:"active" d:"1" dc:"status: 1-enabled, 0-disabled"`
}
type AddBccRes struct {
@@ -47,13 +49,14 @@ type AddBccRes struct {
}
type EditBccReq struct {
- g.Meta `path:"/mail_bcc/edit" method:"post" summary:"edit mail bcc"`
- ID int `json:"id" v:"required" dc:"record id"`
- Type string `json:"type" v:"in:sender,recipient" dc:"bcc typeype: sen or er or recipient"`
- Address string `json:"address" dc:"email address or domainddress or domain"`
- Goto string `json:"goto" v:"required|email" dc:"forward target addressd target address"`
- Domain string `json:"domain" dc:"domain"`
- Active int `json:"active" v:"required" d:"1" dc:"status: 1-enabled, 0-disabled"`
+ g.Meta `path:"/mail_bcc/edit" method:"post" summary:"edit mail bcc"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ ID int `json:"id" v:"required" dc:"record id"`
+ Type string `json:"type" v:"in:sender,recipient" dc:"bcc typeype: sen or er or recipient"`
+ Address string `json:"address" dc:"email address or domainddress or domain"`
+ Goto string `json:"goto" v:"required|email" dc:"forward target addressd target address"`
+ Domain string `json:"domain" dc:"domain"`
+ Active int `json:"active" v:"required" d:"1" dc:"status: 1-enabled, 0-disabled"`
}
type EditBccRes struct {
@@ -61,8 +64,9 @@ type EditBccRes struct {
}
type DeleteBccReq struct {
- g.Meta `path:"/mail_bcc/delete" method:"post" summary:"delete mail bcc"`
- ID int `json:"id" v:"required" dc:"ID"`
+ g.Meta `path:"/mail_bcc/delete" method:"post" summary:"delete mail bcc"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ ID int `json:"id" v:"required" dc:"ID"`
}
type DeleteBccRes struct {
diff --git a/core/api/mail_services/v1/mail_forward.go b/core/api/mail_services/v1/mail_forward.go
index e3aee994..1890958d 100644
--- a/core/api/mail_services/v1/mail_forward.go
+++ b/core/api/mail_services/v1/mail_forward.go
@@ -15,11 +15,12 @@ type Alias struct {
}
type GetMailForwardListReq struct {
- g.Meta `path:"/mail_forward/list" method:"get" summary:"get mail forward list"`
- Domain string `json:"domain" desc:"domain filter"`
- Page int `json:"page" v:"min:1" desc:"page num" default:"1"`
- PageSize int `json:"page_size" v:"min:1" desc:"page size" default:"20"`
- SearchKey string `json:"search_key" desc:"search key, can search address"`
+ g.Meta `path:"/mail_forward/list" method:"get" summary:"get mail forward list"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Domain string `json:"domain" desc:"domain filter"`
+ Page int `json:"page" v:"min:1" desc:"page num" default:"1"`
+ PageSize int `json:"page_size" v:"min:1" desc:"page size" default:"20"`
+ SearchKey string `json:"search_key" desc:"search key, can search address"`
}
type GetMailForwardListRes struct {
@@ -31,10 +32,11 @@ type GetMailForwardListRes struct {
}
type AddMailForwardReq struct {
- g.Meta `path:"/mail_forward/add" method:"post" summary:"add mail forward"`
- Address string `json:"address" v:"required" desc:"forwarded email address, e.g. [email protected]"`
- Goto string `json:"goto" v:"required" desc:"forward target address, multiple addresses separated by newline"`
- Active int `json:"active" v:"in:0,1" desc:"status: 1-enabled, 0-disabled" default:"1"`
+ g.Meta `path:"/mail_forward/add" method:"post" summary:"add mail forward"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Address string `json:"address" v:"required" desc:"forwarded email address, e.g. [email protected]"`
+ Goto string `json:"goto" v:"required" desc:"forward target address, multiple addresses separated by newline"`
+ Active int `json:"active" v:"in:0,1" desc:"status: 1-enabled, 0-disabled" default:"1"`
}
type AddMailForwardRes struct {
@@ -42,10 +44,11 @@ type AddMailForwardRes struct {
}
type EditMailForwardReq struct {
- g.Meta `path:"/mail_forward/edit" method:"post" summary:"edit mail forward"`
- Address string `json:"address" v:"required" desc:"forwarded email address"`
- Goto string `json:"goto" v:"email" desc:"forward target address, multiple addresses separated by newline. not set means only modify status"`
- Active int `json:"active" v:"in:0,1" desc:"status: 1-enabled, 0-disabled"`
+ g.Meta `path:"/mail_forward/edit" method:"post" summary:"edit mail forward"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Address string `json:"address" v:"required" desc:"forwarded email address"`
+ Goto string `json:"goto" v:"email" desc:"forward target address, multiple addresses separated by newline. not set means only modify status"`
+ Active int `json:"active" v:"in:0,1" desc:"status: 1-enabled, 0-disabled"`
}
type EditMailForwardRes struct {
@@ -53,8 +56,9 @@ type EditMailForwardRes struct {
}
type DeleteMailForwardReq struct {
- g.Meta `path:"/mail_forward/delete" method:"post" summary:"delete mail forward"`
- Address string `json:"address" v:"required" desc:"forwarded email address"`
+ g.Meta `path:"/mail_forward/delete" method:"post" summary:"delete mail forward"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Address string `json:"address" v:"required" desc:"forwarded email address"`
}
type DeleteMailForwardRes struct {
diff --git a/core/api/operation_log/v1/operation_log.go b/core/api/operation_log/v1/operation_log.go
index 9dbfb75f..a92f83a9 100644
--- a/core/api/operation_log/v1/operation_log.go
+++ b/core/api/operation_log/v1/operation_log.go
@@ -34,12 +34,13 @@ type GetOperationTypeRes struct {
api_v1.StandardRes
}
type GetOutputLogReq struct {
- g.Meta `path:"/operation_log/output/list" method:"get" tags:"Output Log" summary:"List output logs"`
- StartDate string `json:"start_date" v:"required" dc:"Start date(YYYY-MM-DD)"`
- EndDate string `json:"end_date" v:"required" dc:"End date(YYYY-MM-DD)"`
- Keyword string `json:"keyword" dc:"keyword"`
- Page int `json:"page" v:"min:1" dc:"Page Number" d:"1"`
- PageSize int `json:"page_size" dc:"page size"`
+ g.Meta `path:"/operation_log/output/list" method:"get" tags:"Output Log" summary:"List output logs"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ StartDate string `json:"start_date" v:"required" dc:"Start date(YYYY-MM-DD)"`
+ EndDate string `json:"end_date" v:"required" dc:"End date(YYYY-MM-DD)"`
+ Keyword string `json:"keyword" dc:"keyword"`
+ Page int `json:"page" v:"min:1" dc:"Page Number" d:"1"`
+ PageSize int `json:"page_size" dc:"page size"`
}
type GetOutputLogRes struct {
@@ -47,7 +48,8 @@ type GetOutputLogRes struct {
}
type GetLatestOutputLogReq struct {
- g.Meta `path:"/operation_log/output/latest" method:"get" tags:"Output Log" summary:"Get latest output log"`
+ g.Meta `path:"/operation_log/output/latest" method:"get" tags:"Output Log" summary:"Get latest output log"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
}
type GetLatestOutputLogRes struct {
api_v1.StandardRes
diff --git a/core/api/rbac/rbac.go b/core/api/rbac/rbac.go
index 1ece9a65..7f470ce1 100644
--- a/core/api/rbac/rbac.go
+++ b/core/api/rbac/rbac.go
@@ -11,26 +11,26 @@ import (
)
type IRbacV1 interface {
- AccountList(ctx context.Context, req *v1.AccountListReq) (res *v1.AccountListRes, err error)
- AccountDetail(ctx context.Context, req *v1.AccountDetailReq) (res *v1.AccountDetailRes, err error)
- AccountCreate(ctx context.Context, req *v1.AccountCreateReq) (res *v1.AccountCreateRes, err error)
- AccountUpdate(ctx context.Context, req *v1.AccountUpdateReq) (res *v1.AccountUpdateRes, err error)
- AccountPassword(ctx context.Context, req *v1.AccountPasswordReq) (res *v1.AccountPasswordRes, err error)
- AccountDelete(ctx context.Context, req *v1.AccountDeleteReq) (res *v1.AccountDeleteRes, err error)
+ //AccountList(ctx context.Context, req *v1.AccountListReq) (res *v1.AccountListRes, err error)
+ //AccountDetail(ctx context.Context, req *v1.AccountDetailReq) (res *v1.AccountDetailRes, err error)
+ //AccountCreate(ctx context.Context, req *v1.AccountCreateReq) (res *v1.AccountCreateRes, err error)
+ //AccountUpdate(ctx context.Context, req *v1.AccountUpdateReq) (res *v1.AccountUpdateRes, err error)
+ //AccountPassword(ctx context.Context, req *v1.AccountPasswordReq) (res *v1.AccountPasswordRes, err error)
+ //AccountDelete(ctx context.Context, req *v1.AccountDeleteReq) (res *v1.AccountDeleteRes, err error)
Login(ctx context.Context, req *v1.LoginReq) (res *v1.LoginRes, err error)
Logout(ctx context.Context, req *v1.LogoutReq) (res *v1.LogoutRes, err error)
RefreshToken(ctx context.Context, req *v1.RefreshTokenReq) (res *v1.RefreshTokenRes, err error)
GetValidateCode(ctx context.Context, req *v1.GetValidateCodeReq) (res *v1.GetValidateCodeRes, err error)
- CurrentUser(ctx context.Context, req *v1.CurrentUserReq) (res *v1.CurrentUserRes, err error)
- PermissionList(ctx context.Context, req *v1.PermissionListReq) (res *v1.PermissionListRes, err error)
- PermissionDetail(ctx context.Context, req *v1.PermissionDetailReq) (res *v1.PermissionDetailRes, err error)
- PermissionCreate(ctx context.Context, req *v1.PermissionCreateReq) (res *v1.PermissionCreateRes, err error)
- PermissionUpdate(ctx context.Context, req *v1.PermissionUpdateReq) (res *v1.PermissionUpdateRes, err error)
- PermissionDelete(ctx context.Context, req *v1.PermissionDeleteReq) (res *v1.PermissionDeleteRes, err error)
- PermissionCheck(ctx context.Context, req *v1.PermissionCheckReq) (res *v1.PermissionCheckRes, err error)
- RoleList(ctx context.Context, req *v1.RoleListReq) (res *v1.RoleListRes, err error)
- RoleDetail(ctx context.Context, req *v1.RoleDetailReq) (res *v1.RoleDetailRes, err error)
- RoleCreate(ctx context.Context, req *v1.RoleCreateReq) (res *v1.RoleCreateRes, err error)
- RoleUpdate(ctx context.Context, req *v1.RoleUpdateReq) (res *v1.RoleUpdateRes, err error)
- RoleDelete(ctx context.Context, req *v1.RoleDeleteReq) (res *v1.RoleDeleteRes, err error)
+ //CurrentUser(ctx context.Context, req *v1.CurrentUserReq) (res *v1.CurrentUserRes, err error)
+ //PermissionList(ctx context.Context, req *v1.PermissionListReq) (res *v1.PermissionListRes, err error)
+ //PermissionDetail(ctx context.Context, req *v1.PermissionDetailReq) (res *v1.PermissionDetailRes, err error)
+ //PermissionCreate(ctx context.Context, req *v1.PermissionCreateReq) (res *v1.PermissionCreateRes, err error)
+ //PermissionUpdate(ctx context.Context, req *v1.PermissionUpdateReq) (res *v1.PermissionUpdateRes, err error)
+ //PermissionDelete(ctx context.Context, req *v1.PermissionDeleteReq) (res *v1.PermissionDeleteRes, err error)
+ //PermissionCheck(ctx context.Context, req *v1.PermissionCheckReq) (res *v1.PermissionCheckRes, err error)
+ //RoleList(ctx context.Context, req *v1.RoleListReq) (res *v1.RoleListRes, err error)
+ //RoleDetail(ctx context.Context, req *v1.RoleDetailReq) (res *v1.RoleDetailRes, err error)
+ //RoleCreate(ctx context.Context, req *v1.RoleCreateReq) (res *v1.RoleCreateRes, err error)
+ //RoleUpdate(ctx context.Context, req *v1.RoleUpdateReq) (res *v1.RoleUpdateRes, err error)
+ //RoleDelete(ctx context.Context, req *v1.RoleDeleteReq) (res *v1.RoleDeleteRes, err error)
}
diff --git a/core/api/rbac/v1/account.go b/core/api/rbac/v1/account.go
index 5065b146..a38a779d 100644
--- a/core/api/rbac/v1/account.go
+++ b/core/api/rbac/v1/account.go
@@ -1,10 +1,5 @@
package v1
-import (
- "billionmail-core/utility/types/api_v1"
- "github.com/gogf/gf/v2/frame/g"
-)
-
// AccountInfoItem defines the account information structure
type AccountInfoItem struct {
Id int64 `json:"id" dc:"Account ID"`
@@ -15,103 +10,103 @@ type AccountInfoItem struct {
CreateTime int64 `json:"create_time" dc:"Creation time"`
}
-// AccountListReq defines the request for getting account list
-type AccountListReq struct {
- g.Meta `path:"/account/list" method:"get" tags:"RBAC" summary:"Get account list" sm:"Get account list" in:"query"`
- Authorization string `json:"authorization" dc:"Authorization" in:"header"`
- Page int `p:"page" d:"1" v:"min:1#Page number must be greater than 0" dc:"Page number"`
- PageSize int `p:"pageSize" d:"10" v:"min:1#Items per page must be greater than 0" dc:"Items per page"`
- Username string `p:"username" dc:"Username filter"`
- Email string `p:"email" dc:"Email filter"`
- Status int `p:"status" dc:"Status filter"`
-}
-
-// AccountListRes is the response for getting account list
-type AccountListRes struct {
- api_v1.StandardRes
- Data struct {
- List []AccountInfoItem `json:"list" dc:"Account list"`
- Total int `json:"total" dc:"Total"`
- Page int `json:"page" dc:"Current page"`
- } `json:"data"`
-}
-
-// AccountDetailReq is the request for getting account details
-type AccountDetailReq struct {
- g.Meta `path:"/account/detail" method:"get" tags:"RBAC" summary:"Get account details" sm:"Get account details" in:"query"`
- Authorization string `json:"authorization" dc:"Authorization" in:"header"`
- AccountId int64 `p:"accountId" v:"required#Please provide account ID" dc:"Account ID"`
-}
-
-// AccountDetailRes is the response for getting account details
-type AccountDetailRes struct {
- api_v1.StandardRes
- Data struct {
- Account AccountInfoItem `json:"account" dc:"Account information"`
- Roles []RoleInfoItem `json:"roles" dc:"Account roles list"`
- AllRoles []RoleInfoItem `json:"allRoles" dc:"All available roles"`
- } `json:"data"`
-}
-
-// AccountCreateReq is the request for creating account
-type AccountCreateReq struct {
- g.Meta `path:"/account/create" method:"post" tags:"RBAC" summary:"Create account" sm:"Create account" in:"body"`
- Authorization string `json:"authorization" dc:"Authorization" in:"header"`
- Username string `p:"username" v:"required#User name can not be empty" dc:"User name"`
- Password string `p:"password" v:"required#Password can not be empty" dc:"Password"`
- Email string `p:"email" v:"required|email#Email can not be empty|Email format is not correct" dc:"Email"`
- RoleIds []int64 `p:"roleIds" dc:"Role ID list"`
- Status int `p:"status" d:"1" dc:"Status(0:disabled, 1:enabled)"`
- Lang string `p:"lang" d:"en" dc:"Language setting"`
-}
-
-// AccountCreateRes is the response for creating account
-type AccountCreateRes struct {
- api_v1.StandardRes
- Data struct {
- AccountId int64 `json:"accountId" dc:"New account ID"`
- } `json:"data"`
-}
-
-// AccountUpdateReq is the request for updating account
-type AccountUpdateReq struct {
- g.Meta `path:"/account/update" method:"post" tags:"RBAC" summary:"Update account" sm:"Update account" in:"body"`
- Authorization string `json:"authorization" dc:"Authorization" in:"header"`
- AccountId int64 `p:"accountId" v:"required#Account ID can not be empty" dc:"Account ID"`
- Username string `p:"username" dc:"User name"`
- Email string `p:"email" v:"email#Email format is not correct" dc:"Email"`
- RoleIds []int64 `p:"roleIds" dc:"Role ID list"`
- Status int `p:"status" dc:"Status(0:disabled, 1:enabled)"`
- Lang string `p:"lang" dc:"Language setting"`
-}
-
-// AccountUpdateRes is the response for updating account
-type AccountUpdateRes struct {
- api_v1.StandardRes
-}
-
-// AccountPasswordReq is the request for updating account password
-type AccountPasswordReq struct {
- g.Meta `path:"/account/password" method:"post" tags:"RBAC" summary:"Update account password" sm:"Update account password" in:"body"`
- Authorization string `json:"authorization" dc:"Authorization" in:"header"`
- AccountId int64 `p:"accountId" v:"required#Account ID can not be empty" dc:"Account ID"`
- OldPassword string `p:"oldPassword" dc:"Old password(administrator optional)"`
- NewPassword string `p:"newPassword" v:"required#New password can not be empty" dc:"New password"`
-}
-
-// AccountPasswordRes is the response for updating account password
-type AccountPasswordRes struct {
- api_v1.StandardRes
-}
-
-// AccountDeleteReq is the request for deleting account
-type AccountDeleteReq struct {
- g.Meta `path:"/account/delete" method:"post" tags:"RBAC" summary:"Delete account" sm:"Delete account" in:"body"`
- Authorization string `json:"authorization" dc:"Authorization" in:"header"`
- AccountId int64 `p:"accountId" v:"required#Account ID can not be empty" dc:"Account ID"`
-}
-
-// AccountDeleteRes is the response for deleting account
-type AccountDeleteRes struct {
- api_v1.StandardRes
-}
+//// AccountListReq defines the request for getting account list
+//type AccountListReq struct {
+// g.Meta `path:"/account/list" method:"get" tags:"RBAC" summary:"Get account list" sm:"Get account list" in:"query"`
+// Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+// Page int `p:"page" d:"1" v:"min:1#Page number must be greater than 0" dc:"Page number"`
+// PageSize int `p:"pageSize" d:"10" v:"min:1#Items per page must be greater than 0" dc:"Items per page"`
+// Username string `p:"username" dc:"Username filter"`
+// Email string `p:"email" dc:"Email filter"`
+// Status int `p:"status" dc:"Status filter"`
+//}
+//
+//// AccountListRes is the response for getting account list
+//type AccountListRes struct {
+// api_v1.StandardRes
+// Data struct {
+// List []AccountInfoItem `json:"list" dc:"Account list"`
+// Total int `json:"total" dc:"Total"`
+// Page int `json:"page" dc:"Current page"`
+// } `json:"data"`
+//}
+//
+//// AccountDetailReq is the request for getting account details
+//type AccountDetailReq struct {
+// g.Meta `path:"/account/detail" method:"get" tags:"RBAC" summary:"Get account details" sm:"Get account details" in:"query"`
+// Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+// AccountId int64 `p:"accountId" v:"required#Please provide account ID" dc:"Account ID"`
+//}
+//
+//// AccountDetailRes is the response for getting account details
+//type AccountDetailRes struct {
+// api_v1.StandardRes
+// Data struct {
+// Account AccountInfoItem `json:"account" dc:"Account information"`
+// Roles []RoleInfoItem `json:"roles" dc:"Account roles list"`
+// AllRoles []RoleInfoItem `json:"allRoles" dc:"All available roles"`
+// } `json:"data"`
+//}
+//
+//// AccountCreateReq is the request for creating account
+//type AccountCreateReq struct {
+// g.Meta `path:"/account/create" method:"post" tags:"RBAC" summary:"Create account" sm:"Create account" in:"body"`
+// Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+// Username string `p:"username" v:"required#User name can not be empty" dc:"User name"`
+// Password string `p:"password" v:"required#Password can not be empty" dc:"Password"`
+// Email string `p:"email" v:"required|email#Email can not be empty|Email format is not correct" dc:"Email"`
+// RoleIds []int64 `p:"roleIds" dc:"Role ID list"`
+// Status int `p:"status" d:"1" dc:"Status(0:disabled, 1:enabled)"`
+// Lang string `p:"lang" d:"en" dc:"Language setting"`
+//}
+//
+//// AccountCreateRes is the response for creating account
+//type AccountCreateRes struct {
+// api_v1.StandardRes
+// Data struct {
+// AccountId int64 `json:"accountId" dc:"New account ID"`
+// } `json:"data"`
+//}
+//
+//// AccountUpdateReq is the request for updating account
+//type AccountUpdateReq struct {
+// g.Meta `path:"/account/update" method:"post" tags:"RBAC" summary:"Update account" sm:"Update account" in:"body"`
+// Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+// AccountId int64 `p:"accountId" v:"required#Account ID can not be empty" dc:"Account ID"`
+// Username string `p:"username" dc:"User name"`
+// Email string `p:"email" v:"email#Email format is not correct" dc:"Email"`
+// RoleIds []int64 `p:"roleIds" dc:"Role ID list"`
+// Status int `p:"status" dc:"Status(0:disabled, 1:enabled)"`
+// Lang string `p:"lang" dc:"Language setting"`
+//}
+//
+//// AccountUpdateRes is the response for updating account
+//type AccountUpdateRes struct {
+// api_v1.StandardRes
+//}
+//
+//// AccountPasswordReq is the request for updating account password
+//type AccountPasswordReq struct {
+// g.Meta `path:"/account/password" method:"post" tags:"RBAC" summary:"Update account password" sm:"Update account password" in:"body"`
+// Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+// AccountId int64 `p:"accountId" v:"required#Account ID can not be empty" dc:"Account ID"`
+// OldPassword string `p:"oldPassword" dc:"Old password(administrator optional)"`
+// NewPassword string `p:"newPassword" v:"required#New password can not be empty" dc:"New password"`
+//}
+//
+//// AccountPasswordRes is the response for updating account password
+//type AccountPasswordRes struct {
+// api_v1.StandardRes
+//}
+//
+//// AccountDeleteReq is the request for deleting account
+//type AccountDeleteReq struct {
+// g.Meta `path:"/account/delete" method:"post" tags:"RBAC" summary:"Delete account" sm:"Delete account" in:"body"`
+// Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+// AccountId int64 `p:"accountId" v:"required#Account ID can not be empty" dc:"Account ID"`
+//}
+//
+//// AccountDeleteRes is the response for deleting account
+//type AccountDeleteRes struct {
+// api_v1.StandardRes
+//}
diff --git a/core/api/rbac/v1/auth.go b/core/api/rbac/v1/auth.go
index 225aa674..593acd1b 100644
--- a/core/api/rbac/v1/auth.go
+++ b/core/api/rbac/v1/auth.go
@@ -75,24 +75,24 @@ type GetValidateCodeRes struct {
} `json:"data"`
}
-// CurrentUserReq defines the request for getting current user info
-type CurrentUserReq struct {
- g.Meta `path:"/current-user" method:"get" tags:"Authentication" summary:"Get current user info" sm:"Get current user info" in:"query"`
- Authorization string `json:"authorization" dc:"Authorization" in:"header"`
-}
-
-// CurrentUserRes defines the response for getting current user info
-type CurrentUserRes struct {
- api_v1.StandardRes
- Data struct {
- Account struct {
- Id int64 `json:"id" dc:"Account ID"`
- Username string `json:"username" dc:"Username"`
- Email string `json:"email" dc:"Email address"`
- Status int `json:"status" dc:"Account status"`
- Lang string `json:"lang" dc:"Preferred language"`
- } `json:"account" dc:"Account information"`
- Roles []string `json:"roles" dc:"User roles"`
- Permissions []string `json:"permissions" dc:"User permissions"`
- } `json:"data"`
-}
+//// CurrentUserReq defines the request for getting current user info
+//type CurrentUserReq struct {
+// g.Meta `path:"/current-user" method:"get" tags:"Authentication" summary:"Get current user info" sm:"Get current user info" in:"query"`
+// Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+//}
+//
+//// CurrentUserRes defines the response for getting current user info
+//type CurrentUserRes struct {
+// api_v1.StandardRes
+// Data struct {
+// Account struct {
+// Id int64 `json:"id" dc:"Account ID"`
+// Username string `json:"username" dc:"Username"`
+// Email string `json:"email" dc:"Email address"`
+// Status int `json:"status" dc:"Account status"`
+// Lang string `json:"lang" dc:"Preferred language"`
+// } `json:"account" dc:"Account information"`
+// Roles []string `json:"roles" dc:"User roles"`
+// Permissions []string `json:"permissions" dc:"User permissions"`
+// } `json:"data"`
+//}
diff --git a/core/api/rbac/v1/permission.go b/core/api/rbac/v1/permission.go
index e840ceef..cac58b6c 100644
--- a/core/api/rbac/v1/permission.go
+++ b/core/api/rbac/v1/permission.go
@@ -1,10 +1,5 @@
package v1
-import (
- "billionmail-core/utility/types/api_v1"
- "github.com/gogf/gf/v2/frame/g"
-)
-
// PermissionInfoItem defines the permission information structure
type PermissionInfoItem struct {
Id int64 `json:"id" dc:"Permission ID"`
@@ -18,105 +13,105 @@ type PermissionInfoItem struct {
UpdateTime int64 `json:"update_time" dc:"Update time"`
}
-// PermissionListReq defines the request for getting permission list
-type PermissionListReq struct {
- g.Meta `path:"/permission/list" method:"get" tags:"RBAC" summary:"Get permission list" sm:"Get permission list" in:"query"`
- Authorization string `json:"authorization" dc:"Authorization" in:"header"`
- Page int `p:"page" d:"1" v:"min:1#Page number must be greater than 0" dc:"Page number"`
- PageSize int `p:"pageSize" d:"10" v:"min:1#Items per page must be greater than 0" dc:"Items per page"`
- Module string `p:"module" dc:"Module name filter"`
- Action string `p:"action" dc:"Action name filter"`
- Status int `p:"status" dc:"Status filter"`
-}
-
-// PermissionListRes defines the response for getting permission list
-type PermissionListRes struct {
- api_v1.StandardRes
- Data struct {
- List []PermissionInfoItem `json:"list" dc:"Permission list"`
- Total int `json:"total" dc:"Total count"`
- Page int `json:"page" dc:"Current page number"`
- } `json:"data"`
-}
-
-// PermissionDetailReq defines the request for getting permission details
-type PermissionDetailReq struct {
- g.Meta `path:"/permission/detail" method:"get" tags:"RBAC" summary:"Get permission details" sm:"Get permission details" in:"query"`
- Authorization string `json:"authorization" dc:"Authorization" in:"header"`
- PermissionId int64 `p:"permissionId" v:"required#Please provide permission ID" dc:"Permission ID"`
-}
-
-// PermissionDetailRes defines the response for getting permission details
-type PermissionDetailRes struct {
- api_v1.StandardRes
- Data struct {
- Permission PermissionInfoItem `json:"permission" dc:"Permission information"`
- } `json:"data"`
-}
-
-// PermissionCreateReq defines the request for creating permission
-type PermissionCreateReq struct {
- g.Meta `path:"/permission/create" method:"post" tags:"RBAC" summary:"Create permission" sm:"Create permission" in:"body"`
- Authorization string `json:"authorization" dc:"Authorization" in:"header"`
- Name string `p:"name" v:"required#Permission name cannot be empty" dc:"Permission name"`
- Module string `p:"module" v:"required#Module name cannot be empty" dc:"Module name"`
- Action string `p:"action" v:"required#Action name cannot be empty" dc:"Action name"`
- Resource string `p:"resource" v:"required#Resource name cannot be empty" dc:"Resource name"`
- Description string `p:"description" dc:"Permission description"`
- Status int `p:"status" d:"1" dc:"Status (0:disabled, 1:enabled)"`
-}
-
-// PermissionCreateRes defines the response for creating permission
-type PermissionCreateRes struct {
- api_v1.StandardRes
- Data struct {
- PermissionId int64 `json:"permissionId" dc:"New permission ID"`
- } `json:"data"`
-}
-
-// PermissionUpdateReq defines the request for updating permission
-type PermissionUpdateReq struct {
- g.Meta `path:"/permission/update" method:"post" tags:"RBAC" summary:"Update permission" sm:"Update permission" in:"body"`
- Authorization string `json:"authorization" dc:"Authorization" in:"header"`
- PermissionId int64 `p:"permissionId" v:"required#Permission ID cannot be empty" dc:"Permission ID"`
- Name string `p:"name" dc:"Permission name"`
- Module string `p:"module" dc:"Module name"`
- Action string `p:"action" dc:"Action name"`
- Resource string `p:"resource" dc:"Resource name"`
- Description string `p:"description" dc:"Permission description"`
- Status int `p:"status" dc:"Status (0:disabled, 1:enabled)"`
-}
-
-// PermissionUpdateRes defines the response for updating permission
-type PermissionUpdateRes struct {
- api_v1.StandardRes
-}
-
-// PermissionDeleteReq defines the request for deleting permission
-type PermissionDeleteReq struct {
- g.Meta `path:"/permission/delete" method:"post" tags:"RBAC" summary:"Delete permission" sm:"Delete permission" in:"body"`
- Authorization string `json:"authorization" dc:"Authorization" in:"header"`
- PermissionId int64 `p:"permissionId" v:"required#Permission ID cannot be empty" dc:"Permission ID"`
-}
-
-// PermissionDeleteRes defines the response for deleting permission
-type PermissionDeleteRes struct {
- api_v1.StandardRes
-}
-
-// PermissionCheckReq defines the request for checking permission
-type PermissionCheckReq struct {
- g.Meta `path:"/permission/check" method:"post" tags:"RBAC" summary:"Check permission" sm:"Check permission" in:"body"`
- Authorization string `json:"authorization" dc:"Authorization" in:"header"`
- Module string `p:"module" v:"required#Module name cannot be empty" dc:"Module name"`
- Action string `p:"action" v:"required#Action name cannot be empty" dc:"Action name"`
- Resource string `p:"resource" v:"required#Resource name cannot be empty" dc:"Resource name"`
-}
-
-// PermissionCheckRes defines the response for checking permission
-type PermissionCheckRes struct {
- api_v1.StandardRes
- Data struct {
- HasPermission bool `json:"hasPermission" dc:"Whether has permission"`
- } `json:"data"`
-}
+//// PermissionListReq defines the request for getting permission list
+//type PermissionListReq struct {
+// g.Meta `path:"/permission/list" method:"get" tags:"RBAC" summary:"Get permission list" sm:"Get permission list" in:"query"`
+// Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+// Page int `p:"page" d:"1" v:"min:1#Page number must be greater than 0" dc:"Page number"`
+// PageSize int `p:"pageSize" d:"10" v:"min:1#Items per page must be greater than 0" dc:"Items per page"`
+// Module string `p:"module" dc:"Module name filter"`
+// Action string `p:"action" dc:"Action name filter"`
+// Status int `p:"status" dc:"Status filter"`
+//}
+//
+//// PermissionListRes defines the response for getting permission list
+//type PermissionListRes struct {
+// api_v1.StandardRes
+// Data struct {
+// List []PermissionInfoItem `json:"list" dc:"Permission list"`
+// Total int `json:"total" dc:"Total count"`
+// Page int `json:"page" dc:"Current page number"`
+// } `json:"data"`
+//}
+//
+//// PermissionDetailReq defines the request for getting permission details
+//type PermissionDetailReq struct {
+// g.Meta `path:"/permission/detail" method:"get" tags:"RBAC" summary:"Get permission details" sm:"Get permission details" in:"query"`
+// Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+// PermissionId int64 `p:"permissionId" v:"required#Please provide permission ID" dc:"Permission ID"`
+//}
+//
+//// PermissionDetailRes defines the response for getting permission details
+//type PermissionDetailRes struct {
+// api_v1.StandardRes
+// Data struct {
+// Permission PermissionInfoItem `json:"permission" dc:"Permission information"`
+// } `json:"data"`
+//}
+//
+//// PermissionCreateReq defines the request for creating permission
+//type PermissionCreateReq struct {
+// g.Meta `path:"/permission/create" method:"post" tags:"RBAC" summary:"Create permission" sm:"Create permission" in:"body"`
+// Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+// Name string `p:"name" v:"required#Permission name cannot be empty" dc:"Permission name"`
+// Module string `p:"module" v:"required#Module name cannot be empty" dc:"Module name"`
+// Action string `p:"action" v:"required#Action name cannot be empty" dc:"Action name"`
+// Resource string `p:"resource" v:"required#Resource name cannot be empty" dc:"Resource name"`
+// Description string `p:"description" dc:"Permission description"`
+// Status int `p:"status" d:"1" dc:"Status (0:disabled, 1:enabled)"`
+//}
+//
+//// PermissionCreateRes defines the response for creating permission
+//type PermissionCreateRes struct {
+// api_v1.StandardRes
+// Data struct {
+// PermissionId int64 `json:"permissionId" dc:"New permission ID"`
+// } `json:"data"`
+//}
+//
+//// PermissionUpdateReq defines the request for updating permission
+//type PermissionUpdateReq struct {
+// g.Meta `path:"/permission/update" method:"post" tags:"RBAC" summary:"Update permission" sm:"Update permission" in:"body"`
+// Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+// PermissionId int64 `p:"permissionId" v:"required#Permission ID cannot be empty" dc:"Permission ID"`
+// Name string `p:"name" dc:"Permission name"`
+// Module string `p:"module" dc:"Module name"`
+// Action string `p:"action" dc:"Action name"`
+// Resource string `p:"resource" dc:"Resource name"`
+// Description string `p:"description" dc:"Permission description"`
+// Status int `p:"status" dc:"Status (0:disabled, 1:enabled)"`
+//}
+//
+//// PermissionUpdateRes defines the response for updating permission
+//type PermissionUpdateRes struct {
+// api_v1.StandardRes
+//}
+//
+//// PermissionDeleteReq defines the request for deleting permission
+//type PermissionDeleteReq struct {
+// g.Meta `path:"/permission/delete" method:"post" tags:"RBAC" summary:"Delete permission" sm:"Delete permission" in:"body"`
+// Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+// PermissionId int64 `p:"permissionId" v:"required#Permission ID cannot be empty" dc:"Permission ID"`
+//}
+//
+//// PermissionDeleteRes defines the response for deleting permission
+//type PermissionDeleteRes struct {
+// api_v1.StandardRes
+//}
+//
+//// PermissionCheckReq defines the request for checking permission
+//type PermissionCheckReq struct {
+// g.Meta `path:"/permission/check" method:"post" tags:"RBAC" summary:"Check permission" sm:"Check permission" in:"body"`
+// Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+// Module string `p:"module" v:"required#Module name cannot be empty" dc:"Module name"`
+// Action string `p:"action" v:"required#Action name cannot be empty" dc:"Action name"`
+// Resource string `p:"resource" v:"required#Resource name cannot be empty" dc:"Resource name"`
+//}
+//
+//// PermissionCheckRes defines the response for checking permission
+//type PermissionCheckRes struct {
+// api_v1.StandardRes
+// Data struct {
+// HasPermission bool `json:"hasPermission" dc:"Whether has permission"`
+// } `json:"data"`
+//}
diff --git a/core/api/rbac/v1/role.go b/core/api/rbac/v1/role.go
index a89a26a1..ff8b8b2d 100644
--- a/core/api/rbac/v1/role.go
+++ b/core/api/rbac/v1/role.go
@@ -1,10 +1,5 @@
package v1
-import (
- "billionmail-core/utility/types/api_v1"
- "github.com/gogf/gf/v2/frame/g"
-)
-
// RoleInfoItem defines the role information structure
type RoleInfoItem struct {
Id int64 `json:"id" dc:"Role ID"`
@@ -14,85 +9,85 @@ type RoleInfoItem struct {
CreateTime int64 `json:"create_time" dc:"Creation time"`
}
-// RoleListReq defines the request for getting role list
-type RoleListReq struct {
- g.Meta `path:"/role/list" method:"get" tags:"RBAC" summary:"Get role list" sm:"Get role list" in:"query"`
- Authorization string `json:"authorization" dc:"Authorization" in:"header"`
- Page int `p:"page" d:"1" v:"min:1#Page number must be greater than 0" dc:"Page number"`
- PageSize int `p:"pageSize" d:"10" v:"min:1#Items per page must be greater than 0" dc:"Items per page"`
- Name string `p:"name" dc:"Role name filter"`
- Status int `p:"status" dc:"Status filter"`
-}
-
-// RoleListRes defines the response for getting role list
-type RoleListRes struct {
- api_v1.StandardRes
- Data struct {
- List []RoleInfoItem `json:"list" dc:"Role list"`
- Total int `json:"total" dc:"Total count"`
- Page int `json:"page" dc:"Current page number"`
- } `json:"data"`
-}
-
-// RoleDetailReq defines the request for getting role details
-type RoleDetailReq struct {
- g.Meta `path:"/role/detail" method:"get" tags:"RBAC" summary:"Get role details" sm:"Get role details" in:"query"`
- Authorization string `json:"authorization" dc:"Authorization" in:"header"`
- RoleId int64 `p:"roleId" v:"required#Please provide role ID" dc:"Role ID"`
-}
-
-// RoleDetailRes defines the response for getting role details
-type RoleDetailRes struct {
- api_v1.StandardRes
- Data struct {
- Role RoleInfoItem `json:"role" dc:"Role information"`
- Permissions []PermissionInfoItem `json:"permissions" dc:"Role permissions list"`
- AllPermissions []PermissionInfoItem `json:"allPermissions" dc:"All available permissions"`
- } `json:"data"`
-}
-
-// RoleCreateReq defines the request for creating role
-type RoleCreateReq struct {
- g.Meta `path:"/role/create" method:"post" tags:"RBAC" summary:"Create role" sm:"Create role" in:"body"`
- Authorization string `json:"authorization" dc:"Authorization" in:"header"`
- Name string `p:"name" v:"required#Role name cannot be empty" dc:"Role name"`
- Description string `p:"description" dc:"Role description"`
- PermissionIds []int64 `p:"permissionIds" dc:"Permission IDs list"`
- Status int `p:"status" d:"1" dc:"Status (0:disabled, 1:enabled)"`
-}
-
-// RoleCreateRes defines the response for creating role
-type RoleCreateRes struct {
- api_v1.StandardRes
- Data struct {
- RoleId int64 `json:"roleId" dc:"New role ID"`
- } `json:"data"`
-}
-
-// RoleUpdateReq defines the request for updating role
-type RoleUpdateReq struct {
- g.Meta `path:"/role/update" method:"post" tags:"RBAC" summary:"Update role" sm:"Update role" in:"body"`
- Authorization string `json:"authorization" dc:"Authorization" in:"header"`
- RoleId int64 `p:"roleId" v:"required#Role ID cannot be empty" dc:"Role ID"`
- Name string `p:"name" dc:"Role name"`
- Description string `p:"description" dc:"Role description"`
- PermissionIds []int64 `p:"permissionIds" dc:"Permission IDs list"`
- Status int `p:"status" dc:"Status (0:disabled, 1:enabled)"`
-}
-
-// RoleUpdateRes defines the response for updating role
-type RoleUpdateRes struct {
- api_v1.StandardRes
-}
-
-// RoleDeleteReq defines the request for deleting role
-type RoleDeleteReq struct {
- g.Meta `path:"/role/delete" method:"post" tags:"RBAC" summary:"Delete role" sm:"Delete role" in:"body"`
- Authorization string `json:"authorization" dc:"Authorization" in:"header"`
- RoleId int64 `p:"roleId" v:"required#Role ID cannot be empty" dc:"Role ID"`
-}
-
-// RoleDeleteRes defines the response for deleting role
-type RoleDeleteRes struct {
- api_v1.StandardRes
-}
+//// RoleListReq defines the request for getting role list
+//type RoleListReq struct {
+// g.Meta `path:"/role/list" method:"get" tags:"RBAC" summary:"Get role list" sm:"Get role list" in:"query"`
+// Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+// Page int `p:"page" d:"1" v:"min:1#Page number must be greater than 0" dc:"Page number"`
+// PageSize int `p:"pageSize" d:"10" v:"min:1#Items per page must be greater than 0" dc:"Items per page"`
+// Name string `p:"name" dc:"Role name filter"`
+// Status int `p:"status" dc:"Status filter"`
+//}
+//
+//// RoleListRes defines the response for getting role list
+//type RoleListRes struct {
+// api_v1.StandardRes
+// Data struct {
+// List []RoleInfoItem `json:"list" dc:"Role list"`
+// Total int `json:"total" dc:"Total count"`
+// Page int `json:"page" dc:"Current page number"`
+// } `json:"data"`
+//}
+//
+//// RoleDetailReq defines the request for getting role details
+//type RoleDetailReq struct {
+// g.Meta `path:"/role/detail" method:"get" tags:"RBAC" summary:"Get role details" sm:"Get role details" in:"query"`
+// Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+// RoleId int64 `p:"roleId" v:"required#Please provide role ID" dc:"Role ID"`
+//}
+//
+//// RoleDetailRes defines the response for getting role details
+//type RoleDetailRes struct {
+// api_v1.StandardRes
+// Data struct {
+// Role RoleInfoItem `json:"role" dc:"Role information"`
+// Permissions []PermissionInfoItem `json:"permissions" dc:"Role permissions list"`
+// AllPermissions []PermissionInfoItem `json:"allPermissions" dc:"All available permissions"`
+// } `json:"data"`
+//}
+//
+//// RoleCreateReq defines the request for creating role
+//type RoleCreateReq struct {
+// g.Meta `path:"/role/create" method:"post" tags:"RBAC" summary:"Create role" sm:"Create role" in:"body"`
+// Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+// Name string `p:"name" v:"required#Role name cannot be empty" dc:"Role name"`
+// Description string `p:"description" dc:"Role description"`
+// PermissionIds []int64 `p:"permissionIds" dc:"Permission IDs list"`
+// Status int `p:"status" d:"1" dc:"Status (0:disabled, 1:enabled)"`
+//}
+//
+//// RoleCreateRes defines the response for creating role
+//type RoleCreateRes struct {
+// api_v1.StandardRes
+// Data struct {
+// RoleId int64 `json:"roleId" dc:"New role ID"`
+// } `json:"data"`
+//}
+//
+//// RoleUpdateReq defines the request for updating role
+//type RoleUpdateReq struct {
+// g.Meta `path:"/role/update" method:"post" tags:"RBAC" summary:"Update role" sm:"Update role" in:"body"`
+// Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+// RoleId int64 `p:"roleId" v:"required#Role ID cannot be empty" dc:"Role ID"`
+// Name string `p:"name" dc:"Role name"`
+// Description string `p:"description" dc:"Role description"`
+// PermissionIds []int64 `p:"permissionIds" dc:"Permission IDs list"`
+// Status int `p:"status" dc:"Status (0:disabled, 1:enabled)"`
+//}
+//
+//// RoleUpdateRes defines the response for updating role
+//type RoleUpdateRes struct {
+// api_v1.StandardRes
+//}
+//
+//// RoleDeleteReq defines the request for deleting role
+//type RoleDeleteReq struct {
+// g.Meta `path:"/role/delete" method:"post" tags:"RBAC" summary:"Delete role" sm:"Delete role" in:"body"`
+// Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+// RoleId int64 `p:"roleId" v:"required#Role ID cannot be empty" dc:"Role ID"`
+//}
+//
+//// RoleDeleteRes defines the response for deleting role
+//type RoleDeleteRes struct {
+// api_v1.StandardRes
+//}
diff --git a/core/api/settings/v1/settings.go b/core/api/settings/v1/settings.go
index 277c76dc..66a09aa3 100644
--- a/core/api/settings/v1/settings.go
+++ b/core/api/settings/v1/settings.go
@@ -88,15 +88,16 @@ type SystemConfig struct {
// API configuration
APIDocSwagger struct {
- APIDocURL string `json:"api_doc_url" dc:"api doc url"`
- SwaggerURL string `json:"swagger_url" dc:"swagger url"`
- APIDocEnabled bool `json:"api_doc_enabled" dc:"enable API documentation and Swagger UI"`
- APIToken string `json:"api_token" dc:"API access token"`
+ APIDocURL string `json:"api_doc_url" dc:"api doc url"`
+ SwaggerURL string `json:"swagger_url" dc:"swagger url"`
+ APIDocEnabled bool `json:"api_doc_enabled" dc:"enable API documentation and Swagger UI"`
+ APIToken string `json:"api_token" dc:"API access token"`
} `json:"api_doc_swagger" dc:"API doc and Swagger UI configuration"`
}
type GetVersionReq struct {
- g.Meta `path:"/settings/get_version" tags:"Version" method:"get" summary:"Get current version information" in:"query"`
+ g.Meta `path:"/settings/get_version" tags:"Version" method:"get" summary:"Get current version information" in:"query"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
}
type GetVersionRes struct {
@@ -111,7 +112,8 @@ type GetVersionRes struct {
// Get system configuration request
type GetSystemConfigReq struct {
- g.Meta `path:"/settings/get_system_config" tags:"Settings" method:"get" summary:"Get system configuration"`
+ g.Meta `path:"/settings/get_system_config" tags:"Settings" method:"get" summary:"Get system configuration"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
}
// Get system configuration response
@@ -122,7 +124,8 @@ type GetSystemConfigRes struct {
// Set system configuration request
type SetSystemConfigReq struct {
- g.Meta `path:"/settings/set_system_config" tags:"Settings" method:"post" summary:"Set system configuration"`
+ g.Meta `path:"/settings/set_system_config" tags:"Settings" method:"post" summary:"Set system configuration"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
SystemConfig
}
@@ -133,9 +136,10 @@ type SetSystemConfigRes struct {
// Set system configuration request
type SetSystemConfigKeyReq struct {
- g.Meta `path:"/settings/set_system_config_key" tags:"Settings" method:"post" summary:"Set system configuration"`
- Key string `json:"key" dc:"configuration key"`
- Value string `json:"value" dc:"configuration value"`
+ g.Meta `path:"/settings/set_system_config_key" tags:"Settings" method:"post" summary:"Set system configuration"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Key string `json:"key" dc:"configuration key"`
+ Value string `json:"value" dc:"configuration value"`
}
type SetSystemConfigKeyRes struct {
@@ -144,9 +148,10 @@ type SetSystemConfigKeyRes struct {
// Set SSL certificate request
type SetSSLConfigReq struct {
- g.Meta `path:"/settings/set_ssl_config" tags:"Settings" method:"post" summary:"Set SSL certificate configuration"`
- CertData string `json:"certPem" dc:"certificate data"`
- KeyData string `json:"privateKey" dc:"private key data"`
+ g.Meta `path:"/settings/set_ssl_config" tags:"Settings" method:"post" summary:"Set SSL certificate configuration"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ CertData string `json:"certPem" dc:"certificate data"`
+ KeyData string `json:"privateKey" dc:"private key data"`
}
type SetSSLConfigRes struct {
@@ -154,7 +159,8 @@ type SetSSLConfigRes struct {
}
type GetTimeZoneListReq struct {
- g.Meta `path:"/settings/get_timezone_list" tags:"Settings" method:"get" summary:"Get available time zones"`
+ g.Meta `path:"/settings/get_timezone_list" tags:"Settings" method:"get" summary:"Get available time zones"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
}
type GetTimeZoneListRes struct {
api_v1.StandardRes
@@ -162,8 +168,9 @@ type GetTimeZoneListRes struct {
}
type SetIPWhitelistReq struct {
- g.Meta `path:"/settings/set_ip_whitelist" tags:"Settings" method:"post" summary:"Set IP whitelist"`
- IPList []string `json:"ip_list" dc:"IP list"`
+ g.Meta `path:"/settings/set_ip_whitelist" tags:"Settings" method:"post" summary:"Set IP whitelist"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ IPList []string `json:"ip_list" dc:"IP list"`
}
type SetIPWhitelistRes struct {
@@ -171,8 +178,9 @@ type SetIPWhitelistRes struct {
}
type DeleteIPWhitelistReq struct {
- g.Meta `path:"/settings/delete_ip_whitelist" tags:"Settings" method:"post" summary:"Delete IP whitelist"`
- ID int `json:"id" dc:"ID"`
+ g.Meta `path:"/settings/delete_ip_whitelist" tags:"Settings" method:"post" summary:"Delete IP whitelist"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ ID int `json:"id" dc:"ID"`
}
type DeleteIPWhitelistRes struct {
@@ -180,8 +188,9 @@ type DeleteIPWhitelistRes struct {
}
type AddIPWhitelistReq struct {
- g.Meta `path:"/settings/add_ip_whitelist" tags:"Settings" method:"post" summary:"Add IP whitelist"`
- IP string `json:"ip" dc:"IP"`
+ g.Meta `path:"/settings/add_ip_whitelist" tags:"Settings" method:"post" summary:"Add IP whitelist"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ IP string `json:"ip" dc:"IP"`
}
type AddIPWhitelistRes struct {
diff --git a/core/api/subscribe_list/v1/subscribe_list.go b/core/api/subscribe_list/v1/subscribe_list.go
index 74c04623..271a6af1 100644
--- a/core/api/subscribe_list/v1/subscribe_list.go
+++ b/core/api/subscribe_list/v1/subscribe_list.go
@@ -41,10 +41,11 @@ type Contact struct {
}
type SubscribeSubmitReq struct {
- g.Meta `path:"/subscribe/submit" tags:"Subscribe" method:"post" summary:"Subscribe to the service"`
- Email string `json:"email" dc:"Email address for subscription"`
- Token string `json:"token" dc:"Subscription token"`
- Attribs map[string]string `json:"attribs" dc:"Additional attributes for subscription, e.g., {'name': 'John Doe', 'phone': '1234567890'}"`
+ g.Meta `path:"/subscribe/submit" tags:"Subscribe" method:"post" summary:"Subscribe to the service"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Email string `json:"email" dc:"Email address for subscription"`
+ Token string `json:"token" dc:"Subscription token"`
+ Attribs map[string]string `json:"attribs" dc:"Additional attributes for subscription, e.g., {'name': 'John Doe', 'phone': '1234567890'}"`
}
type SubscribeSubmitRes struct {
@@ -52,9 +53,10 @@ type SubscribeSubmitRes struct {
}
type SubscribeConfirmReq struct {
- g.Meta `path:"/subscribe/confirm" tags:"Subscribe" method:"get" summary:"Confirm subscription"`
- Token string `json:"token" dc:"Subscription token"`
- Email string `json:"email" dc:"Email address for subscription"`
+ g.Meta `path:"/subscribe/confirm" tags:"Subscribe" method:"get" summary:"Confirm subscription"`
+ Authorization string `json:"authorization" dc:"Authorization" in:"header"`
+ Token string `json:"token" dc:"Subscription token"`
+ Email string `json:"email" dc:"Email address for subscription"`
}
type SubscribeConfirmRes struct {
diff --git a/core/internal/controller/rbac/rbac_v1_account.go b/core/internal/controller/rbac/rbac_v1_account.go
deleted file mode 100644
index 7aab35fc..00000000
--- a/core/internal/controller/rbac/rbac_v1_account.go
+++ /dev/null
@@ -1,384 +0,0 @@
-package rbac
-
-import (
- "billionmail-core/internal/model"
- "billionmail-core/internal/service/middlewares"
- service "billionmail-core/internal/service/rbac"
- "context"
- "time"
-
- "github.com/gogf/gf/v2/errors/gerror"
- "github.com/gogf/gf/v2/frame/g"
-
- "billionmail-core/api/rbac/v1"
-)
-
-// AccountList gets account list
-func (c *ControllerV1) AccountList(ctx context.Context, req *v1.AccountListReq) (res *v1.AccountListRes, err error) {
- res = &v1.AccountListRes{}
-
- // Check permission
- if !middlewares.HasPermission(ctx, "account", "read", "account") {
- res.SetError(gerror.New("Insufficient permissions"))
- return
- }
-
- // Get account list
- accounts, total, err := service.Account().GetList(ctx, req.Page, req.PageSize, req.Username, req.Email, req.Status)
- if err != nil {
- res.SetError(gerror.New("Failed to get account list: " + err.Error()))
- return
- }
-
- // Prepare response data
- res.Success = true
- res.Code = 0
- res.Msg = "Success"
- res.Data.Total = total
- res.Data.Page = req.Page
-
- // Convert to API response format
- res.Data.List = make([]v1.AccountInfoItem, 0, len(accounts))
- for _, account := range accounts {
- res.Data.List = append(res.Data.List, v1.AccountInfoItem{
- Id: account.AccountId,
- Username: account.Username,
- Email: account.Email,
- Status: account.Status,
- Language: account.Language,
- CreateTime: account.CreateTime,
- })
- }
-
- return
-}
-
-// AccountDetail gets account details
-func (c *ControllerV1) AccountDetail(ctx context.Context, req *v1.AccountDetailReq) (res *v1.AccountDetailRes, err error) {
- res = &v1.AccountDetailRes{}
-
- // Check permission
- if !middlewares.HasPermission(ctx, "account", "read", "account") {
- res.SetError(gerror.New("Insufficient permissions"))
- return
- }
-
- // Get account details
- account, err := service.Account().GetById(ctx, req.AccountId)
- if err != nil {
- res.SetError(gerror.New("Failed to get account details: " + err.Error()))
- return
- }
-
- // Get account roles
- roles, err := service.Account().GetAccountRoles(ctx, req.AccountId)
- if err != nil {
- res.SetError(gerror.New("Failed to get account roles: " + err.Error()))
- return
- }
-
- // Get all roles
- allRoles, err := service.Account().GetAll(ctx)
- if err != nil {
- res.SetError(gerror.New("Failed to get all roles: " + err.Error()))
- return
- }
-
- // Prepare response data
- res.Success = true
- res.Code = 0
- res.Msg = "Success"
-
- // Set account info
- res.Data.Account = v1.AccountInfoItem{
- Id: account.AccountId,
- Username: account.Username,
- Email: account.Email,
- Status: account.Status,
- Language: account.Language,
- CreateTime: account.CreateTime,
- }
-
- // Set account roles
- res.Data.Roles = make([]v1.RoleInfoItem, 0, len(roles))
- for _, role := range roles {
- res.Data.Roles = append(res.Data.Roles, v1.RoleInfoItem{
- Id: role.RoleId,
- Name: role.RoleName,
- Description: role.Description,
- Status: role.Status,
- CreateTime: role.CreateTime,
- })
- }
-
- // Set all roles
- res.Data.AllRoles = make([]v1.RoleInfoItem, 0, len(allRoles))
- for _, role := range allRoles {
- res.Data.AllRoles = append(res.Data.AllRoles, v1.RoleInfoItem{
- Id: role.RoleId,
- Name: role.RoleName,
- Description: role.Description,
- Status: role.Status,
- CreateTime: role.CreateTime,
- })
- }
-
- return
-}
-
-// AccountCreate create account
-func (c *ControllerV1) AccountCreate(ctx context.Context, req *v1.AccountCreateReq) (res *v1.AccountCreateRes, err error) {
- res = &v1.AccountCreateRes{}
-
- // Check permissions
- if !middlewares.HasPermission(ctx, "account", "create", "account") {
- res.SetError(gerror.New("Insufficient permissions"))
- return
- }
-
- // Check if username already exists
- exists, err := service.Account().UsernameExists(ctx, req.Username)
- if err != nil {
- res.SetError(gerror.New("Failed to check username: " + err.Error()))
- return
- }
- if exists {
- res.SetError(gerror.New("Username already exists"))
- return
- }
-
- // Check if email already exists
- exists, err = service.Account().EmailExists(ctx, req.Email)
- if err != nil {
- res.SetError(gerror.New("Failed to check email: " + err.Error()))
- return
- }
- if exists {
- res.SetError(gerror.New("Email already exists"))
- return
- }
-
- // Create account
- accountData := &model.Account{
- Username: req.Username,
- Password: req.Password,
- Email: req.Email,
- Status: req.Status,
- Language: req.Lang,
- }
-
- accountId, err := service.Account().Create(ctx, accountData)
- if err != nil {
- res.SetError(gerror.New("Failed to create account: " + err.Error()))
- return
- }
-
- // Assign roles
- if len(req.RoleIds) > 0 {
- for _, roleId := range req.RoleIds {
- err = service.Account().AssignRole(ctx, accountId, roleId)
- if err != nil {
- g.Log().Warning(ctx, "Failed to assign role: ", err)
- }
- }
- }
-
- // Prepare response data
- res.Success = true
- res.Code = 0
- res.Msg = "Created successfully"
- res.Data.AccountId = accountId
-
- return
-}
-
-// AccountUpdate update account
-func (c *ControllerV1) AccountUpdate(ctx context.Context, req *v1.AccountUpdateReq) (res *v1.AccountUpdateRes, err error) {
- res = &v1.AccountUpdateRes{}
-
- // Check permissions
- if !middlewares.HasPermission(ctx, "account", "update", "account") {
- res.SetError(gerror.New("Insufficient permissions"))
- return
- }
-
- // Get account
- account, err := service.Account().GetById(ctx, req.AccountId)
- if err != nil {
- res.SetError(gerror.New("Failed to get account: " + err.Error()))
- return
- }
-
- var exists bool
-
- // Check if username already exists
- if req.Username != "" && req.Username != account.Username {
- exists, err = service.Account().UsernameExists(ctx, req.Username)
- if err != nil {
- res.SetError(gerror.New("Failed to check username: " + err.Error()))
- return
- }
- if exists {
- res.SetError(gerror.New("Username already exists"))
- return
- }
- }
-
- // Check if email already exists
- if req.Email != "" && req.Email != account.Email {
- exists, err = service.Account().EmailExists(ctx, req.Email)
- if err != nil {
- res.SetError(gerror.New("Failed to check email: " + err.Error()))
- return
- }
- if exists {
- res.SetError(gerror.New("Email already exists"))
- return
- }
- }
-
- // Update account info
- updateData := &model.Account{
- AccountId: req.AccountId,
- Username: req.Username,
- Email: req.Email,
- Status: req.Status,
- Language: req.Lang,
- UpdateTime: time.Now().Unix(),
- }
-
- err = service.Account().Update(ctx, updateData)
- if err != nil {
- res.SetError(gerror.New("Failed to update account: " + err.Error()))
- return
- }
-
- // Update roles
- if len(req.RoleIds) > 0 {
- // Remove all roles first
- err = service.Account().ClearRoles(ctx, req.AccountId)
- if err != nil {
- res.SetError(gerror.New("Failed to clear roles: " + err.Error()))
- return
- }
-
- // Assign new roles
- for _, roleId := range req.RoleIds {
- err = service.Account().AssignRole(ctx, req.AccountId, roleId)
- if err != nil {
- g.Log().Warning(ctx, "Failed to assign role: ", err)
- }
- }
- }
-
- // Prepare response data
- res.Success = true
- res.Code = 0
- res.Msg = "Updated successfully"
-
- return
-}
-
-// AccountPassword update account password
-func (c *ControllerV1) AccountPassword(ctx context.Context, req *v1.AccountPasswordReq) (res *v1.AccountPasswordRes, err error) {
- res = &v1.AccountPasswordRes{}
-
- // Get current user
- currentAccountId := service.GetCurrentAccountId(ctx)
- currentRoles := service.GetCurrentRoles(ctx)
-
- // If not admin, can only modify own password
- isAdmin := false
- for _, role := range currentRoles {
- if role == "admin" {
- isAdmin = true
- break
- }
- }
-
- if !isAdmin && currentAccountId != req.AccountId {
- res.SetError(gerror.New("Insufficient permissions"))
- return
- }
-
- // If not admin, need to verify old password
- if !isAdmin && req.OldPassword == "" {
- res.SetError(gerror.New("Please provide the old password"))
- return
- }
-
- // If old password provided, verify it
- if req.OldPassword != "" {
- var account *model.Account
- account, err = service.Account().GetById(ctx, req.AccountId)
- if err != nil {
- res.SetError(gerror.New("Failed to get account: " + err.Error()))
- return
- }
-
- // Verify old password
- if !service.Account().VerifyPassword(account.Password, req.OldPassword) {
- res.SetError(gerror.New("Incorrect old password"))
- return
- }
- }
-
- // Update password
- err = service.Account().UpdatePassword(ctx, req.AccountId, req.NewPassword)
- if err != nil {
- res.SetError(gerror.New("Failed to update password: " + err.Error()))
- return
- }
-
- // Prepare response data
- res.Success = true
- res.Code = 0
- res.Msg = "Password updated successfully"
-
- return
-}
-
-// AccountDelete delete account
-func (c *ControllerV1) AccountDelete(ctx context.Context, req *v1.AccountDeleteReq) (res *v1.AccountDeleteRes, err error) {
- res = &v1.AccountDeleteRes{}
-
- // Check permissions
- if !middlewares.HasPermission(ctx, "account", "delete", "account") {
- res.SetError(gerror.New("Insufficient permissions"))
- return
- }
-
- // Get account
- account, err := service.Account().GetById(ctx, req.AccountId)
- if err != nil {
- res.SetError(gerror.New("Failed to get account: " + err.Error()))
- return
- }
-
- // Cannot delete yourself
- currentAccountId := service.GetCurrentAccountId(ctx)
- if currentAccountId == req.AccountId {
- res.SetError(gerror.New("Cannot delete your own account"))
- return
- }
-
- // Check if admin account
- if account.Username == "admin" {
- res.SetError(gerror.New("Cannot delete admin account"))
- return
- }
-
- // Delete account
- err = service.Account().Delete(ctx, req.AccountId)
- if err != nil {
- res.SetError(gerror.New("Failed to delete account: " + err.Error()))
- return
- }
-
- // Prepare response data
- res.Success = true
- res.Code = 0
- res.Msg = "Deleted successfully"
-
- return
-}
diff --git a/core/internal/controller/rbac/rbac_v1_auth.go b/core/internal/controller/rbac/rbac_v1_auth.go
index 6f2878ff..b43eadd9 100644
--- a/core/internal/controller/rbac/rbac_v1_auth.go
+++ b/core/internal/controller/rbac/rbac_v1_auth.go
@@ -204,62 +204,62 @@ func (c *ControllerV1) RefreshToken(ctx context.Context, req *v1.RefreshTokenReq
return
}
-// CurrentUser retrieves the current logged-in user information
-func (c *ControllerV1) CurrentUser(ctx context.Context, req *v1.CurrentUserReq) (res *v1.CurrentUserRes, err error) {
- res = &v1.CurrentUserRes{}
-
- // Get account ID from context
- accountId := service.GetCurrentAccountId(ctx)
- if accountId == 0 {
- err = gerror.New("Unauthorized")
- return
- }
-
- // Get account details
- account, err := service.Account().GetById(ctx, accountId)
- if err != nil {
- err = gerror.New("Failed to get account details")
- return
- }
-
- // Get account roles
- roles, err := service.Account().GetAccountRoles(ctx, accountId)
- if err != nil {
- err = gerror.New("Failed to get account roles")
- return
- }
-
- // Get account permissions
- permissions, err := service.Account().GetAccountPermissions(ctx, accountId)
- if err != nil {
- err = gerror.New("Failed to get account permissions")
- return
- }
-
- // Prepare response
- res.Success = true
- res.Code = 0
- res.Msg = "Retrieved successfully"
-
- // Set account information
- res.Data.Account.Id = account.AccountId
- res.Data.Account.Username = account.Username
- res.Data.Account.Email = account.Email
- res.Data.Account.Status = account.Status
- res.Data.Account.Lang = account.Language
-
- // Set roles
- res.Data.Roles = make([]string, 0, len(roles))
- for _, role := range roles {
- res.Data.Roles = append(res.Data.Roles, role.RoleName)
- }
-
- // Set permissions
- res.Data.Permissions = make([]string, 0, len(permissions))
- for _, perm := range permissions {
- permStr := perm.Module + ":" + perm.Action + ":" + perm.Resource
- res.Data.Permissions = append(res.Data.Permissions, permStr)
- }
-
- return
-}
+//// CurrentUser retrieves the current logged-in user information
+//func (c *ControllerV1) CurrentUser(ctx context.Context, req *v1.CurrentUserReq) (res *v1.CurrentUserRes, err error) {
+// res = &v1.CurrentUserRes{}
+//
+// // Get account ID from context
+// accountId := service.GetCurrentAccountId(ctx)
+// if accountId == 0 {
+// err = gerror.New("Unauthorized")
+// return
+// }
+//
+// // Get account details
+// account, err := service.Account().GetById(ctx, accountId)
+// if err != nil {
+// err = gerror.New("Failed to get account details")
+// return
+// }
+//
+// // Get account roles
+// roles, err := service.Account().GetAccountRoles(ctx, accountId)
+// if err != nil {
+// err = gerror.New("Failed to get account roles")
+// return
+// }
+//
+// // Get account permissions
+// permissions, err := service.Account().GetAccountPermissions(ctx, accountId)
+// if err != nil {
+// err = gerror.New("Failed to get account permissions")
+// return
+// }
+//
+// // Prepare response
+// res.Success = true
+// res.Code = 0
+// res.Msg = "Retrieved successfully"
+//
+// // Set account information
+// res.Data.Account.Id = account.AccountId
+// res.Data.Account.Username = account.Username
+// res.Data.Account.Email = account.Email
+// res.Data.Account.Status = account.Status
+// res.Data.Account.Lang = account.Language
+//
+// // Set roles
+// res.Data.Roles = make([]string, 0, len(roles))
+// for _, role := range roles {
+// res.Data.Roles = append(res.Data.Roles, role.RoleName)
+// }
+//
+// // Set permissions
+// res.Data.Permissions = make([]string, 0, len(permissions))
+// for _, perm := range permissions {
+// permStr := perm.Module + ":" + perm.Action + ":" + perm.Resource
+// res.Data.Permissions = append(res.Data.Permissions, permStr)
+// }
+//
+// return
+//}
diff --git a/core/internal/controller/rbac/rbac_v1_permission_check.go b/core/internal/controller/rbac/rbac_v1_permission_check.go
deleted file mode 100644
index fe524474..00000000
--- a/core/internal/controller/rbac/rbac_v1_permission_check.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package rbac
-
-import (
- "context"
-
- "github.com/gogf/gf/v2/errors/gcode"
- "github.com/gogf/gf/v2/errors/gerror"
-
- "billionmail-core/api/rbac/v1"
-)
-
-func (c *ControllerV1) PermissionCheck(ctx context.Context, req *v1.PermissionCheckReq) (res *v1.PermissionCheckRes, err error) {
- return nil, gerror.NewCode(gcode.CodeNotImplemented)
-}
diff --git a/core/internal/controller/rbac/rbac_v1_permission_create.go b/core/internal/controller/rbac/rbac_v1_permission_create.go
deleted file mode 100644
index 566b517d..00000000
--- a/core/internal/controller/rbac/rbac_v1_permission_create.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package rbac
-
-import (
- "context"
-
- "github.com/gogf/gf/v2/errors/gcode"
- "github.com/gogf/gf/v2/errors/gerror"
-
- "billionmail-core/api/rbac/v1"
-)
-
-func (c *ControllerV1) PermissionCreate(ctx context.Context, req *v1.PermissionCreateReq) (res *v1.PermissionCreateRes, err error) {
- return nil, gerror.NewCode(gcode.CodeNotImplemented)
-}
diff --git a/core/internal/controller/rbac/rbac_v1_permission_delete.go b/core/internal/controller/rbac/rbac_v1_permission_delete.go
deleted file mode 100644
index d874edb5..00000000
--- a/core/internal/controller/rbac/rbac_v1_permission_delete.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package rbac
-
-import (
- "context"
-
- "github.com/gogf/gf/v2/errors/gcode"
- "github.com/gogf/gf/v2/errors/gerror"
-
- "billionmail-core/api/rbac/v1"
-)
-
-func (c *ControllerV1) PermissionDelete(ctx context.Context, req *v1.PermissionDeleteReq) (res *v1.PermissionDeleteRes, err error) {
- return nil, gerror.NewCode(gcode.CodeNotImplemented)
-}
diff --git a/core/internal/controller/rbac/rbac_v1_permission_detail.go b/core/internal/controller/rbac/rbac_v1_permission_detail.go
deleted file mode 100644
index bba1f1d7..00000000
--- a/core/internal/controller/rbac/rbac_v1_permission_detail.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package rbac
-
-import (
- "context"
-
- "github.com/gogf/gf/v2/errors/gcode"
- "github.com/gogf/gf/v2/errors/gerror"
-
- "billionmail-core/api/rbac/v1"
-)
-
-func (c *ControllerV1) PermissionDetail(ctx context.Context, req *v1.PermissionDetailReq) (res *v1.PermissionDetailRes, err error) {
- return nil, gerror.NewCode(gcode.CodeNotImplemented)
-}
diff --git a/core/internal/controller/rbac/rbac_v1_permission_list.go b/core/internal/controller/rbac/rbac_v1_permission_list.go
deleted file mode 100644
index ddd9a70c..00000000
--- a/core/internal/controller/rbac/rbac_v1_permission_list.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package rbac
-
-import (
- "context"
-
- "github.com/gogf/gf/v2/errors/gcode"
- "github.com/gogf/gf/v2/errors/gerror"
-
- "billionmail-core/api/rbac/v1"
-)
-
-func (c *ControllerV1) PermissionList(ctx context.Context, req *v1.PermissionListReq) (res *v1.PermissionListRes, err error) {
- return nil, gerror.NewCode(gcode.CodeNotImplemented)
-}
diff --git a/core/internal/controller/rbac/rbac_v1_permission_update.go b/core/internal/controller/rbac/rbac_v1_permission_update.go
deleted file mode 100644
index 4167764a..00000000
--- a/core/internal/controller/rbac/rbac_v1_permission_update.go
+++ /dev/null
@@ -1,14 +0,0 @@
-package rbac
-
-import (
- "context"
-
- "github.com/gogf/gf/v2/errors/gcode"
- "github.com/gogf/gf/v2/errors/gerror"
-
- "billionmail-core/api/rbac/v1"
-)
-
-func (c *ControllerV1) PermissionUpdate(ctx context.Context, req *v1.PermissionUpdateReq) (res *v1.PermissionUpdateRes, err error) {
- return nil, gerror.NewCode(gcode.CodeNotImplemented)
-}
diff --git a/core/internal/controller/rbac/rbac_v1_role.go b/core/internal/controller/rbac/rbac_v1_role.go
deleted file mode 100644
index 7310cd2f..00000000
--- a/core/internal/controller/rbac/rbac_v1_role.go
+++ /dev/null
@@ -1,296 +0,0 @@
-package rbac
-
-import (
- "billionmail-core/internal/service/middlewares"
- service "billionmail-core/internal/service/rbac"
- "context"
-
- "github.com/gogf/gf/v2/errors/gerror"
- "github.com/gogf/gf/v2/frame/g"
-
- "billionmail-core/api/rbac/v1"
-)
-
-// RoleList gets role list
-func (c *ControllerV1) RoleList(ctx context.Context, req *v1.RoleListReq) (res *v1.RoleListRes, err error) {
- res = &v1.RoleListRes{}
-
- // Check permission
- if !middlewares.HasPermission(ctx, "role", "read", "role") {
- res.SetError(gerror.New("Insufficient permissions"))
- return
- }
-
- // Get role list
- roles, total, err := service.Role().GetList(ctx, req.Page, req.PageSize, req.Name, req.Status)
- if err != nil {
- res.SetError(gerror.New("Failed to get role list: " + err.Error()))
- return
- }
-
- // Prepare response data
- res.Success = true
- res.Code = 0
- res.Msg = "Success"
- res.Data.Total = total
- res.Data.Page = req.Page
-
- // Convert to API response format
- res.Data.List = make([]v1.RoleInfoItem, 0, len(roles))
- for _, role := range roles {
- res.Data.List = append(res.Data.List, v1.RoleInfoItem{
- Id: role.RoleId,
- Name: role.RoleName,
- Description: role.Description,
- Status: role.Status,
- CreateTime: role.CreateTime,
- })
- }
-
- return
-}
-
-// RoleDetail gets role details
-func (c *ControllerV1) RoleDetail(ctx context.Context, req *v1.RoleDetailReq) (res *v1.RoleDetailRes, err error) {
- res = &v1.RoleDetailRes{}
-
- // Check permission
- if !middlewares.HasPermission(ctx, "role", "read", "role") {
- res.SetError(gerror.New("Insufficient permissions"))
- return
- }
-
- // Get role details
- role, err := service.Role().GetById(ctx, req.RoleId)
- if err != nil {
- res.SetError(gerror.New("Failed to get role details: " + err.Error()))
- return
- }
-
- // Get role permissions
- permissions, err := service.Role().GetRolePermissions(ctx, req.RoleId)
- if err != nil {
- res.SetError(gerror.New("Failed to get role permissions: " + err.Error()))
- return
- }
-
- // Get all permissions
- allPermissions, err := service.Permission().GetAll(ctx)
- if err != nil {
- res.SetError(gerror.New("Failed to get all permissions: " + err.Error()))
- return
- }
-
- // Prepare response data
- res.Success = true
- res.Code = 0
- res.Msg = "Success"
-
- // Set role information
- res.Data.Role = v1.RoleInfoItem{
- Id: role.RoleId,
- Name: role.RoleName,
- Description: role.Description,
- Status: role.Status,
- CreateTime: role.CreateTime,
- }
-
- // Set role permissions
- res.Data.Permissions = make([]v1.PermissionInfoItem, 0, len(permissions))
- for _, perm := range permissions {
- res.Data.Permissions = append(res.Data.Permissions, v1.PermissionInfoItem{
- Id: perm.PermissionId,
- Name: perm.PermissionName,
- Description: perm.Description,
- Module: perm.Module,
- Action: perm.Action,
- Resource: perm.Resource,
- Status: perm.Status,
- CreateTime: perm.CreateTime,
- UpdateTime: perm.UpdateTime,
- })
- }
-
- // Set all permissions
- res.Data.AllPermissions = make([]v1.PermissionInfoItem, 0, len(allPermissions))
- for _, perm := range allPermissions {
- res.Data.AllPermissions = append(res.Data.AllPermissions, v1.PermissionInfoItem{
- Id: perm.PermissionId,
- Name: perm.PermissionName,
- Description: perm.Description,
- Module: perm.Module,
- Action: perm.Action,
- Resource: perm.Resource,
- Status: perm.Status,
- CreateTime: perm.CreateTime,
- UpdateTime: perm.UpdateTime,
- })
- }
-
- return
-}
-
-// RoleCreate creates a role
-func (c *ControllerV1) RoleCreate(ctx context.Context, req *v1.RoleCreateReq) (res *v1.RoleCreateRes, err error) {
- res = &v1.RoleCreateRes{}
-
- // Check permission
- if !middlewares.HasPermission(ctx, "role", "create", "role") {
- res.SetError(gerror.New("Insufficient permissions"))
- return
- }
-
- // Check if role name already exists
- exists, err := service.Role().NameExists(ctx, req.Name)
- if err != nil {
- res.SetError(gerror.New("Failed to check role name: " + err.Error()))
- return
- }
- if exists {
- res.SetError(gerror.New("Role name already exists"))
- return
- }
-
- roleId, err := service.Role().Create(ctx, req.Name, req.Description, req.Status)
- if err != nil {
- res.SetError(gerror.New("Failed to create role: " + err.Error()))
- return
- }
-
- // Assign permissions
- if len(req.PermissionIds) > 0 {
- for _, permId := range req.PermissionIds {
- err = service.Role().AssignPermission(ctx, roleId, permId)
- if err != nil {
- g.Log().Warning(ctx, "Failed to assign permission: ", err)
- }
- }
- }
-
- // Prepare response data
- res.Success = true
- res.Code = 0
- res.Msg = "Created successfully"
- res.Data.RoleId = roleId
-
- return
-}
-
-// RoleUpdate updates a role
-func (c *ControllerV1) RoleUpdate(ctx context.Context, req *v1.RoleUpdateReq) (res *v1.RoleUpdateRes, err error) {
- res = &v1.RoleUpdateRes{}
-
- // Check permission
- if !middlewares.HasPermission(ctx, "role", "update", "role") {
- res.SetError(gerror.New("Insufficient permissions"))
- return
- }
-
- // Get role
- role, err := service.Role().GetById(ctx, req.RoleId)
- if err != nil {
- res.SetError(gerror.New("Failed to get role: " + err.Error()))
- return
- }
-
- // Check if it's admin role
- if role.RoleName == "admin" && req.Name != "admin" {
- res.SetError(gerror.New("Cannot modify the name of admin role"))
- return
- }
-
- // Check if role name already exists
- if req.Name != "" && req.Name != role.RoleName {
- var exists bool
- exists, err = service.Role().NameExists(ctx, req.Name)
- if err != nil {
- res.SetError(gerror.New("Failed to check role name: " + err.Error()))
- return
- }
- if exists {
- res.SetError(gerror.New("Role name already exists"))
- return
- }
- }
-
- // Update role information
- err = service.Role().Update(ctx, req.RoleId, req.Name, req.Description, req.Status)
- if err != nil {
- res.SetError(gerror.New("Failed to update role: " + err.Error()))
- return
- }
-
- // Update permissions
- if len(req.PermissionIds) > 0 {
- // Remove all permissions first
- err = service.Role().ClearPermissions(ctx, req.RoleId)
- if err != nil {
- res.SetError(gerror.New("Failed to clear permissions: " + err.Error()))
- return
- }
-
- // Assign new permissions
- for _, permId := range req.PermissionIds {
- err = service.Role().AssignPermission(ctx, req.RoleId, permId)
- if err != nil {
- g.Log().Warning(ctx, "Failed to assign permission: ", err)
- }
- }
- }
-
- // Prepare response data
- res.Success = true
- res.Code = 0
- res.Msg = "Updated successfully"
-
- return
-}
-
-// RoleDelete deletes a role
-func (c *ControllerV1) RoleDelete(ctx context.Context, req *v1.RoleDeleteReq) (res *v1.RoleDeleteRes, err error) {
- res = &v1.RoleDeleteRes{}
-
- // Check permission
- if !middlewares.HasPermission(ctx, "role", "delete", "role") {
- res.SetError(gerror.New("Insufficient permissions"))
- return
- }
-
- // Get role
- role, err := service.Role().GetById(ctx, req.RoleId)
- if err != nil {
- res.SetError(gerror.New("Failed to get role: " + err.Error()))
- return
- }
-
- // Check if it's a reserved role
- if role.RoleName == "admin" || role.RoleName == "user" {
- res.SetError(gerror.New("Cannot delete system reserved roles"))
- return
- }
-
- // Check if the role has associated accounts
- hasAccounts, err := service.Role().HasAccounts(ctx, req.RoleId)
- if err != nil {
- res.SetError(gerror.New("Failed to check role associated accounts: " + err.Error()))
- return
- }
- if hasAccounts {
- res.SetError(gerror.New("Role has associated accounts, please remove associations first"))
- return
- }
-
- // Delete role
- err = service.Role().Delete(ctx, req.RoleId)
- if err != nil {
- res.SetError(gerror.New("Failed to delete role: " + err.Error()))
- return
- }
-
- // Prepare response data
- res.Success = true
- res.Code = 0
- res.Msg = "Deleted successfully"
-
- return
-}