mirror of
https://github.com/asphyxia-core/plugins.git
synced 2026-03-22 01:44:39 -05:00
33 lines
578 B
TypeScript
33 lines
578 B
TypeScript
import { Profile } from "../models/profile";
|
|
import { Scores } from "../models/scores";
|
|
|
|
export const importPnmData = async (data: {
|
|
refid: string;
|
|
profile: string;
|
|
scores: string;
|
|
}) => {
|
|
const profile = JSON.parse(data.profile);
|
|
const scores = JSON.parse(data.scores);
|
|
|
|
await DB.Update<Profile>(
|
|
data.refid,
|
|
{ collection: 'profile' },
|
|
{
|
|
$set: {
|
|
...profile
|
|
}
|
|
}
|
|
);
|
|
|
|
await DB.Upsert<Scores>(
|
|
data.refid,
|
|
{ collection: 'scores' },
|
|
{
|
|
$set: {
|
|
scores: {
|
|
...scores
|
|
}
|
|
}
|
|
}
|
|
);
|
|
}; |