418 lines
11 KiB
JSON
418 lines
11 KiB
JSON
[
|
|
{
|
|
"createCollection": "tenancy_roles",
|
|
"validator": {
|
|
"$jsonSchema": {
|
|
"bsonType": "object",
|
|
"required": [
|
|
"_id",
|
|
"version",
|
|
"created_at",
|
|
"updated_at",
|
|
"org_id",
|
|
"key",
|
|
"name",
|
|
"level",
|
|
"permissions",
|
|
"known_permissions",
|
|
"revision"
|
|
],
|
|
"properties": {
|
|
"_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"version": {
|
|
"bsonType": "number"
|
|
},
|
|
"created_at": {
|
|
"bsonType": "string",
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
},
|
|
"updated_at": {
|
|
"bsonType": "string",
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
},
|
|
"org_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"key": {
|
|
"bsonType": "string"
|
|
},
|
|
"name": {
|
|
"bsonType": "string"
|
|
},
|
|
"level": {
|
|
"bsonType": "string",
|
|
"enum": ["org", "workspace", "project"]
|
|
},
|
|
"permissions": {
|
|
"bsonType": "array",
|
|
"items": {
|
|
"bsonType": "string"
|
|
}
|
|
},
|
|
"known_permissions": {
|
|
"bsonType": "array",
|
|
"items": {
|
|
"bsonType": "string"
|
|
}
|
|
},
|
|
"created_by": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"revision": {
|
|
"bsonType": "number"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "tenancy_roles",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"key": 1
|
|
},
|
|
"name": "tenancy_roles_org_id_key_key",
|
|
"unique": true
|
|
}
|
|
},
|
|
{
|
|
"createCollection": "project_memberships",
|
|
"validator": {
|
|
"$jsonSchema": {
|
|
"bsonType": "object",
|
|
"required": ["_id", "version", "created_at", "updated_at", "org_id", "project_id", "user_id", "role_key"],
|
|
"properties": {
|
|
"_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"version": {
|
|
"bsonType": "number"
|
|
},
|
|
"created_at": {
|
|
"bsonType": "string",
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
},
|
|
"updated_at": {
|
|
"bsonType": "string",
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
},
|
|
"org_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"project_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"user_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"role_key": {
|
|
"bsonType": "string"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "project_memberships",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"project_id": 1,
|
|
"user_id": 1
|
|
},
|
|
"name": "project_memberships_org_id_project_id_user_id_key",
|
|
"unique": true
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "project_memberships",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"user_id": 1
|
|
},
|
|
"name": "project_memberships_org_id_user_id_idx",
|
|
"unique": false
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "project_memberships",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"role_key": 1
|
|
},
|
|
"name": "project_memberships_org_id_role_key_idx",
|
|
"unique": false
|
|
}
|
|
},
|
|
{
|
|
"collMod": "org_memberships",
|
|
"validator": {
|
|
"$jsonSchema": {
|
|
"bsonType": "object",
|
|
"required": ["_id", "version", "created_at", "updated_at", "org_id", "user_id", "role"],
|
|
"properties": {
|
|
"_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"version": {
|
|
"bsonType": "number"
|
|
},
|
|
"created_at": {
|
|
"bsonType": "string",
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
},
|
|
"updated_at": {
|
|
"bsonType": "string",
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
},
|
|
"org_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"user_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"role": {
|
|
"bsonType": "string",
|
|
"enum": ["viewer", "member", "admin", "owner"]
|
|
},
|
|
"role_key": {
|
|
"bsonType": ["string", "null"]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"collMod": "workspace_memberships",
|
|
"validator": {
|
|
"$jsonSchema": {
|
|
"bsonType": "object",
|
|
"required": ["_id", "version", "created_at", "updated_at", "org_id", "workspace_id", "user_id", "role"],
|
|
"properties": {
|
|
"_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"version": {
|
|
"bsonType": "number"
|
|
},
|
|
"created_at": {
|
|
"bsonType": "string",
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
},
|
|
"updated_at": {
|
|
"bsonType": "string",
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
},
|
|
"org_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"workspace_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"user_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"role": {
|
|
"bsonType": "string",
|
|
"enum": ["viewer", "editor", "admin"]
|
|
},
|
|
"role_key": {
|
|
"bsonType": ["string", "null"]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"collMod": "invitations",
|
|
"validator": {
|
|
"$jsonSchema": {
|
|
"bsonType": "object",
|
|
"required": [
|
|
"_id",
|
|
"version",
|
|
"created_at",
|
|
"updated_at",
|
|
"org_id",
|
|
"email",
|
|
"role",
|
|
"workspace_id",
|
|
"token_hash",
|
|
"expires_at",
|
|
"invited_by"
|
|
],
|
|
"properties": {
|
|
"_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"version": {
|
|
"bsonType": "number"
|
|
},
|
|
"created_at": {
|
|
"bsonType": "string",
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
},
|
|
"updated_at": {
|
|
"bsonType": "string",
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
},
|
|
"org_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"email": {
|
|
"bsonType": "string"
|
|
},
|
|
"role": {
|
|
"bsonType": "string",
|
|
"enum": ["viewer", "member", "admin", "owner"]
|
|
},
|
|
"workspace_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"workspace_role": {
|
|
"bsonType": ["string", "null"],
|
|
"enum": ["viewer", "editor", "admin"]
|
|
},
|
|
"role_key": {
|
|
"bsonType": ["string", "null"]
|
|
},
|
|
"token_hash": {
|
|
"bsonType": "string"
|
|
},
|
|
"expires_at": {
|
|
"bsonType": "string"
|
|
},
|
|
"accepted_at": {
|
|
"bsonType": ["string", "null"]
|
|
},
|
|
"invited_by": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"collMod": "projects",
|
|
"validator": {
|
|
"$jsonSchema": {
|
|
"bsonType": "object",
|
|
"required": [
|
|
"_id",
|
|
"version",
|
|
"created_at",
|
|
"updated_at",
|
|
"org_id",
|
|
"workspace_id",
|
|
"slug",
|
|
"name",
|
|
"module_key"
|
|
],
|
|
"properties": {
|
|
"_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"version": {
|
|
"bsonType": "number"
|
|
},
|
|
"created_at": {
|
|
"bsonType": "string",
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
},
|
|
"updated_at": {
|
|
"bsonType": "string",
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
},
|
|
"org_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"workspace_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"slug": {
|
|
"bsonType": "string"
|
|
},
|
|
"name": {
|
|
"bsonType": "string"
|
|
},
|
|
"module_key": {
|
|
"bsonType": "string"
|
|
},
|
|
"archived_at": {
|
|
"bsonType": ["string", "null"]
|
|
},
|
|
"visibility": {
|
|
"bsonType": "string",
|
|
"enum": ["workspace", "restricted"]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "org_memberships",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"role_key": 1
|
|
},
|
|
"name": "org_memberships_org_id_role_key_idx",
|
|
"unique": false
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "workspace_memberships",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"role_key": 1
|
|
},
|
|
"name": "workspace_memberships_org_id_role_key_idx",
|
|
"unique": false
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "invitations",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"role_key": 1
|
|
},
|
|
"name": "invitations_org_id_role_key_idx",
|
|
"unique": false
|
|
}
|
|
}
|
|
]
|