mirror of
https://github.com/Unleash/unleash.git
synced 2025-09-05 17:53:12 +02:00
Use key deletion from client application store
This commit is contained in:
parent
fb9ff7b210
commit
2e0a05d078
@ -32,15 +32,26 @@ const mapRow = (row): IClientInstance => ({
|
|||||||
environment: row.environment,
|
environment: row.environment,
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapToDb = (client: INewClientInstance) => ({
|
const mapToDb = (client: INewClientInstance) => {
|
||||||
app_name: client.appName,
|
const initialMap = {
|
||||||
instance_id: client.instanceId,
|
app_name: client.appName,
|
||||||
sdk_version: client.sdkVersion || '',
|
instance_id: client.instanceId,
|
||||||
sdk_type: client.sdkType,
|
sdk_version: client.sdkVersion,
|
||||||
client_ip: client.clientIp,
|
sdk_type: client.sdkType,
|
||||||
last_seen: client.lastSeen || 'now()',
|
client_ip: client.clientIp,
|
||||||
environment: client.environment || 'default',
|
last_seen: client.lastSeen || 'now()',
|
||||||
});
|
environment: client.environment,
|
||||||
|
};
|
||||||
|
|
||||||
|
Object.keys(initialMap).forEach((k) => {
|
||||||
|
if (initialMap[k] === undefined) {
|
||||||
|
// not using !temp[k] to allow false and null values to get through
|
||||||
|
delete initialMap[k];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return initialMap;
|
||||||
|
};
|
||||||
|
|
||||||
export default class ClientInstanceStore implements IClientInstanceStore {
|
export default class ClientInstanceStore implements IClientInstanceStore {
|
||||||
private db: Db;
|
private db: Db;
|
||||||
|
Loading…
Reference in New Issue
Block a user