feat: 添加密码管理功能,包括 API、数据库支持和前端界面
This commit is contained in:
@@ -13,6 +13,7 @@ tags:
|
||||
- name: ImportExport
|
||||
- name: Sync
|
||||
- name: Admin
|
||||
- name: Credentials
|
||||
components:
|
||||
securitySchemes:
|
||||
bearerAuth:
|
||||
@@ -113,6 +114,53 @@ components:
|
||||
- type: 'null'
|
||||
required: [id, userId, folderId, sortOrder, title, url, urlNormalized, urlHash, visibility, source, updatedAt, deletedAt]
|
||||
|
||||
Credential:
|
||||
type: object
|
||||
properties:
|
||||
id:
|
||||
type: string
|
||||
format: uuid
|
||||
userId:
|
||||
type: string
|
||||
format: uuid
|
||||
siteOrigin:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
password:
|
||||
anyOf:
|
||||
- type: string
|
||||
- type: 'null'
|
||||
createdAt:
|
||||
type: string
|
||||
format: date-time
|
||||
updatedAt:
|
||||
type: string
|
||||
format: date-time
|
||||
required: [id, userId, siteOrigin, username, createdAt, updatedAt]
|
||||
|
||||
CredentialCreate:
|
||||
type: object
|
||||
properties:
|
||||
siteOrigin:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
required: [siteOrigin, username, password]
|
||||
|
||||
CredentialPatch:
|
||||
type: object
|
||||
properties:
|
||||
siteOrigin:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
|
||||
|
||||
FolderPatch:
|
||||
type: object
|
||||
properties:
|
||||
@@ -275,6 +323,105 @@ paths:
|
||||
schema:
|
||||
$ref: '#/components/schemas/User'
|
||||
|
||||
/credentials:
|
||||
get:
|
||||
tags: [Credentials]
|
||||
summary: List my credentials
|
||||
operationId: listCredentials
|
||||
security:
|
||||
- bearerAuth: []
|
||||
parameters:
|
||||
- in: query
|
||||
name: siteOrigin
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
- in: query
|
||||
name: includePassword
|
||||
required: false
|
||||
schema:
|
||||
type: boolean
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Credential'
|
||||
post:
|
||||
tags: [Credentials]
|
||||
summary: Create credential
|
||||
operationId: createCredential
|
||||
security:
|
||||
- bearerAuth: []
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CredentialCreate'
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Credential'
|
||||
|
||||
/credentials/{id}:
|
||||
patch:
|
||||
tags: [Credentials]
|
||||
summary: Update credential
|
||||
operationId: updateCredential
|
||||
security:
|
||||
- bearerAuth: []
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CredentialPatch'
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Credential'
|
||||
delete:
|
||||
tags: [Credentials]
|
||||
summary: Delete credential
|
||||
operationId: deleteCredential
|
||||
security:
|
||||
- bearerAuth: []
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
ok:
|
||||
type: boolean
|
||||
required: [ok]
|
||||
|
||||
/folders:
|
||||
get:
|
||||
tags: [Folders]
|
||||
@@ -684,6 +831,99 @@ paths:
|
||||
summary: List a user's folders (admin only)
|
||||
operationId: adminListUserFolders
|
||||
security:
|
||||
|
||||
/admin/users/{id}/credentials:
|
||||
get:
|
||||
tags: [Admin]
|
||||
summary: List a user's credentials
|
||||
operationId: adminListUserCredentials
|
||||
security:
|
||||
- bearerAuth: []
|
||||
parameters:
|
||||
- in: path
|
||||
name: id
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
- in: query
|
||||
name: includePassword
|
||||
required: false
|
||||
schema:
|
||||
type: boolean
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: '#/components/schemas/Credential'
|
||||
|
||||
/admin/users/{userId}/credentials/{credentialId}:
|
||||
patch:
|
||||
tags: [Admin]
|
||||
summary: Update a user's credential
|
||||
operationId: adminUpdateUserCredential
|
||||
security:
|
||||
- bearerAuth: []
|
||||
parameters:
|
||||
- in: path
|
||||
name: userId
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
- in: path
|
||||
name: credentialId
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CredentialPatch'
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/Credential'
|
||||
delete:
|
||||
tags: [Admin]
|
||||
summary: Delete a user's credential
|
||||
operationId: adminDeleteUserCredential
|
||||
security:
|
||||
- bearerAuth: []
|
||||
parameters:
|
||||
- in: path
|
||||
name: userId
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
- in: path
|
||||
name: credentialId
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
format: uuid
|
||||
responses:
|
||||
'200':
|
||||
description: OK
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
ok:
|
||||
type: boolean
|
||||
required: [ok]
|
||||
- bearerAuth: []
|
||||
parameters:
|
||||
- in: path
|
||||
|
||||
Reference in New Issue
Block a user