Skip to content

Commit

Permalink
[sc-8741] Allow to activate or deactivate a sync
Browse files Browse the repository at this point in the history
  • Loading branch information
operramon committed Mar 18, 2024
1 parent e6e9da5 commit 128dd9b
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nuclia-sync-agent-app",
"version": "1.2.2",
"version": "1.2.3",
"description": "\"This is a Nuclia Sync Agent App\"",
"main": "build/index.js",
"scripts": {
Expand Down
4 changes: 4 additions & 0 deletions server/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 1.2.3 (2024-03-18)

- Allow to activate/deactivate a sync

# 1.2.2 (2024-03-15)

- Check mimetype of the uploaded links to create either a link or a file
Expand Down
1 change: 1 addition & 0 deletions server/src/logic/sync/domain/dto/create-sync.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class CreateSyncDto {
title: this.options.title,
id: this.options.id,
filters: this.options.filters,
disabled: this.options.disabled,
};

if (this.options.labels) returnObj.labels = this.options.labels;
Expand Down
1 change: 1 addition & 0 deletions server/src/logic/sync/domain/dto/update-sync.dto.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export class UpdateSyncDto {
if (this.options.lastSyncGMT) returnObj.lastSyncGMT = this.options.lastSyncGMT;
if (this.options.foldersToSync) returnObj.foldersToSync = this.options.foldersToSync;
if (this.options.filters) returnObj.filters = this.options.filters;
if (this.options.disabled !== undefined) returnObj.disabled = this.options.disabled;

return returnObj;
}
Expand Down
5 changes: 4 additions & 1 deletion server/src/logic/sync/domain/sync.entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ export interface ISyncEntity {
lastSyncGMT?: string;
foldersToSync?: SyncItem[];
filters?: Filters;
disabled?: boolean;
}

export class SyncEntity {
Expand All @@ -83,9 +84,10 @@ export class SyncEntity {
public lastSyncGMT?: string;
public foldersToSync?: SyncItem[] = [];
public filters?: Filters;
public disabled?: boolean;

constructor(options: ISyncEntity) {
const { connector, kb, labels, title, id, lastSyncGMT, foldersToSync, filters } = options;
const { connector, kb, labels, title, id, lastSyncGMT, foldersToSync, filters, disabled } = options;
this.connector = connector;
this.kb = kb;
this.labels = labels;
Expand All @@ -94,6 +96,7 @@ export class SyncEntity {
this.lastSyncGMT = lastSyncGMT;
this.foldersToSync = foldersToSync;
this.filters = filters;
this.disabled = disabled;
this.setConnectorDefinition();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ export class SyncAllFolders implements SyncAllFoldersUseCase {

async execute() {
const syncObjects = await this.repository.getAllSync();
const syncObjectValues = Object.values(syncObjects);
const syncObjectValues = Object.values(syncObjects).filter((sync) => !sync.disabled);
if (syncObjectValues.length > 0) {
await lastValueFrom(
of(...syncObjectValues).pipe(
Expand Down

0 comments on commit 128dd9b

Please sign in to comment.