Skip to content

Commit

Permalink
Add 'active' property to sync configuration and update related fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
Joao-vi committed Jan 23, 2025
1 parent 764b686 commit d037c57
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/api/sync/specs/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,7 @@ const host1Fixtures: DBFixture = {
{
url: 'http://localhost:6667',
name: 'target1',
active: true,
username: 'user',
password: 'password',
config: {
Expand All @@ -818,6 +819,7 @@ const host1Fixtures: DBFixture = {
{
url: 'http://localhost:6668',
name: 'target2',
active: true,
username: 'user2',
password: 'password2',
config: {
Expand Down Expand Up @@ -859,6 +861,7 @@ const host2Fixtures: DBFixture = {
{
url: 'http://localhost:6668',
name: 'target2',
active: true,
username: 'user2',
password: 'password2',
config: {
Expand Down Expand Up @@ -897,6 +900,7 @@ const orderedHostFixtures: DBFixture = {
{
url: 'http://localhost:6667',
name: 'target1',
active: true,
username: 'user',
password: 'password',
config: {
Expand Down
3 changes: 3 additions & 0 deletions app/api/sync/syncWorker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class InvalidSyncConfig extends Error {
interface SyncConfig {
url: string;
username: string;
active?: boolean;
password: string;
name: string;
config: {
Expand Down Expand Up @@ -69,6 +70,8 @@ export const syncWorker = {
await syncSettings.reduce(async (previousSync, config) => {
await previousSync;
const syncConfig = validateConfig(config);
if (!syncConfig?.active) return;

await this.syncronizeConfig(syncConfig);
}, Promise.resolve());
},
Expand Down
1 change: 1 addition & 0 deletions app/shared/types/settingsSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ const settingsSyncSchema = {
url: { type: 'string' },
username: { type: 'string' },
password: { type: 'string' },
active: { type: 'boolean' },
name: { type: 'string' },
config: {
type: 'object',
Expand Down
1 change: 1 addition & 0 deletions app/shared/types/settingsType.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export interface SettingsSyncSchema {
url: string;
username: string;
password: string;
active?: boolean;
name: string;
config: {
templates?: {
Expand Down

0 comments on commit d037c57

Please sign in to comment.