2021-12-08 18:43:14 +03:00
|
|
|
package api
|
|
|
|
|
2023-02-22 15:07:55 +03:00
|
|
|
// MaxContentLength means the max memo content bytes is 1MB.
|
|
|
|
const MaxContentLength = 1 << 30
|
|
|
|
|
2022-07-08 17:23:27 +03:00
|
|
|
// Visibility is the type of a visibility.
|
|
|
|
type Visibility string
|
|
|
|
|
|
|
|
const (
|
|
|
|
// Public is the PUBLIC visibility.
|
|
|
|
Public Visibility = "PUBLIC"
|
2022-07-26 16:12:20 +03:00
|
|
|
// Protected is the PROTECTED visibility.
|
|
|
|
Protected Visibility = "PROTECTED"
|
2022-11-26 09:23:29 +03:00
|
|
|
// Private is the PRIVATE visibility.
|
|
|
|
Private Visibility = "PRIVATE"
|
2022-07-08 17:23:27 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func (e Visibility) String() string {
|
|
|
|
switch e {
|
|
|
|
case Public:
|
|
|
|
return "PUBLIC"
|
2022-07-26 16:12:20 +03:00
|
|
|
case Protected:
|
|
|
|
return "PROTECTED"
|
2022-11-26 09:23:29 +03:00
|
|
|
case Private:
|
2022-07-08 17:23:27 +03:00
|
|
|
return "PRIVATE"
|
|
|
|
}
|
|
|
|
return "PRIVATE"
|
|
|
|
}
|
|
|
|
|
2022-02-03 10:32:03 +03:00
|
|
|
type Memo struct {
|
2022-05-03 06:49:10 +03:00
|
|
|
ID int `json:"id"`
|
|
|
|
|
|
|
|
// Standard fields
|
2022-05-19 13:32:04 +03:00
|
|
|
RowStatus RowStatus `json:"rowStatus"`
|
|
|
|
CreatorID int `json:"creatorId"`
|
|
|
|
CreatedTs int64 `json:"createdTs"`
|
|
|
|
UpdatedTs int64 `json:"updatedTs"`
|
2022-02-03 10:32:03 +03:00
|
|
|
|
2022-05-03 06:49:10 +03:00
|
|
|
// Domain specific fields
|
2022-07-08 17:23:27 +03:00
|
|
|
Content string `json:"content"`
|
|
|
|
Visibility Visibility `json:"visibility"`
|
|
|
|
Pinned bool `json:"pinned"`
|
2022-09-05 16:14:17 +03:00
|
|
|
|
|
|
|
// Related fields
|
2023-05-01 11:09:41 +03:00
|
|
|
CreatorName string `json:"creatorName"`
|
|
|
|
ResourceList []*Resource `json:"resourceList"`
|
|
|
|
RelationList []*MemoRelation `json:"relationList"`
|
2021-12-08 18:43:14 +03:00
|
|
|
}
|
|
|
|
|
2022-02-03 10:32:03 +03:00
|
|
|
type MemoCreate struct {
|
2022-05-03 06:49:10 +03:00
|
|
|
// Standard fields
|
2023-02-11 16:32:42 +03:00
|
|
|
CreatorID int `json:"-"`
|
|
|
|
CreatedTs *int64 `json:"createdTs"`
|
2022-02-18 17:21:10 +03:00
|
|
|
|
2022-05-03 06:49:10 +03:00
|
|
|
// Domain specific fields
|
2022-08-25 17:02:32 +03:00
|
|
|
Visibility Visibility `json:"visibility"`
|
|
|
|
Content string `json:"content"`
|
2022-10-01 05:57:14 +03:00
|
|
|
|
|
|
|
// Related fields
|
2023-05-01 11:09:41 +03:00
|
|
|
ResourceIDList []int `json:"resourceIdList"`
|
|
|
|
MemoRelationList []*MemoRelationUpsert `json:"memoRelationList"`
|
2021-12-08 18:43:14 +03:00
|
|
|
}
|
|
|
|
|
2022-02-03 10:32:03 +03:00
|
|
|
type MemoPatch struct {
|
2022-12-23 13:38:24 +03:00
|
|
|
ID int `json:"-"`
|
2021-12-08 18:43:14 +03:00
|
|
|
|
2022-05-03 06:49:10 +03:00
|
|
|
// Standard fields
|
2022-10-21 14:57:57 +03:00
|
|
|
CreatedTs *int64 `json:"createdTs"`
|
|
|
|
UpdatedTs *int64
|
2022-05-19 13:32:04 +03:00
|
|
|
RowStatus *RowStatus `json:"rowStatus"`
|
2022-05-03 06:49:10 +03:00
|
|
|
|
|
|
|
// Domain specific fields
|
2022-07-08 17:23:27 +03:00
|
|
|
Content *string `json:"content"`
|
|
|
|
Visibility *Visibility `json:"visibility"`
|
2022-10-21 17:16:05 +03:00
|
|
|
|
|
|
|
// Related fields
|
2023-05-01 11:09:41 +03:00
|
|
|
ResourceIDList []int `json:"resourceIdList"`
|
|
|
|
MemoRelationList []*MemoRelationUpsert `json:"memoRelationList"`
|
2021-12-09 17:02:57 +03:00
|
|
|
}
|
|
|
|
|
2022-02-03 10:32:03 +03:00
|
|
|
type MemoFind struct {
|
2022-12-28 15:22:52 +03:00
|
|
|
ID *int
|
2022-05-03 06:49:10 +03:00
|
|
|
|
|
|
|
// Standard fields
|
2022-12-28 15:22:52 +03:00
|
|
|
RowStatus *RowStatus
|
|
|
|
CreatorID *int
|
2022-05-19 13:32:04 +03:00
|
|
|
|
|
|
|
// Domain specific fields
|
2022-07-26 16:12:20 +03:00
|
|
|
Pinned *bool
|
|
|
|
ContentSearch *string
|
|
|
|
VisibilityList []Visibility
|
2022-06-21 16:58:33 +03:00
|
|
|
|
|
|
|
// Pagination
|
2023-02-22 15:07:55 +03:00
|
|
|
Limit *int
|
|
|
|
Offset *int
|
2021-12-08 18:43:14 +03:00
|
|
|
}
|
|
|
|
|
2022-02-03 10:32:03 +03:00
|
|
|
type MemoDelete struct {
|
2022-11-06 07:21:58 +03:00
|
|
|
ID int
|
2022-02-03 10:32:03 +03:00
|
|
|
}
|