-
Notifications
You must be signed in to change notification settings - Fork 373
/
notice.go
109 lines (92 loc) · 2.62 KB
/
notice.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// Copyright (c) 2021 Terminus, Inc.
//
// This program is free software: you can use, redistribute, and/or modify
// it under the terms of the GNU Affero General Public License, version 3
// or later ("AGPL"), as published by the Free Software Foundation.
//
// This program is distributed in the hope that it will be useful, but WITHOUT
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
package apistructs
import "time"
// Notice 平台公告
type Notice struct {
ID uint64 `json:"id"`
OrgID uint64 `json:"orgID"`
Content string `json:"content"`
Status NoticeStatus `json:"status"`
Creator string `json:"creator"`
CreatedAt *time.Time `json:"createdAt"`
UpdateAt *time.Time `json:"updatedAt"`
}
// NoticeStatus 平台公告状态
type NoticeStatus string
// 平台公告状态集
const (
NoticeUnpublished NoticeStatus = "unpublished"
NoticePublished NoticeStatus = "published"
NoticeDeprecated NoticeStatus = "deprecated"
)
// NoticeCreateRequest 公告创建请求
type NoticeCreateRequest struct {
Content string `json:"content"`
IdentityInfo
}
// NoticeCreateResponse 公告创建响应
type NoticeCreateResponse struct {
Header
Data Notice `json:"data"`
}
// NoticeDeleteResponse 公告删除响应
type NoticeDeleteResponse struct {
Header
Data Notice `json:"data"`
}
// NoticePublishResponse 公告删除响应
type NoticePublishResponse struct {
Header
Data Notice `json:"data"`
}
// NoticeUnPublishResponse 公告删除响应
type NoticeUnPublishResponse struct {
Header
Data Notice `json:"data"`
}
// NoticeUpdateRequest 公告更新请求
type NoticeUpdateRequest struct {
Content string `json:"content"`
ID uint64 `json:"-"`
}
// NoticeUpdateResponse 公告更新响应
type NoticeUpdateResponse struct {
Header
Data uint64 `json:"data"`
}
// NoticeListRequest 公告列表请求
type NoticeListRequest struct {
// +required 后端赋值
OrgID uint64
// +optional
Content string `schema:"content"`
// +optional
Status NoticeStatus `schema:"status"`
// +optional
PageNo uint64 `schema:"pageNo"`
// +optional
PageSize uint64 `schema:"pageSize"`
IdentityInfo
}
// NoticeListResponse 公告列表响应
type NoticeListResponse struct {
Header
UserInfoHeader
Data NoticeListResponseData `json:"data"`
}
// NoticeListResponseData 公告列表响应数据
type NoticeListResponseData struct {
Total uint64 `json:"total"`
List []Notice `json:"list"`
}