feat: 同步 LightCore 应用后台 CLI

This commit is contained in:
2026-11-20 04:02:32 +08:00
parent 3eb720cfbd
commit c19c26ec2c
12 changed files with 5477 additions and 45 deletions
+344
View File
@@ -0,0 +1,344 @@
"""Named fangyus admin API operations and request schemas."""
ROUTES = {
'account': {
'create': (
'/account/create',
{'properties': {'displayName': {'maxLength': 50, 'type': 'string'},
'password': {'minLength': 8, 'type': 'string'},
'username': {'maxLength': 50, 'minLength': 3, 'type': 'string'}},
'required': ['username', 'password', 'displayName'],
'type': 'object'},
None,
),
'delete': (
'/account/delete',
{'properties': {'id': {'minimum': 1, 'type': 'integer'}}, 'required': ['id'], 'type': 'object'},
None,
),
'list': (
'/account/getList',
{'properties': {'keyword': {'type': 'string'},
'pageNo': {'default': 1, 'minimum': 1, 'type': 'integer'},
'pageSize': {'default': 20, 'maximum': 100, 'minimum': 1, 'type': 'integer'},
'role': {'type': 'string'},
'status': {'type': 'string'}},
'required': ['pageNo', 'pageSize'],
'type': 'object'},
None,
),
'reset-password': (
'/account/resetPassword',
{'properties': {'id': {'minimum': 1, 'type': 'integer'},
'password': {'minLength': 8, 'type': 'string'}},
'required': ['id', 'password'],
'type': 'object'},
None,
),
'update-status': (
'/account/updateStatus',
{'properties': {'id': {'minimum': 1, 'type': 'integer'},
'status': {'enum': ['enabled', 'disabled'], 'type': 'string'}},
'required': ['id', 'status'],
'type': 'object'},
None,
),
},
'article': {
'create': (
'/article/create',
{'properties': {'author': {'type': 'string'},
'category': {'type': 'string'},
'contentHtml': {'maxLength': 2097152, 'type': 'string'},
'description': {'type': 'string'},
'dryRun': {'type': 'boolean'},
'keywords': {'items': {'type': 'string'}, 'type': 'array'},
'seoTitle': {'type': 'string'},
'sortOrder': {'type': 'integer'},
'status': {'enum': ['draft', 'published', 'archived'], 'type': 'string'},
'title': {'maxLength': 160, 'type': 'string'}},
'required': ['category', 'title', 'contentHtml'],
'type': 'object'},
None,
),
'delete': (
'/article/delete',
{'properties': {'id': {'minimum': 1, 'type': 'integer'}}, 'required': ['id'], 'type': 'object'},
None,
),
'get': (
'/article/detail',
{'properties': {'id': {'minimum': 1, 'type': 'integer'}}, 'required': ['id'], 'type': 'object'},
None,
),
'list': (
'/article/getList',
{'properties': {'category': {'type': 'string'},
'keyword': {'type': 'string'},
'pageNo': {'default': 1, 'minimum': 1, 'type': 'integer'},
'pageSize': {'default': 20, 'maximum': 100, 'minimum': 1, 'type': 'integer'},
'status': {'type': 'string'}},
'required': ['pageNo', 'pageSize'],
'type': 'object'},
None,
),
'save': (
'/article/save',
{'properties': {'author': {'maxLength': 64, 'type': 'string'},
'category': {'enum': ['firm_news', 'industry_news', 'case_study',
'legal_education', 'professional_view'],
'type': 'string'},
'contentHtml': {'type': 'string'},
'description': {'maxLength': 320, 'type': 'string'},
'heroImage': {'type': 'string'},
'id': {'type': 'integer'},
'keywords': {'items': {'type': 'string'}, 'type': 'array'},
'seoTitle': {'maxLength': 160, 'type': 'string'},
'sortOrder': {'type': 'integer'},
'status': {'enum': ['draft', 'published', 'archived'], 'type': 'string'},
'title': {'maxLength': 160, 'type': 'string'}},
'required': ['category', 'title', 'status'],
'type': 'object'},
None,
),
'update-status': (
'/article/updateStatus',
{'properties': {'id': {'minimum': 1, 'type': 'integer'},
'status': {'enum': ['draft', 'published', 'archived'], 'type': 'string'}},
'required': ['id', 'status'],
'type': 'object'},
None,
),
},
'auth': {
'change-password': (
'/auth/changePassword',
{'properties': {'newPassword': {'minLength': 8, 'type': 'string'},
'oldPassword': {'type': 'string'}},
'required': ['oldPassword', 'newPassword'],
'type': 'object'},
None,
),
'info': (
'/auth/info',
{'properties': {}, 'required': [], 'type': 'object'},
None,
),
'update-profile': (
'/auth/updateProfile',
{'properties': {'displayName': {'maxLength': 50, 'type': 'string'}},
'required': ['displayName'],
'type': 'object'},
None,
),
},
'consultation': {
'delete': (
'/consultation/delete',
{'properties': {'id': {'minimum': 1, 'type': 'integer'}}, 'required': ['id'], 'type': 'object'},
None,
),
'get': (
'/consultation/detail',
{'properties': {'id': {'minimum': 1, 'type': 'integer'}}, 'required': ['id'], 'type': 'object'},
None,
),
'list': (
'/consultation/getList',
{'properties': {'keyword': {'type': 'string'},
'pageNo': {'default': 1, 'minimum': 1, 'type': 'integer'},
'pageSize': {'default': 20, 'maximum': 100, 'minimum': 1, 'type': 'integer'},
'practiceArea': {'type': 'string'},
'status': {'type': 'string'}},
'required': ['pageNo', 'pageSize'],
'type': 'object'},
None,
),
'update-remark': (
'/consultation/updateRemark',
{'properties': {'id': {'minimum': 1, 'type': 'integer'},
'remark': {'maxLength': 500, 'type': 'string'}},
'required': ['id'],
'type': 'object'},
None,
),
'update-status': (
'/consultation/updateStatus',
{'properties': {'id': {'minimum': 1, 'type': 'integer'},
'remark': {'maxLength': 500, 'type': 'string'},
'status': {'enum': ['new', 'contacted', 'invalid', 'closed'],
'type': 'string'}},
'required': ['id', 'status'],
'type': 'object'},
None,
),
},
'lawyer': {
'delete': (
'/lawyer/delete',
{'properties': {'id': {'minimum': 1, 'type': 'integer'}}, 'required': ['id'], 'type': 'object'},
None,
),
'get': (
'/lawyer/detail',
{'properties': {'id': {'minimum': 1, 'type': 'integer'}}, 'required': ['id'], 'type': 'object'},
None,
),
'list': (
'/lawyer/getList',
{'properties': {'practiceAreaId': {'type': 'integer'}, 'status': {'type': 'string'}},
'required': [],
'type': 'object'},
None,
),
'save': (
'/lawyer/save',
{'properties': {'biographyHtml': {'type': 'string'},
'education': {'items': {'type': 'string'}, 'type': 'array'},
'email': {'maxLength': 160, 'type': 'string'},
'id': {'type': 'integer'},
'introduction': {'maxLength': 500, 'type': 'string'},
'languages': {'items': {'type': 'string'}, 'type': 'array'},
'name': {'maxLength': 80, 'type': 'string'},
'photo': {'type': 'string'},
'position': {'maxLength': 120, 'type': 'string'},
'practiceAreaIds': {'items': {'type': 'integer'}, 'type': 'array'},
'representativeMatters': {'items': {'type': 'string'}, 'type': 'array'},
'seoTitle': {'maxLength': 160, 'type': 'string'},
'slug': {'maxLength': 160, 'type': 'string'},
'sortOrder': {'type': 'integer'},
'status': {'enum': ['draft', 'published', 'archived'], 'type': 'string'}},
'required': ['slug', 'name', 'status'],
'type': 'object'},
None,
),
},
'page': {
'delete': (
'/page/delete',
{'properties': {'id': {'minimum': 1, 'type': 'integer'}}, 'required': ['id'], 'type': 'object'},
None,
),
'get': (
'/page/detail',
{'properties': {'id': {'minimum': 1, 'type': 'integer'}}, 'required': ['id'], 'type': 'object'},
None,
),
'list': (
'/page/getList',
{'properties': {}, 'required': [], 'type': 'object'},
None,
),
'save': (
'/page/save',
{'properties': {'contentHtml': {'type': 'string'},
'heroImage': {'type': 'string'},
'id': {'type': 'integer'},
'key': {'maxLength': 80, 'type': 'string'},
'seoDescription': {'maxLength': 320, 'type': 'string'},
'seoTitle': {'maxLength': 160, 'type': 'string'},
'status': {'enum': ['draft', 'published', 'archived'], 'type': 'string'},
'subtitle': {'maxLength': 240, 'type': 'string'},
'title': {'maxLength': 160, 'type': 'string'}},
'required': ['key', 'title', 'status'],
'type': 'object'},
None,
),
},
'practice-area': {
'delete': (
'/practiceArea/delete',
{'properties': {'id': {'minimum': 1, 'type': 'integer'}}, 'required': ['id'], 'type': 'object'},
None,
),
'get': (
'/practiceArea/detail',
{'properties': {'id': {'minimum': 1, 'type': 'integer'}}, 'required': ['id'], 'type': 'object'},
None,
),
'list': (
'/practiceArea/getList',
{'properties': {'status': {'type': 'string'}}, 'required': [], 'type': 'object'},
None,
),
'save': (
'/practiceArea/save',
{'properties': {'contentHtml': {'type': 'string'},
'heroImage': {'type': 'string'},
'icon': {'maxLength': 64, 'type': 'string'},
'id': {'type': 'integer'},
'name': {'maxLength': 120, 'type': 'string'},
'seoTitle': {'maxLength': 160, 'type': 'string'},
'slug': {'maxLength': 160, 'type': 'string'},
'sortOrder': {'type': 'integer'},
'status': {'enum': ['draft', 'published', 'archived'], 'type': 'string'},
'summary': {'maxLength': 500, 'type': 'string'}},
'required': ['slug', 'name', 'status'],
'type': 'object'},
None,
),
},
'site': {
'get': (
'/site/get',
{'properties': {}, 'required': [], 'type': 'object'},
None,
),
'save': (
'/site/save',
{'properties': {'address': {'maxLength': 320, 'type': 'string'},
'businessHours': {'maxLength': 120, 'type': 'string'},
'email': {'maxLength': 160, 'type': 'string'},
'firmName': {'maxLength': 160, 'type': 'string'},
'heroImage': {'type': 'string'},
'icpNumber': {'maxLength': 80, 'type': 'string'},
'introduction': {'type': 'string'},
'logo': {'type': 'string'},
'phone': {'maxLength': 40, 'type': 'string'},
'publicSecurityNumber': {'maxLength': 80, 'type': 'string'},
'seoDescription': {'maxLength': 320, 'type': 'string'},
'shortName': {'maxLength': 80, 'type': 'string'},
'slogan': {'maxLength': 200, 'type': 'string'},
'wechatQrCode': {'type': 'string'}},
'required': ['firmName', 'shortName'],
'type': 'object'},
None,
),
},
'storage': {
'download-from-url': (
'/storage/downloadFromUrl',
{'properties': {'url': {'maxLength': 2048, 'type': 'string'}},
'required': ['url'],
'type': 'object'},
None,
),
'get-config': (
'/storage/getConfig',
{'properties': {}, 'required': [], 'type': 'object'},
None,
),
'register-external-image': (
'/storage/registerExternalImage',
{'properties': {'url': {'maxLength': 2048, 'type': 'string'}},
'required': ['url'],
'type': 'object'},
None,
),
'save-config': (
'/storage/saveConfig',
{'properties': {'bucket': {'maxLength': 120, 'type': 'string'},
'clientSecret': {'maxLength': 255, 'type': 'string'}},
'required': ['bucket'],
'type': 'object'},
None,
),
'upload-image': (
'/storage/uploadImage',
{'properties': {'file': {'format': 'binary', 'type': 'string'}},
'required': ['file'],
'type': 'object'},
'upload',
),
},
}