934 lines
24 KiB
JSON
934 lines
24 KiB
JSON
[
|
|
{
|
|
"createCollection": "outbox",
|
|
"validator": {
|
|
"$jsonSchema": {
|
|
"bsonType": "object",
|
|
"required": [
|
|
"_id",
|
|
"org_id",
|
|
"name",
|
|
"payload",
|
|
"created_at",
|
|
"attempts",
|
|
"published_at",
|
|
"last_error",
|
|
"deferrals",
|
|
"deferred_since",
|
|
"deferred_until"
|
|
],
|
|
"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}$"
|
|
},
|
|
"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}$"
|
|
},
|
|
"name": {
|
|
"bsonType": "string"
|
|
},
|
|
"payload": {},
|
|
"created_at": {
|
|
"bsonType": "string",
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
},
|
|
"attempts": {
|
|
"bsonType": "number"
|
|
},
|
|
"published_at": {
|
|
"bsonType": ["string", "null"],
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
},
|
|
"last_error": {
|
|
"bsonType": ["string", "null"]
|
|
},
|
|
"deferrals": {
|
|
"bsonType": "number"
|
|
},
|
|
"deferred_since": {
|
|
"bsonType": ["string", "null"],
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
},
|
|
"deferred_until": {
|
|
"bsonType": ["string", "null"],
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "outbox",
|
|
"keys": {
|
|
"created_at": 1
|
|
},
|
|
"name": "outbox_pending_idx",
|
|
"unique": false
|
|
}
|
|
},
|
|
{
|
|
"createCollection": "idempotency_keys",
|
|
"validator": {
|
|
"$jsonSchema": {
|
|
"bsonType": "object",
|
|
"required": [
|
|
"org_id",
|
|
"workspace_id",
|
|
"project_id",
|
|
"procedure",
|
|
"key",
|
|
"response",
|
|
"completed_at",
|
|
"created_at"
|
|
],
|
|
"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}$"
|
|
},
|
|
"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}$"
|
|
},
|
|
"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}$"
|
|
},
|
|
"procedure": {
|
|
"bsonType": "string"
|
|
},
|
|
"key": {
|
|
"bsonType": "string"
|
|
},
|
|
"response": {},
|
|
"completed_at": {
|
|
"bsonType": ["string", "null"],
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
},
|
|
"created_at": {
|
|
"bsonType": "string",
|
|
"pattern": "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z$"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "idempotency_keys",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"workspace_id": 1,
|
|
"project_id": 1,
|
|
"procedure": 1,
|
|
"key": 1
|
|
},
|
|
"name": "idempotency_keys_scope_key",
|
|
"unique": true
|
|
}
|
|
},
|
|
{
|
|
"createCollection": "auth_api_keys",
|
|
"validator": {
|
|
"$jsonSchema": {
|
|
"bsonType": "object",
|
|
"required": ["_id", "version", "created_at", "updated_at", "org_id", "name", "token_hash", "prefix", "user_id"],
|
|
"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}$"
|
|
},
|
|
"name": {
|
|
"bsonType": "string"
|
|
},
|
|
"token_hash": {
|
|
"bsonType": "string"
|
|
},
|
|
"prefix": {
|
|
"bsonType": "string"
|
|
},
|
|
"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}$"
|
|
},
|
|
"expires_at": {
|
|
"bsonType": ["string", "null"]
|
|
},
|
|
"revoked_at": {
|
|
"bsonType": ["string", "null"]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "auth_api_keys",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"token_hash": 1
|
|
},
|
|
"name": "auth_api_keys_org_id_token_hash_key",
|
|
"unique": true
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "auth_api_keys",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"user_id": 1
|
|
},
|
|
"name": "auth_api_keys_org_id_user_id_idx",
|
|
"unique": false
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "auth_api_keys",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"prefix": 1
|
|
},
|
|
"name": "auth_api_keys_org_id_prefix_idx",
|
|
"unique": false
|
|
}
|
|
},
|
|
{
|
|
"createCollection": "auth_sessions",
|
|
"validator": {
|
|
"$jsonSchema": {
|
|
"bsonType": "object",
|
|
"required": [
|
|
"_id",
|
|
"version",
|
|
"created_at",
|
|
"updated_at",
|
|
"user_id",
|
|
"issuer",
|
|
"subject",
|
|
"handle_hash",
|
|
"tokens",
|
|
"access_token_expires_at",
|
|
"last_seen_at",
|
|
"absolute_expires_at"
|
|
],
|
|
"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$"
|
|
},
|
|
"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}$"
|
|
},
|
|
"issuer": {
|
|
"bsonType": "string"
|
|
},
|
|
"subject": {
|
|
"bsonType": "string"
|
|
},
|
|
"handle_hash": {
|
|
"bsonType": "string"
|
|
},
|
|
"tokens": {
|
|
"bsonType": "string"
|
|
},
|
|
"access_token_expires_at": {
|
|
"bsonType": "string"
|
|
},
|
|
"last_seen_at": {
|
|
"bsonType": "string"
|
|
},
|
|
"absolute_expires_at": {
|
|
"bsonType": "string"
|
|
},
|
|
"revoked_at": {
|
|
"bsonType": ["string", "null"]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "auth_sessions",
|
|
"keys": {
|
|
"handle_hash": 1
|
|
},
|
|
"name": "auth_sessions_handle_hash_key",
|
|
"unique": true
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "auth_sessions",
|
|
"keys": {
|
|
"user_id": 1
|
|
},
|
|
"name": "auth_sessions_user_id_idx",
|
|
"unique": false
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "auth_sessions",
|
|
"keys": {
|
|
"absolute_expires_at": 1
|
|
},
|
|
"name": "auth_sessions_absolute_expires_at_idx",
|
|
"unique": false
|
|
}
|
|
},
|
|
{
|
|
"createCollection": "extensions",
|
|
"validator": {
|
|
"$jsonSchema": {
|
|
"bsonType": "object",
|
|
"required": [
|
|
"_id",
|
|
"version",
|
|
"created_at",
|
|
"updated_at",
|
|
"org_id",
|
|
"subject_type",
|
|
"subject_id",
|
|
"namespace",
|
|
"payload",
|
|
"payload_version"
|
|
],
|
|
"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}$"
|
|
},
|
|
"subject_type": {
|
|
"bsonType": "string"
|
|
},
|
|
"subject_id": {
|
|
"bsonType": "string",
|
|
"pattern": "^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$"
|
|
},
|
|
"namespace": {
|
|
"bsonType": "string"
|
|
},
|
|
"payload": {
|
|
"bsonType": "object"
|
|
},
|
|
"payload_version": {
|
|
"bsonType": "number"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "extensions",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"subject_type": 1,
|
|
"subject_id": 1,
|
|
"namespace": 1
|
|
},
|
|
"name": "extensions_org_id_subject_type_subject_id_namespace_key",
|
|
"unique": true
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "extensions",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"namespace": 1
|
|
},
|
|
"name": "extensions_org_id_namespace_idx",
|
|
"unique": false
|
|
}
|
|
},
|
|
{
|
|
"createCollection": "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"]
|
|
},
|
|
"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
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "invitations",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"token_hash": 1
|
|
},
|
|
"name": "invitations_org_id_token_hash_key",
|
|
"unique": true
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "invitations",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"email": 1
|
|
},
|
|
"name": "invitations_org_id_email_idx",
|
|
"unique": false
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "invitations",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"accepted_at": 1
|
|
},
|
|
"name": "invitations_org_id_accepted_at_idx",
|
|
"unique": false
|
|
}
|
|
},
|
|
{
|
|
"createCollection": "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"]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "org_memberships",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"user_id": 1
|
|
},
|
|
"name": "org_memberships_org_id_user_id_key",
|
|
"unique": true
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "org_memberships",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"role": 1
|
|
},
|
|
"name": "org_memberships_org_id_role_idx",
|
|
"unique": false
|
|
}
|
|
},
|
|
{
|
|
"createCollection": "organizations",
|
|
"validator": {
|
|
"$jsonSchema": {
|
|
"bsonType": "object",
|
|
"required": ["_id", "version", "created_at", "updated_at", "slug", "name", "status", "settings"],
|
|
"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$"
|
|
},
|
|
"slug": {
|
|
"bsonType": "string"
|
|
},
|
|
"name": {
|
|
"bsonType": "string"
|
|
},
|
|
"status": {
|
|
"bsonType": "string",
|
|
"enum": ["active", "suspended"]
|
|
},
|
|
"settings": {
|
|
"bsonType": "object"
|
|
},
|
|
"branding": {
|
|
"bsonType": ["object", "null"],
|
|
"properties": {
|
|
"displayName": {
|
|
"bsonType": "string"
|
|
},
|
|
"primary": {
|
|
"bsonType": "string"
|
|
},
|
|
"accent": {
|
|
"bsonType": "string"
|
|
},
|
|
"logoLight": {
|
|
"bsonType": "string"
|
|
},
|
|
"logoDark": {
|
|
"bsonType": "string"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "organizations",
|
|
"keys": {
|
|
"slug": 1
|
|
},
|
|
"name": "organizations_slug_key",
|
|
"unique": true
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "organizations",
|
|
"keys": {
|
|
"status": 1
|
|
},
|
|
"name": "organizations_status_idx",
|
|
"unique": false
|
|
}
|
|
},
|
|
{
|
|
"createCollection": "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"]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "projects",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"workspace_id": 1,
|
|
"slug": 1
|
|
},
|
|
"name": "projects_org_id_workspace_id_slug_key",
|
|
"unique": true
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "projects",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"workspace_id": 1,
|
|
"archived_at": 1
|
|
},
|
|
"name": "projects_org_id_workspace_id_archived_at_idx",
|
|
"unique": false
|
|
}
|
|
},
|
|
{
|
|
"createCollection": "users",
|
|
"validator": {
|
|
"$jsonSchema": {
|
|
"bsonType": "object",
|
|
"required": [
|
|
"_id",
|
|
"version",
|
|
"created_at",
|
|
"updated_at",
|
|
"issuer",
|
|
"subject",
|
|
"email",
|
|
"display_name",
|
|
"locale"
|
|
],
|
|
"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$"
|
|
},
|
|
"issuer": {
|
|
"bsonType": "string"
|
|
},
|
|
"subject": {
|
|
"bsonType": "string"
|
|
},
|
|
"email": {
|
|
"bsonType": "string"
|
|
},
|
|
"display_name": {
|
|
"bsonType": "string"
|
|
},
|
|
"locale": {
|
|
"bsonType": "string"
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "users",
|
|
"keys": {
|
|
"issuer": 1,
|
|
"subject": 1
|
|
},
|
|
"name": "users_issuer_subject_key",
|
|
"unique": true
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "users",
|
|
"keys": {
|
|
"email": 1
|
|
},
|
|
"name": "users_email_idx",
|
|
"unique": false
|
|
}
|
|
},
|
|
{
|
|
"createCollection": "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"]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "workspace_memberships",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"workspace_id": 1,
|
|
"user_id": 1
|
|
},
|
|
"name": "workspace_memberships_org_id_workspace_id_user_id_key",
|
|
"unique": true
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "workspace_memberships",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"user_id": 1
|
|
},
|
|
"name": "workspace_memberships_org_id_user_id_idx",
|
|
"unique": false
|
|
}
|
|
},
|
|
{
|
|
"createCollection": "workspaces",
|
|
"validator": {
|
|
"$jsonSchema": {
|
|
"bsonType": "object",
|
|
"required": [
|
|
"_id",
|
|
"version",
|
|
"created_at",
|
|
"updated_at",
|
|
"org_id",
|
|
"slug",
|
|
"name",
|
|
"is_default",
|
|
"visibility"
|
|
],
|
|
"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}$"
|
|
},
|
|
"slug": {
|
|
"bsonType": "string"
|
|
},
|
|
"name": {
|
|
"bsonType": "string"
|
|
},
|
|
"is_default": {
|
|
"bsonType": "bool"
|
|
},
|
|
"visibility": {
|
|
"bsonType": "string",
|
|
"enum": ["org", "restricted"]
|
|
}
|
|
},
|
|
"additionalProperties": false
|
|
}
|
|
}
|
|
},
|
|
{
|
|
"createIndex": {
|
|
"collection": "workspaces",
|
|
"keys": {
|
|
"org_id": 1,
|
|
"slug": 1
|
|
},
|
|
"name": "workspaces_org_id_slug_key",
|
|
"unique": true
|
|
}
|
|
}
|
|
]
|