{"openapi":"3.1.0","info":{"title":"Сервис пользовательских данных","description":"Серверная часть сервиса хранения и управления информации о пользователе","version":"v2026.03.02"},"paths":{"/source":{"get":{"tags":["Source"],"summary":"Get Sources","description":"Получить все источники данных","operationId":"get_sources_source_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"items":{"$ref":"#/components/schemas/SourceGet"},"type":"array","title":"Response Get Sources Source Get"}}}}}},"post":{"tags":["Source"],"summary":"Create Source","description":"Создать источник данных\n\nScopes: `[\"userdata.source.create\"]`","operationId":"create_source_source_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourcePost"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceGet"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"token":[]}]}},"/source/{id}":{"get":{"tags":["Source"],"summary":"Get Source","description":"Получить источник данных","operationId":"get_source_source__id__get","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceGet"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["Source"],"summary":"Patch Source","description":"Обновить источник данных\n\nScopes: `[\"userdata.source.update\"]`","operationId":"patch_source_source__id__patch","security":[{"token":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourcePatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SourceGet"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Source"],"summary":"Delete Source","description":"Удалить источник данных\n\nScopes: `[\"userdata.source.delete\"]`","operationId":"delete_source_source__id__delete","security":[{"token":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/category":{"post":{"tags":["Category"],"summary":"Create Category","description":"Создать категорию пользовательских данных. Получить категорию можно будет со скоупами, имена которых в category_inp.scopes\nРучка обновит документацию\n\nScopes: `[\"userdata.category.create\"]`","operationId":"create_category_category_post","security":[{"token":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryPost"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryGet"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Category"],"summary":"Get Categories","description":"Получить все категории","operationId":"get_categories_category_get","parameters":[{"name":"query","in":"query","required":false,"schema":{"type":"array","items":{"const":"param","type":"string"},"default":[],"title":"Query"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/CategoryGet"},"title":"Response Get Categories Category Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/category/{id}":{"get":{"tags":["Category"],"summary":"Get Category","description":"Получить категорию","operationId":"get_category_category__id__get","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryGet"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["Category"],"summary":"Patch Category","description":"Обновить категорию\n\nScopes: `[\"userdata.category.update\"]`","operationId":"patch_category_category__id__patch","security":[{"token":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryPatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CategoryGet"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Category"],"summary":"Delete Category","description":"Удалить категорию\n\nScopes: `[\"userdata.category.delete\"]`","operationId":"delete_category_category__id__delete","security":[{"token":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/category/{category_id}/param":{"post":{"tags":["Param"],"summary":"Create Param","description":"Создать поле внутри категории. Ответ на пользовательские данные будет такой {..., category: {...,param: '', ...}}\n\nScopes: `[\"userdata.param.create\"]`","operationId":"create_param_category__category_id__param_post","security":[{"token":[]}],"parameters":[{"name":"category_id","in":"path","required":true,"schema":{"type":"integer","title":"Category Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParamPost"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParamGet"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"tags":["Param"],"summary":"Get Params","description":"Получить все параметры категории","operationId":"get_params_category__category_id__param_get","parameters":[{"name":"category_id","in":"path","required":true,"schema":{"type":"integer","title":"Category Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/ParamGet"},"title":"Response Get Params Category  Category Id  Param Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/category/{category_id}/param/{id}":{"get":{"tags":["Param"],"summary":"Get Param","description":"Получить параметр по айди","operationId":"get_param_category__category_id__param__id__get","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}},{"name":"category_id","in":"path","required":true,"schema":{"type":"integer","title":"Category Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParamGet"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["Param"],"summary":"Patch Param","description":"Обновить параметр внутри категории\n\nScopes: `[\"userdata.param.update\"]`","operationId":"patch_param_category__category_id__param__id__patch","security":[{"token":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}},{"name":"category_id","in":"path","required":true,"schema":{"type":"integer","title":"Category Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParamPatch"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ParamGet"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"tags":["Param"],"summary":"Delete Param","description":"Удалить параметр внутри категории\n\nScopes: `[\"userdata.param.delete\"]`","operationId":"delete_param_category__category_id__param__id__delete","security":[{"token":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}},{"name":"category_id","in":"path","required":true,"schema":{"type":"integer","title":"Category Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/user/{id}":{"get":{"tags":["User"],"summary":"Get User Info","description":"Получить информацию о пользователе","operationId":"get_user_info_user__id__get","security":[{"token":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserInfoGet"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"tags":["User"],"summary":"Update User","description":"Обновить информацию о пользователе.\nОбъект - пользователь, информацию которого обновляют\nСубъект - пользователь, который обновляет - источник\n\nЕсли не указать параметр внутри категории, то ничего не обновится, если указать что-то,\nто либо создастся новая запись(в случае, если она отсутствовала у данного источника), либо отредактируется\nстарая. Если в значении параметра указан None, то соответствующая информациия удаляется из данного источника\n\nОбновлять через эту ручку можно только от имени источников admin и user.\n\nЧтобы обновить от имени админиа, надо иметь скоуп `userdata.info.admin`\nЧтобы обновить неизменяемую информацию надо обладать скоупом `userdata.info.update`\nДля обновления своей информации(источник `user`) не нужны скоупы на обновление соответствующих категорий\nДля обновления чужой информации от имени админа(источник `admin`)\nнужны скоупы на обновление всех указанных в теле запроса категорий пользовательских данных данных","operationId":"update_user_user__id__post","security":[{"token":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"integer","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserInfoUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/user":{"get":{"tags":["User"],"summary":"Get Users Info","description":"Получить информацию о пользователях.\n:param users: список id юзеров, про которых нужно вернуть информацию\n:param categories: список id категорий, параметры которых нужно вернуть\n:return: список данных о пользователях и данных категориях","operationId":"get_users_info_user_get","security":[{"token":[]}],"parameters":[{"name":"users","in":"query","required":true,"schema":{"type":"array","items":{"type":"integer"},"title":"Users"}},{"name":"categories","in":"query","required":true,"schema":{"type":"array","items":{"type":"integer"},"title":"Categories"}},{"name":"additional_data","in":"query","required":false,"schema":{"type":"array","items":{"type":"integer"},"default":[],"title":"Additional Data"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsersInfoGet"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/admin/user/{user_id}":{"get":{"tags":["Admin"],"summary":"Get User Card","description":"Получает профсоюзную информацию пользователя.\n\nСкоупы: `[\"userdata.info.admin\"]`","operationId":"get_user_card_admin_user__user_id__get","security":[{"token":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"integer","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserCardGet"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"patch":{"tags":["Admin"],"summary":"Update User Card","description":"Обновить данные в профсоюзной информации пользователя.\n\nСкоупы: `[\"userdata.info.admin\"]`\n\n - **user_id**: id пользователя.","operationId":"update_user_card_admin_user__user_id__patch","security":[{"token":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"integer","title":"User Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UserCardUpdate"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatusResponseModel"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}}},"components":{"schemas":{"CategoryGet":{"properties":{"name":{"type":"string","minLength":1,"title":"Name"},"read_scope":{"anyOf":[{"type":"string","format":"scope"},{"type":"null"}],"title":"Read Scope"},"update_scope":{"anyOf":[{"type":"string","format":"scope"},{"type":"null"}],"title":"Update Scope"},"id":{"type":"integer","title":"Id"},"params":{"anyOf":[{"items":{"$ref":"#/components/schemas/ParamGet"},"type":"array"},{"type":"null"}],"title":"Params"}},"type":"object","required":["name","id"],"title":"CategoryGet"},"CategoryPatch":{"properties":{"name":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Name"},"read_scope":{"anyOf":[{"type":"string","format":"scope"},{"type":"null"}],"title":"Read Scope"},"update_scope":{"anyOf":[{"type":"string","format":"scope"},{"type":"null"}],"title":"Update Scope"}},"type":"object","title":"CategoryPatch"},"CategoryPost":{"properties":{"name":{"type":"string","minLength":1,"title":"Name"},"read_scope":{"anyOf":[{"type":"string","format":"scope"},{"type":"null"}],"title":"Read Scope"},"update_scope":{"anyOf":[{"type":"string","format":"scope"},{"type":"null"}],"title":"Update Scope"}},"type":"object","required":["name"],"title":"CategoryPost"},"ExtendedUserInfo":{"properties":{"category":{"type":"string","title":"Category"},"param":{"type":"string","title":"Param"},"value":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value"},"user_id":{"type":"integer","title":"User Id"}},"type":"object","required":["category","param","user_id"],"title":"ExtendedUserInfo"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"ParamGet":{"properties":{"is_public":{"type":"boolean","title":"Is Public","default":false},"visible_in_user_response":{"type":"boolean","title":"Visible In User Response","default":true},"name":{"type":"string","minLength":1,"title":"Name"},"is_required":{"type":"boolean","title":"Is Required"},"changeable":{"type":"boolean","title":"Changeable"},"type":{"$ref":"#/components/schemas/ViewType"},"validation":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Validation"},"id":{"type":"integer","title":"Id"},"category_id":{"type":"integer","title":"Category Id"}},"type":"object","required":["name","is_required","changeable","type","id","category_id"],"title":"ParamGet"},"ParamPatch":{"properties":{"is_public":{"type":"boolean","title":"Is Public","default":false},"visible_in_user_response":{"type":"boolean","title":"Visible In User Response","default":true},"name":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Name"},"is_required":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Required"},"changeable":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Changeable"},"type":{"anyOf":[{"$ref":"#/components/schemas/ViewType"},{"type":"null"}]},"validation":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Validation"}},"type":"object","title":"ParamPatch"},"ParamPost":{"properties":{"is_public":{"type":"boolean","title":"Is Public","default":false},"visible_in_user_response":{"type":"boolean","title":"Visible In User Response","default":true},"name":{"type":"string","minLength":1,"title":"Name"},"is_required":{"type":"boolean","title":"Is Required"},"changeable":{"type":"boolean","title":"Changeable"},"type":{"$ref":"#/components/schemas/ViewType"},"validation":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Validation"}},"type":"object","required":["name","is_required","changeable","type"],"title":"ParamPost"},"SourceGet":{"properties":{"name":{"type":"string","minLength":1,"title":"Name"},"trust_level":{"type":"integer","exclusiveMaximum":11.0,"exclusiveMinimum":0.0,"title":"Trust Level"},"id":{"type":"integer","title":"Id"}},"type":"object","required":["name","trust_level","id"],"title":"SourceGet"},"SourcePatch":{"properties":{"name":{"anyOf":[{"type":"string","minLength":1},{"type":"null"}],"title":"Name"},"trust_level":{"anyOf":[{"type":"integer","exclusiveMaximum":11.0,"exclusiveMinimum":0.0},{"type":"null"}],"title":"Trust Level"}},"type":"object","title":"SourcePatch"},"SourcePost":{"properties":{"name":{"type":"string","minLength":1,"title":"Name"},"trust_level":{"type":"integer","exclusiveMaximum":11.0,"exclusiveMinimum":0.0,"title":"Trust Level"}},"type":"object","required":["name","trust_level"],"title":"SourcePost"},"StatusResponseModel":{"properties":{"status":{"type":"string","title":"Status"},"message":{"type":"string","title":"Message"},"ru":{"type":"string","title":"Ru"}},"type":"object","required":["status","message","ru"],"title":"StatusResponseModel"},"UserCardGet":{"properties":{"user_id":{"type":"integer","title":"User Id"},"full_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Full Name"},"student_card_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Student Card Number"},"union_card_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Union Card Number"},"is_union_member":{"type":"string","title":"Is Union Member"}},"type":"object","required":["user_id","is_union_member"],"title":"UserCardGet"},"UserCardUpdate":{"properties":{"full_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Full Name"},"student_card_number":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Student Card Number"}},"type":"object","title":"UserCardUpdate"},"UserInfo":{"properties":{"category":{"type":"string","title":"Category"},"param":{"type":"string","title":"Param"},"value":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Value"}},"type":"object","required":["category","param"],"title":"UserInfo"},"UserInfoGet":{"properties":{"items":{"items":{"$ref":"#/components/schemas/UserInfo"},"type":"array","title":"Items"}},"type":"object","required":["items"],"title":"UserInfoGet"},"UserInfoUpdate":{"properties":{"items":{"items":{"$ref":"#/components/schemas/UserInfo"},"type":"array","title":"Items"},"source":{"type":"string","minLength":1,"title":"Source"}},"type":"object","required":["items","source"],"title":"UserInfoUpdate"},"UsersInfoGet":{"properties":{"items":{"items":{"$ref":"#/components/schemas/ExtendedUserInfo"},"type":"array","title":"Items"}},"type":"object","required":["items"],"title":"UsersInfoGet"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"ViewType":{"type":"string","enum":["all","last","most_trusted"],"title":"ViewType","description":"Тип отображения пользоватльских данных в ответе `GET /user/{user_id}`\nALL: {category: {param: [val1, val2, ...]}}\nLAST: {category: {param: last_modified_value}}\nMOST_TRUSTED: {category: {param: most_trusted_value}}"}},"securitySchemes":{"token":{"type":"apiKey","in":"header","name":"Authorization"}}},"servers":[{"url":"/userdata"}]}