mirror of
https://github.com/asphyxia-core/plugins.git
synced 2026-03-22 09:54:43 -05:00
* Big rewrite/reorganization of the code * Add support for Tune Street, fantasia, Sunny Park, Lapistoria * Add automatic convertion from plugin v1.x data to v2.x * Enable/disable score sharing between versions * Various fixes
32 lines
542 B
TypeScript
32 lines
542 B
TypeScript
import { Profile, Scores } from "../models/common";
|
|
|
|
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
|
|
}
|
|
}
|
|
}
|
|
);
|
|
}; |