Task 004: add demo auth and role checks

This commit is contained in:
2026-05-21 18:31:40 +03:00
parent 7a11d50aa7
commit 7972e9a95f
26 changed files with 2207 additions and 23 deletions
+892
View File
@@ -703,6 +703,50 @@
"title": "ClaimSupportStatus",
"type": "string"
},
"CurrentUser": {
"additionalProperties": false,
"properties": {
"display_name": {
"minLength": 1,
"title": "Display Name",
"type": "string"
},
"email": {
"minLength": 1,
"title": "Email",
"type": "string"
},
"id": {
"format": "uuid",
"title": "Id",
"type": "string"
},
"role": {
"$ref": "#/components/schemas/Role"
}
},
"required": [
"id",
"email",
"display_name",
"role"
],
"title": "CurrentUser",
"type": "object"
},
"CurrentUserResponse": {
"additionalProperties": false,
"properties": {
"user": {
"$ref": "#/components/schemas/CurrentUser"
}
},
"required": [
"user"
],
"title": "CurrentUserResponse",
"type": "object"
},
"DraftSummary": {
"additionalProperties": false,
"properties": {
@@ -1285,6 +1329,19 @@
"title": "ResearchArtifactSummary",
"type": "object"
},
"ReviewActionResponse": {
"additionalProperties": false,
"properties": {
"review": {
"$ref": "#/components/schemas/ReviewSummary"
}
},
"required": [
"review"
],
"title": "ReviewActionResponse",
"type": "object"
},
"ReviewStatus": {
"enum": [
"PENDING",
@@ -1400,6 +1457,93 @@
"title": "RunnerFileRef",
"type": "object"
},
"ScriptConfigVersionCreateRequest": {
"additionalProperties": false,
"properties": {
"activate": {
"default": false,
"title": "Activate",
"type": "boolean"
},
"diff": {
"additionalProperties": true,
"title": "Diff",
"type": "object"
},
"publishing_yaml": {
"minLength": 1,
"title": "Publishing Yaml",
"type": "string"
},
"rollback_target_version_id": {
"anyOf": [
{
"format": "uuid",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Rollback Target Version Id"
},
"transform_script": {
"minLength": 1,
"title": "Transform Script",
"type": "string"
},
"version": {
"anyOf": [
{
"minimum": 1,
"type": "integer"
},
{
"type": "null"
}
],
"default": null,
"title": "Version"
}
},
"required": [
"publishing_yaml",
"transform_script"
],
"title": "ScriptConfigVersionCreateRequest",
"type": "object"
},
"ScriptConfigVersionListResponse": {
"additionalProperties": false,
"properties": {
"versions": {
"items": {
"$ref": "#/components/schemas/ScriptConfigVersionSummary"
},
"title": "Versions",
"type": "array"
}
},
"required": [
"versions"
],
"title": "ScriptConfigVersionListResponse",
"type": "object"
},
"ScriptConfigVersionResponse": {
"additionalProperties": false,
"properties": {
"version": {
"$ref": "#/components/schemas/ScriptConfigVersionSummary"
}
},
"required": [
"version"
],
"title": "ScriptConfigVersionResponse",
"type": "object"
},
"ScriptConfigVersionStatus": {
"enum": [
"DRAFT",
@@ -1559,6 +1703,244 @@
"title": "TargetSiteConfig",
"type": "object"
},
"TargetSiteConfigCreateRequest": {
"additionalProperties": false,
"properties": {
"active_script_config_version_id": {
"anyOf": [
{
"format": "uuid",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Active Script Config Version Id"
},
"audience": {
"minLength": 1,
"title": "Audience",
"type": "string"
},
"brand_voice": {
"minLength": 1,
"title": "Brand Voice",
"type": "string"
},
"default_language": {
"default": "en",
"minLength": 2,
"title": "Default Language",
"type": "string"
},
"name": {
"minLength": 1,
"title": "Name",
"type": "string"
},
"publishing_rules": {
"$ref": "#/components/schemas/PublishingRules"
},
"publishing_type": {
"default": "git_next",
"minLength": 1,
"title": "Publishing Type",
"type": "string"
},
"seo_rules": {
"additionalProperties": true,
"title": "Seo Rules",
"type": "object"
},
"slug": {
"minLength": 1,
"title": "Slug",
"type": "string"
},
"source_rules": {
"additionalProperties": true,
"title": "Source Rules",
"type": "object"
},
"visual_rules": {
"additionalProperties": true,
"title": "Visual Rules",
"type": "object"
}
},
"required": [
"name",
"slug",
"brand_voice",
"audience",
"publishing_rules"
],
"title": "TargetSiteConfigCreateRequest",
"type": "object"
},
"TargetSiteConfigResponse": {
"additionalProperties": false,
"properties": {
"site": {
"$ref": "#/components/schemas/TargetSiteConfig"
}
},
"required": [
"site"
],
"title": "TargetSiteConfigResponse",
"type": "object"
},
"TargetSiteConfigUpdateRequest": {
"additionalProperties": false,
"properties": {
"active_script_config_version_id": {
"anyOf": [
{
"format": "uuid",
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Active Script Config Version Id"
},
"audience": {
"anyOf": [
{
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Audience"
},
"brand_voice": {
"anyOf": [
{
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Brand Voice"
},
"default_language": {
"anyOf": [
{
"minLength": 2,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Default Language"
},
"name": {
"anyOf": [
{
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Name"
},
"publishing_rules": {
"anyOf": [
{
"$ref": "#/components/schemas/PublishingRules"
},
{
"type": "null"
}
],
"default": null
},
"publishing_type": {
"anyOf": [
{
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Publishing Type"
},
"seo_rules": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"title": "Seo Rules"
},
"slug": {
"anyOf": [
{
"minLength": 1,
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Slug"
},
"source_rules": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"title": "Source Rules"
},
"visual_rules": {
"anyOf": [
{
"additionalProperties": true,
"type": "object"
},
{
"type": "null"
}
],
"default": null,
"title": "Visual Rules"
}
},
"title": "TargetSiteConfigUpdateRequest",
"type": "object"
},
"UserSummary": {
"additionalProperties": false,
"properties": {
@@ -1628,6 +2010,24 @@
"/api/articles": {
"post": {
"operationId": "create_article_api_articles_post",
"parameters": [
{
"in": "header",
"name": "X-Demo-User-Email",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Demo-User-Email"
}
}
],
"requestBody": {
"content": {
"application/json": {
@@ -1666,6 +2066,498 @@
]
}
},
"/api/articles/{article_id}/plans/{plan_id}/approve": {
"post": {
"operationId": "approve_plan_api_articles__article_id__plans__plan_id__approve_post",
"parameters": [
{
"in": "path",
"name": "article_id",
"required": true,
"schema": {
"format": "uuid",
"title": "Article Id",
"type": "string"
}
},
{
"in": "path",
"name": "plan_id",
"required": true,
"schema": {
"format": "uuid",
"title": "Plan Id",
"type": "string"
}
},
{
"in": "header",
"name": "X-Demo-User-Email",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Demo-User-Email"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ReviewActionResponse"
}
}
},
"description": "Successful Response"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Approve Plan",
"tags": [
"articles"
]
}
},
"/api/me": {
"get": {
"operationId": "get_me_api_me_get",
"parameters": [
{
"in": "header",
"name": "X-Demo-User-Email",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Demo-User-Email"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CurrentUserResponse"
}
}
},
"description": "Successful Response"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Get Me",
"tags": [
"auth"
]
}
},
"/api/sites": {
"get": {
"operationId": "list_sites_api_sites_get",
"parameters": [
{
"in": "header",
"name": "X-Demo-User-Email",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Demo-User-Email"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"items": {
"$ref": "#/components/schemas/TargetSiteConfigResponse"
},
"title": "Response List Sites Api Sites Get",
"type": "array"
}
}
},
"description": "Successful Response"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "List Sites",
"tags": [
"sites"
]
},
"post": {
"operationId": "post_site_api_sites_post",
"parameters": [
{
"in": "header",
"name": "X-Demo-User-Email",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Demo-User-Email"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TargetSiteConfigCreateRequest"
}
}
},
"required": true
},
"responses": {
"201": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TargetSiteConfigResponse"
}
}
},
"description": "Successful Response"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Post Site",
"tags": [
"sites"
]
}
},
"/api/sites/{site_id}": {
"patch": {
"operationId": "patch_site_api_sites__site_id__patch",
"parameters": [
{
"in": "path",
"name": "site_id",
"required": true,
"schema": {
"format": "uuid",
"title": "Site Id",
"type": "string"
}
},
{
"in": "header",
"name": "X-Demo-User-Email",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Demo-User-Email"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TargetSiteConfigUpdateRequest"
}
}
},
"required": true
},
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TargetSiteConfigResponse"
}
}
},
"description": "Successful Response"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Patch Site",
"tags": [
"sites"
]
}
},
"/api/sites/{site_id}/publishing-config/versions": {
"get": {
"operationId": "get_script_config_versions_api_sites__site_id__publishing_config_versions_get",
"parameters": [
{
"in": "path",
"name": "site_id",
"required": true,
"schema": {
"format": "uuid",
"title": "Site Id",
"type": "string"
}
},
{
"in": "header",
"name": "X-Demo-User-Email",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Demo-User-Email"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ScriptConfigVersionListResponse"
}
}
},
"description": "Successful Response"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Get Script Config Versions",
"tags": [
"sites"
]
},
"post": {
"operationId": "post_script_config_version_api_sites__site_id__publishing_config_versions_post",
"parameters": [
{
"in": "path",
"name": "site_id",
"required": true,
"schema": {
"format": "uuid",
"title": "Site Id",
"type": "string"
}
},
{
"in": "header",
"name": "X-Demo-User-Email",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Demo-User-Email"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ScriptConfigVersionCreateRequest"
}
}
},
"required": true
},
"responses": {
"201": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ScriptConfigVersionResponse"
}
}
},
"description": "Successful Response"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Post Script Config Version",
"tags": [
"sites"
]
}
},
"/api/sites/{site_id}/publishing-config/versions/{version_id}/activate": {
"post": {
"operationId": "post_activate_script_config_version_api_sites__site_id__publishing_config_versions__version_id__activate_post",
"parameters": [
{
"in": "path",
"name": "site_id",
"required": true,
"schema": {
"format": "uuid",
"title": "Site Id",
"type": "string"
}
},
{
"in": "path",
"name": "version_id",
"required": true,
"schema": {
"format": "uuid",
"title": "Version Id",
"type": "string"
}
},
{
"in": "header",
"name": "X-Demo-User-Email",
"required": false,
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"title": "X-Demo-User-Email"
}
}
],
"responses": {
"200": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ScriptConfigVersionResponse"
}
}
},
"description": "Successful Response"
},
"422": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
},
"description": "Validation Error"
}
},
"summary": "Post Activate Script Config Version",
"tags": [
"sites"
]
}
},
"/health": {
"get": {
"operationId": "health_health_get",