perf(savedMessages): save a db lookup and message content decryption by building the returned entity manually after creation
This commit is contained in:
parent
f582640e8e
commit
e5389c0e55
2 changed files with 10 additions and 1 deletions
7
backend/src/data/buildEntity.ts
Normal file
7
backend/src/data/buildEntity.ts
Normal file
|
@ -0,0 +1,7 @@
|
|||
export function buildEntity<T extends any>(Entity: new () => T, data: Partial<T>): T {
|
||||
const instance = new Entity();
|
||||
for (const [key, value] of Object.entries(data)) {
|
||||
instance[key] = value;
|
||||
}
|
||||
return instance;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue