wip create working(?)

This commit is contained in:
Tau
2019-11-06 17:28:30 -05:00
parent 968e98fbb4
commit a5827da590
21 changed files with 214 additions and 96 deletions
+2 -1
View File
@@ -12,6 +12,7 @@ export async function createProfile(
w: Repositories,
req: CreateProfileRequest
): Promise<GenericResponse> {
const now = new Date();
const profile: ProfileSpec = {
teamId: 2 as ExtId<Team>, // TODO
name: req.name,
@@ -32,7 +33,7 @@ export async function createProfile(
lastMileageReward: 0,
};
const profileId = await w.profile().create(profile);
const profileId = await w.profile().create(req.aimeId, profile, now);
await w.chara().save(profileId, req.chara);
await w.car().saveCar(profileId, req.car);
+12 -8
View File
@@ -6,17 +6,21 @@ export async function saveProfile(
w: Repositories,
req: SaveProfileRequest
): Promise<GenericResponse> {
const now = new Date();
const profile = await w.profile().load(req.profileId);
const chara = await w.chara().load(req.profileId);
await w.profile().save({
...profile,
lv: req.lv,
exp: req.exp,
fame: req.fame,
dpoint: req.dpoint,
mileage: req.mileage,
});
await w.profile().save(
{
...profile,
lv: req.lv,
exp: req.exp,
fame: req.fame,
dpoint: req.dpoint,
mileage: req.mileage,
},
now
);
await w.chara().save(req.profileId, {
...chara,
+6 -1
View File
@@ -6,7 +6,12 @@ export async function saveTimeAttack(
w: Repositories,
req: SaveTimeAttackRequest
): Promise<SaveTimeAttackResponse> {
await w.timeAttack().save(req.profileId, req.payload);
// Override client time since we might be doing some maintenance window
// avoidance time warping stuff
await w
.timeAttack()
.save(req.profileId, { ...req.payload, timestamp: new Date() });
return {
type: "save_time_attack_res",