/
schema.go
51 lines (40 loc) · 1.57 KB
/
schema.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
package project
import "github.com/litmuschaos/litmus/chaoscenter/graphql/server/pkg/database/mongodb"
// Project contains the required fields to be stored in the database for a project
type Project struct {
mongodb.Audit `bson:",inline"`
ID string `bson:"_id"`
Name string `bson:"name"`
Members []*Member `bson:"members"`
State *string `bson:"state"`
}
// Member contains the required fields to be stored in the database for a member
type Member struct {
UserID string `bson:"user_id"`
Role MemberRole `bson:"role"`
Invitation Invitation `bson:"invitation"`
JoinedAt int64 `bson:"joined_at"`
}
// MemberRole defines the project role a member has in the project
type MemberRole string
const (
RoleOwner MemberRole = "Owner"
RoleEditor MemberRole = "Editor"
RoleViewer MemberRole = "Viewer"
)
// Invitation defines the type of the invitation that is sent by the Owner of the project to other users
type Invitation string
const (
// PendingInvitation is the state when the Invitation is sent but not accepted
PendingInvitation Invitation = "Pending"
// AcceptedInvitation is the state when the Invitation is accepted
AcceptedInvitation Invitation = "Accepted"
// DeclinedInvitation is the state when the Invitation is rejected/declined
DeclinedInvitation Invitation = "Declined"
// ExitedProject is the state when the user has exited the project
ExitedProject Invitation = "Exited"
)
type ProjectCreationEvent struct {
OperationType string `bson:"operationType"`
FullDocument Project `bson:"fullDocument"`
}