Browse Source
Make UserConfigService.update param partial
Update UserConfigService.update() to accept any subset of the updatable fields.
Remove the unnecessary userConfig object from DBService.initialSetup()
pull/2164/head
Aranyalma2
6 days ago
No known key found for this signature in database
GPG Key ID: F3C96A45EEC27EBB
2 changed files with
1 additions and
5 deletions
-
src/server/database/repositories/userConfig/service.ts
-
src/server/database/sqlite.ts
|
@ -54,7 +54,7 @@ export class UserConfigService { |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
update(data: UserConfigUpdateType) { |
|
|
update(data: Partial<UserConfigUpdateType>) { |
|
|
return this.#db |
|
|
return this.#db |
|
|
.update(userConfig) |
|
|
.update(userConfig) |
|
|
.set(data) |
|
|
.set(data) |
|
|
|
@ -89,18 +89,14 @@ async function initialSetup(db: DBServiceType) { |
|
|
|
|
|
|
|
|
if (WG_INITIAL_ENV.DNS) { |
|
|
if (WG_INITIAL_ENV.DNS) { |
|
|
DB_DEBUG('Setting initial DNS...'); |
|
|
DB_DEBUG('Setting initial DNS...'); |
|
|
const userConfig = await db.userConfigs.get(); |
|
|
|
|
|
await db.userConfigs.update({ |
|
|
await db.userConfigs.update({ |
|
|
...userConfig, |
|
|
|
|
|
defaultDns: WG_INITIAL_ENV.DNS, |
|
|
defaultDns: WG_INITIAL_ENV.DNS, |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (WG_INITIAL_ENV.ALLOWED_IPS) { |
|
|
if (WG_INITIAL_ENV.ALLOWED_IPS) { |
|
|
DB_DEBUG('Setting initial Allowed IPs...'); |
|
|
DB_DEBUG('Setting initial Allowed IPs...'); |
|
|
const userConfig = await db.userConfigs.get(); |
|
|
|
|
|
await db.userConfigs.update({ |
|
|
await db.userConfigs.update({ |
|
|
...userConfig, |
|
|
|
|
|
defaultAllowedIps: WG_INITIAL_ENV.ALLOWED_IPS, |
|
|
defaultAllowedIps: WG_INITIAL_ENV.ALLOWED_IPS, |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|