idz: Remove profile ext id

Turns out (while researching team creation) the profile ext id
is just the aime id. After creating a team a profile discovery
request is immediately issued with the "profile id" in the field
that holds the aime id during initial profile load.
This commit is contained in:
Tau
2019-11-06 17:28:30 -05:00
parent 7c96253160
commit c2b0bcabc4
70 changed files with 238 additions and 341 deletions
+1 -1
View File
@@ -46,6 +46,6 @@ export async function createProfile(
return {
type: "generic_res",
status: profileId, // "Generic response" my fucking *ass*
status: req.aimeId, // "Generic response" my fucking *ass*
};
}
+3 -1
View File
@@ -6,8 +6,10 @@ export async function discoverProfile(
w: Repositories,
req: DiscoverProfileRequest
): Promise<DiscoverProfileResponse> {
const profileId = await w.profile().find(req.aimeId);
return {
type: "discover_profile_res",
exists: await w.profile().discoverByAimeId(req.aimeId),
exists: profileId !== undefined,
};
}
+3 -1
View File
@@ -6,8 +6,10 @@ export async function loadGarage(
w: Repositories,
req: LoadGarageRequest
): Promise<LoadGarageResponse> {
const profileId = await w.profile().find(req.aimeId);
return {
type: "load_garage_res",
cars: await w.car().loadAllCars(req.profileId),
cars: await w.car().loadAllCars(profileId),
};
}
+17 -13
View File
@@ -6,27 +6,31 @@ export async function loadProfile(
w: Repositories,
req: LoadProfileRequest
): Promise<LoadProfileResponse> {
const { aimeId } = req;
const profileId = await w.profile().find(aimeId);
// Promise.all would be messy here, who cares anyway this isn't supposed to
// be a high-performance server.
const profile = await w.profile().loadByAimeId(req.aimeId);
const settings = await w.settings().load(profile.id);
const chara = await w.chara().load(profile.id);
const titles = await w.titles().loadAll(profile.id);
const coursePlays = await w.coursePlays().loadAll(profile.id);
const missions = await w.missions().load(profile.id);
const car = await w.car().loadSelectedCar(profile.id);
const carCount = await w.car().countCars(profile.id);
const story = await w.story().load(profile.id);
const timeAttack = await w.timeAttack().loadAll(profile.id);
const unlocks = await w.unlocks().load(profile.id);
const tickets = await w.tickets().load(profile.id);
const profile = await w.profile().load(profileId);
const settings = await w.settings().load(profileId);
const chara = await w.chara().load(profileId);
const titles = await w.titles().loadAll(profileId);
const coursePlays = await w.coursePlays().loadAll(profileId);
const missions = await w.missions().load(profileId);
const car = await w.car().loadSelectedCar(profileId);
const carCount = await w.car().countCars(profileId);
const story = await w.story().load(profileId);
const timeAttack = await w.timeAttack().loadAll(profileId);
const unlocks = await w.unlocks().load(profileId);
const tickets = await w.tickets().load(profileId);
return {
type: "load_profile_res",
format: req.format as any, // TS fart
name: profile.name,
profileId: profile.id,
aimeId,
lv: profile.lv,
exp: profile.exp,
fame: profile.fame,
+2 -1
View File
@@ -6,7 +6,8 @@ export async function loadStocker(
w: Repositories,
req: LoadStockerRequest
): Promise<LoadStockerResponse> {
const backgrounds = await w.backgrounds().loadAll(req.profileId);
const profileId = await w.profile().find(req.aimeId);
const backgrounds = await w.backgrounds().loadAll(profileId);
return {
type: "load_stocker_res",
+3 -1
View File
@@ -6,7 +6,9 @@ export async function saveNewCar(
w: Repositories,
req: SaveNewCarRequest
): Promise<SaveNewCarResponse> {
await w.car().saveCar(req.profileId, req.car);
const profileId = await w.profile().find(req.aimeId);
await w.car().saveCar(profileId, req.car);
return {
type: "save_new_car_res",
+12 -11
View File
@@ -7,8 +7,9 @@ export async function saveProfile(
req: SaveProfileRequest
): Promise<GenericResponse> {
const now = new Date();
const profile = await w.profile().load(req.profileId);
const chara = await w.chara().load(req.profileId);
const profileId = await w.profile().find(req.aimeId);
const profile = await w.profile().load(profileId);
const chara = await w.chara().load(profileId);
await w.profile().save(
{
@@ -22,20 +23,20 @@ export async function saveProfile(
now
);
await w.chara().save(req.profileId, {
await w.chara().save(profileId, {
...chara,
title: req.title,
background: req.background,
});
await w.car().saveCar(req.profileId, req.car);
await w.coursePlays().saveAll(req.profileId, req.coursePlays);
await w.missions().save(req.profileId, req.missions);
await w.story().save(req.profileId, req.story);
await w.titles().saveAll(req.profileId, req.titles);
await w.unlocks().save(req.profileId, req.unlocks);
await w.settings().save(req.profileId, req.settings);
await w.tickets().save(req.profileId, req.tickets);
await w.car().saveCar(profileId, req.car);
await w.coursePlays().saveAll(profileId, req.coursePlays);
await w.missions().save(profileId, req.missions);
await w.story().save(profileId, req.story);
await w.titles().saveAll(profileId, req.titles);
await w.unlocks().save(profileId, req.unlocks);
await w.settings().save(profileId, req.settings);
await w.tickets().save(profileId, req.tickets);
return {
type: "generic_res",
+3 -1
View File
@@ -6,7 +6,9 @@ export async function saveSettings(
w: Repositories,
req: SaveSettingsRequest
): Promise<GenericResponse> {
await w.settings().save(req.profileId, req.settings);
const profileId = await w.profile().find(req.aimeId);
await w.settings().save(profileId, req.settings);
return { type: "generic_res" };
}
+5 -3
View File
@@ -6,10 +6,12 @@ export async function saveStocker(
w: Repositories,
req: SaveStockerRequest
): Promise<GenericResponse> {
const profileId = await w.profile().find(req.aimeId);
await Promise.all([
w.backgrounds().saveAll(req.profileId, req.backgrounds),
w.chara().save(req.profileId, req.chara),
w.car().saveSelection(req.profileId, req.selectedCar),
w.backgrounds().saveAll(profileId, req.backgrounds),
w.chara().save(profileId, req.chara),
w.car().saveSelection(profileId, req.selectedCar),
]);
return { type: "generic_res" };
+4 -3
View File
@@ -13,9 +13,10 @@ export async function saveTimeAttack(
// 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() });
const now = new Date();
const profileId = await w.profile().find(req.aimeId);
await w.timeAttack().save(profileId, { ...req.payload, timestamp: now });
}
return {