mirror of
https://github.com/aykhans/slash-e.git
synced 2025-07-06 13:12:36 +00:00
feat: init project
This commit is contained in:
46
api/workspace_user.go
Normal file
46
api/workspace_user.go
Normal file
@ -0,0 +1,46 @@
|
||||
package api
|
||||
|
||||
// Role is the type of a role.
|
||||
type Role string
|
||||
|
||||
const (
|
||||
// RoleAdmin is the ADMIN role.
|
||||
RoleAdmin Role = "ADMIN"
|
||||
// RoleUser is the USER role.
|
||||
RoleUser Role = "USER"
|
||||
)
|
||||
|
||||
func (e Role) String() string {
|
||||
switch e {
|
||||
case RoleAdmin:
|
||||
return "ADMIN"
|
||||
case RoleUser:
|
||||
return "USER"
|
||||
}
|
||||
return "USER"
|
||||
}
|
||||
|
||||
type WorkspaceUser struct {
|
||||
WorkspaceID int `json:"workspaceId"`
|
||||
UserID int `json:"userId"`
|
||||
Role Role `json:"role"`
|
||||
CreatedTs int64 `json:"createdTs"`
|
||||
UpdatedTs int64 `json:"updatedTs"`
|
||||
}
|
||||
|
||||
type WorkspaceUserUpsert struct {
|
||||
WorkspaceID int `json:"workspaceId"`
|
||||
UserID int `json:"userId"`
|
||||
Role Role `json:"role"`
|
||||
UpdatedTs int64 `json:"updatedTs"`
|
||||
}
|
||||
|
||||
type WorkspaceUserFind struct {
|
||||
WorkspaceID *int `json:"workspaceId"`
|
||||
UserID *int `json:"userId"`
|
||||
}
|
||||
|
||||
type WorkspaceUserDelete struct {
|
||||
WorkspaceID int `json:"workspaceId"`
|
||||
UserID int `json:"userId"`
|
||||
}
|
Reference in New Issue
Block a user