mirror of
https://github.com/standardnotes/server
synced 2026-10-19 00:03:11 -04:00
* feat(syncing-server): associating existing items with key systems and shared vaults * fix(syncing-server): find item query * feat(syncing-server): add persistence of shared vaults with users and invites * feat: shared vault controllers
46 lines
1.6 KiB
TypeScript
46 lines
1.6 KiB
TypeScript
import { Request, Response } from 'express'
|
|
import { inject } from 'inversify'
|
|
import { BaseHttpController, controller, httpDelete, httpGet } from 'inversify-express-utils'
|
|
import { TYPES } from '../../Bootstrap/Types'
|
|
import { ServiceProxyInterface } from '../../Service/Http/ServiceProxyInterface'
|
|
import { EndpointResolverInterface } from '../../Service/Resolver/EndpointResolverInterface'
|
|
|
|
@controller('/v1/shared-vaults/:sharedVaultUuid/users', TYPES.RequiredCrossServiceTokenMiddleware)
|
|
export class SharedVaultUsersController extends BaseHttpController {
|
|
constructor(
|
|
@inject(TYPES.ServiceProxy) private httpService: ServiceProxyInterface,
|
|
@inject(TYPES.EndpointResolver) private endpointResolver: EndpointResolverInterface,
|
|
) {
|
|
super()
|
|
}
|
|
|
|
@httpGet('/')
|
|
async getSharedVaultUsers(request: Request, response: Response): Promise<void> {
|
|
await this.httpService.callSyncingServer(
|
|
request,
|
|
response,
|
|
this.endpointResolver.resolveEndpointOrMethodIdentifier(
|
|
'GET',
|
|
'/shared-vaults/:sharedVaultUuid/users',
|
|
request.params.sharedVaultUuid,
|
|
),
|
|
request.body,
|
|
)
|
|
}
|
|
|
|
@httpDelete('/:userUuid')
|
|
async removeUserFromSharedVault(request: Request, response: Response): Promise<void> {
|
|
await this.httpService.callSyncingServer(
|
|
request,
|
|
response,
|
|
this.endpointResolver.resolveEndpointOrMethodIdentifier(
|
|
'DELETE',
|
|
'/shared-vaults/:sharedVaultUuid/users/:userUuid',
|
|
request.params.sharedVaultUuid,
|
|
request.params.userUuid,
|
|
),
|
|
request.body,
|
|
)
|
|
}
|
|
}
|