@gmetrixr/rjson
Version:
(R)ecursive Json
21 lines (20 loc) • 813 B
JavaScript
import { r, rtp, RT } from "../../../r";
import { AvatarSystem } from "../../../r/definitions/project";
/**
* Set avatar system to basic + custom if avatars are set already
*/
class Migration {
execute(projectJson) {
const pJson = projectJson;
const projectF = r.project(pJson);
const avatars = projectF.getRecords(RT.avatar);
const avatarSystem = projectF.get(rtp.project.avatar_system);
// * if avatar system is undefined and avatars have been added, then set the avatar system to basic_custom
if (avatars.length > 0 && avatarSystem === undefined) {
projectF.set(rtp.project.avatar_system, AvatarSystem.basic_custom);
}
projectF.set(rtp.project.version, 147);
}
}
const migration = new Migration();
export default migration;