/
ProjectMember.go
42 lines (37 loc) · 1.12 KB
/
ProjectMember.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
package domain
import (
"github.com/tidwall/gjson"
"github.com/yockii/celestial/internal/module/project/model"
"github.com/yockii/ruomu-core/server"
)
type ProjectMemberListRequest struct {
model.ProjectMember
CreateTimeCondition *server.TimeCondition `json:"createTimeCondition"`
OrderBy string `json:"orderBy"`
}
type ProjectMemberLite struct {
UserID uint64 `json:"userId,string"`
Username string `json:"username"`
RealName string `json:"realName"`
RoleID uint64 `json:"roleId,string"`
}
type ProjectMemberBatchAddRequest struct {
ProjectID uint64 `json:"projectId,string"`
RoleIdList []uint64 `json:"roleIdList"`
UserIdList []uint64 `json:"userIdList"`
}
func (r *ProjectMemberBatchAddRequest) UnmarshalJSON(b []byte) error {
j := gjson.ParseBytes(b)
r.ProjectID = j.Get("projectId").Uint()
if j.Get("roleIdList").Exists() {
for _, v := range j.Get("roleIdList").Array() {
r.RoleIdList = append(r.RoleIdList, v.Uint())
}
}
if j.Get("userIdList").Exists() {
for _, v := range j.Get("userIdList").Array() {
r.UserIdList = append(r.UserIdList, v.Uint())
}
}
return nil
}