update inbox

This commit is contained in:
aichy126
2023-05-24 11:02:16 +08:00
parent e12e0094d2
commit fb86b861da
5 changed files with 45 additions and 294 deletions
+6 -107
View File
@@ -3588,34 +3588,6 @@ const docTemplate = `{
}
}
},
"/answer/api/v1/question/closemsglist": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "close question msg list",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Question"
],
"summary": "close question msg list",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.RespBody"
}
}
}
}
},
"/answer/api/v1/question/info": {
"get": {
"security": [
@@ -4124,56 +4096,6 @@ const docTemplate = `{
}
}
},
"/answer/api/v1/report/type/list": {
"get": {
"description": "get report type list",
"produces": [
"application/json"
],
"tags": [
"Report"
],
"summary": "get report type list",
"parameters": [
{
"enum": [
"question",
"answer",
"comment",
"user"
],
"type": "string",
"description": "report source",
"name": "source",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handler.RespBody"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/schema.GetReportTypeResp"
}
}
}
}
]
}
}
}
}
},
"/answer/api/v1/revisions": {
"get": {
"description": "get revision list",
@@ -7003,35 +6925,6 @@ const docTemplate = `{
}
}
},
"schema.GetReportTypeResp": {
"type": "object",
"properties": {
"content_type": {
"description": "content type",
"type": "string"
},
"description": {
"description": "report description",
"type": "string"
},
"have_content": {
"description": "is have content",
"type": "boolean"
},
"name": {
"description": "report name",
"type": "string"
},
"source": {
"description": "report source",
"type": "string"
},
"type": {
"description": "report type",
"type": "integer"
}
}
},
"schema.GetRevisionResp": {
"type": "object",
"properties": {
@@ -8508,6 +8401,9 @@ const docTemplate = `{
"system",
"gravatar"
]
},
"gravatar_base_url": {
"type": "string"
}
}
},
@@ -8541,6 +8437,9 @@ const docTemplate = `{
"system",
"gravatar"
]
},
"gravatar_base_url": {
"type": "string"
}
}
},
+6 -107
View File
@@ -3576,34 +3576,6 @@
}
}
},
"/answer/api/v1/question/closemsglist": {
"get": {
"security": [
{
"ApiKeyAuth": []
}
],
"description": "close question msg list",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Question"
],
"summary": "close question msg list",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handler.RespBody"
}
}
}
}
},
"/answer/api/v1/question/info": {
"get": {
"security": [
@@ -4112,56 +4084,6 @@
}
}
},
"/answer/api/v1/report/type/list": {
"get": {
"description": "get report type list",
"produces": [
"application/json"
],
"tags": [
"Report"
],
"summary": "get report type list",
"parameters": [
{
"enum": [
"question",
"answer",
"comment",
"user"
],
"type": "string",
"description": "report source",
"name": "source",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"allOf": [
{
"$ref": "#/definitions/handler.RespBody"
},
{
"type": "object",
"properties": {
"data": {
"type": "array",
"items": {
"$ref": "#/definitions/schema.GetReportTypeResp"
}
}
}
}
]
}
}
}
}
},
"/answer/api/v1/revisions": {
"get": {
"description": "get revision list",
@@ -6991,35 +6913,6 @@
}
}
},
"schema.GetReportTypeResp": {
"type": "object",
"properties": {
"content_type": {
"description": "content type",
"type": "string"
},
"description": {
"description": "report description",
"type": "string"
},
"have_content": {
"description": "is have content",
"type": "boolean"
},
"name": {
"description": "report name",
"type": "string"
},
"source": {
"description": "report source",
"type": "string"
},
"type": {
"description": "report type",
"type": "integer"
}
}
},
"schema.GetRevisionResp": {
"type": "object",
"properties": {
@@ -8496,6 +8389,9 @@
"system",
"gravatar"
]
},
"gravatar_base_url": {
"type": "string"
}
}
},
@@ -8529,6 +8425,9 @@
"system",
"gravatar"
]
},
"gravatar_base_url": {
"type": "string"
}
}
},
+4 -69
View File
@@ -693,27 +693,6 @@ definitions:
description: url title
type: string
type: object
schema.GetReportTypeResp:
properties:
content_type:
description: content type
type: string
description:
description: report description
type: string
have_content:
description: is have content
type: boolean
name:
description: report name
type: string
source:
description: report source
type: string
type:
description: report type
type: integer
type: object
schema.GetRevisionResp:
properties:
content:
@@ -1752,6 +1731,8 @@ definitions:
- system
- gravatar
type: string
gravatar_base_url:
type: string
required:
- default_avatar
type: object
@@ -1774,6 +1755,8 @@ definitions:
- system
- gravatar
type: string
gravatar_base_url:
type: string
required:
- default_avatar
type: object
@@ -4451,23 +4434,6 @@ paths:
summary: add question and answer
tags:
- Question
/answer/api/v1/question/closemsglist:
get:
consumes:
- application/json
description: close question msg list
produces:
- application/json
responses:
"200":
description: OK
schema:
$ref: '#/definitions/handler.RespBody'
security:
- ApiKeyAuth: []
summary: close question msg list
tags:
- Question
/answer/api/v1/question/info:
get:
consumes:
@@ -4781,37 +4747,6 @@ paths:
summary: add report
tags:
- Report
/answer/api/v1/report/type/list:
get:
description: get report type list
parameters:
- description: report source
enum:
- question
- answer
- comment
- user
in: query
name: source
required: true
type: string
produces:
- application/json
responses:
"200":
description: OK
schema:
allOf:
- $ref: '#/definitions/handler.RespBody'
- properties:
data:
items:
$ref: '#/definitions/schema.GetReportTypeResp'
type: array
type: object
summary: get report type list
tags:
- Report
/answer/api/v1/revisions:
get:
description: get revision list
+24 -11
View File
@@ -1,12 +1,16 @@
package schema
const (
NotificationTypeInbox = 1
NotificationTypeAchievement = 2
NotificationNotRead = 1
NotificationRead = 2
NotificationStatusNormal = 1
NotificationStatusDelete = 10
NotificationTypeInbox = 1
NotificationTypeAchievement = 2
NotificationNotRead = 1
NotificationRead = 2
NotificationStatusNormal = 1
NotificationStatusDelete = 10
NotificationInboxTypeAll = 1
NotificationInboxTypePosts = 2
NotificationInboxTypeInvites = 3
NotificationInboxTypeVotes = 4
)
var NotificationType = map[string]int{
@@ -14,6 +18,13 @@ var NotificationType = map[string]int{
"achievement": NotificationTypeAchievement,
}
var NotificationInboxType = map[string]int{
"all": NotificationInboxTypeAll,
"posts": NotificationInboxTypePosts,
"invites": NotificationInboxTypeInvites,
"votes": NotificationInboxTypeVotes,
}
type NotificationContent struct {
ID string `json:"id"`
TriggerUserID string `json:"-"` //show userid
@@ -69,11 +80,13 @@ type RedDot struct {
}
type NotificationSearch struct {
Page int `json:"page" form:"page"` //Query number of pages
PageSize int `json:"page_size" form:"page_size"` //Search page size
Type int `json:"-" form:"-"`
TypeStr string `json:"type" form:"type"` // inbox achievement
UserID string `json:"-"`
Page int `json:"page" form:"page"` //Query number of pages
PageSize int `json:"page_size" form:"page_size"` //Search page size
Type int `json:"-" form:"-"`
TypeStr string `json:"type" form:"type"` // inbox achievement
InboxTypeStr string `json:"inbox_type" form:"inbox_type"` // inbox achievement
InboxType int `json:"-" form:"-"` // inbox achievement
UserID string `json:"-"`
}
type NotificationClearRequest struct {
@@ -123,7 +123,12 @@ func (ns *NotificationService) GetNotificationPage(ctx context.Context, searchCo
if !ok {
return pager.NewPageModel(0, resp), nil
}
searchInboxType, ok := schema.NotificationInboxType[searchCond.InboxTypeStr]
if !ok {
return pager.NewPageModel(0, resp), nil
}
searchCond.Type = searchType
searchCond.InboxType = searchInboxType
notifications, total, err := ns.notificationRepo.GetNotificationPage(ctx, searchCond)
if err != nil {
return nil, err