mirror of
https://github.com/standardnotes/server
synced 2026-10-11 21:13:12 -04:00
feat(syncing-server): add shared vaults, invites, messages and notifications to sync response (#665)
* feat(syncing-server): add shared vaults, invites, messages and notifications to sync response * fix(syncing-server): migration timestamps * fix: issue with migrations for notifications
This commit is contained in:
+12
@@ -23,6 +23,7 @@ describe('GetSharedVaultInvitesSentToUser', () => {
|
||||
|
||||
sharedVaultInviteRepository = {} as jest.Mocked<SharedVaultInviteRepositoryInterface>
|
||||
sharedVaultInviteRepository.findByUserUuid = jest.fn().mockResolvedValue([invite])
|
||||
sharedVaultInviteRepository.findByUserUuidUpdatedAfter = jest.fn().mockResolvedValue([invite])
|
||||
})
|
||||
|
||||
it('should return invites sent to user', async () => {
|
||||
@@ -35,6 +36,17 @@ describe('GetSharedVaultInvitesSentToUser', () => {
|
||||
expect(result.getValue()).toEqual([invite])
|
||||
})
|
||||
|
||||
it('should return invites sent to user updated after given time', async () => {
|
||||
const useCase = createUseCase()
|
||||
|
||||
const result = await useCase.execute({
|
||||
userUuid: '00000000-0000-0000-0000-000000000000',
|
||||
lastSyncTime: 123,
|
||||
})
|
||||
|
||||
expect(result.getValue()).toEqual([invite])
|
||||
})
|
||||
|
||||
it('should return empty array if no invites found', async () => {
|
||||
const useCase = createUseCase()
|
||||
|
||||
|
||||
+4
@@ -13,6 +13,10 @@ export class GetSharedVaultInvitesSentToUser implements UseCaseInterface<SharedV
|
||||
}
|
||||
const userUuid = userUuidOrError.getValue()
|
||||
|
||||
if (dto.lastSyncTime) {
|
||||
return Result.ok(await this.sharedVaultInviteRepository.findByUserUuidUpdatedAfter(userUuid, dto.lastSyncTime))
|
||||
}
|
||||
|
||||
return Result.ok(await this.sharedVaultInviteRepository.findByUserUuid(userUuid))
|
||||
}
|
||||
}
|
||||
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
export interface GetSharedVaultInvitesSentToUserDTO {
|
||||
userUuid: string
|
||||
lastSyncTime?: number
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user