1
mirror of https://github.com/thepeacockproject/Peacock synced 2025-02-16 16:34:28 +01:00

Fix some style issues

Signed-off-by: Reece Dunham <me@rdil.rocks>
This commit is contained in:
Reece Dunham 2023-04-02 00:22:26 -04:00
parent 8fcd4db87d
commit 3421ee385b
No known key found for this signature in database
GPG Key ID: F087CB485320F19F
4 changed files with 23 additions and 16 deletions

View File

@ -17,7 +17,7 @@
*/
import type {
contractSearchResult,
ContractSearchResult,
GameVersion,
RequestWithJwt,
} from "../types/types"
@ -73,7 +73,7 @@ export async function officialSearchContract(
gameVersion: GameVersion,
filters: string[],
pageNumber: number,
): Promise<contractSearchResult> {
): Promise<ContractSearchResult> {
const remoteService = getRemoteService(gameVersion)
const user = userAuths.get(userId)
@ -83,7 +83,7 @@ export async function officialSearchContract(
}
const resp = await user._useService<{
data: contractSearchResult
data: ContractSearchResult
}>(
pageNumber === 0
? `https://${remoteService}.hitman.io/profiles/page/ContractSearch?sorting=`

View File

@ -43,7 +43,7 @@ import {
} from "./menus/destinations"
import type {
CommonSelectScreenConfig,
contractSearchResult,
ContractSearchResult,
GameVersion,
HitsCategoryCategory,
IHit,
@ -158,7 +158,10 @@ menuDataRouter.get(
menuDataRouter.get(
"/ChallengeLocation",
(req: RequestWithJwt<{ locationId: string }>, res) => {
assert.equal(typeof req.query.locationId, "string")
if (typeof req.query.locationId !== "string") {
res.status(400).send("Invalid locationId")
return
}
const location = getVersionedConfig<PeacockLocationsData>(
"LocationsData",
@ -495,6 +498,14 @@ menuDataRouter.get(
),
}
if (
typeof req.query.slotname !== "string" ||
!(req.query.slotid ?? undefined)
) {
res.status(400).send("invalid slot data")
return
}
const userData = getUserData(req.jwt.unique_name, req.gameVersion)
const inventory = createInventory(
@ -503,11 +514,6 @@ menuDataRouter.get(
userData.Extensions.entP,
)
if (!req.query.slotname || !(req.query.slotid ?? undefined)) {
res.status(400).send("invalid?")
return
}
let contractData: MissionManifest | undefined = undefined
if (req.query.contractid) {
contractData = controller.resolveContract(req.query.contractid)
@ -1206,12 +1212,10 @@ async function lookupContractPublicId(
menuDataRouter.get(
"/LookupContractPublicId",
async (req: RequestWithJwt<{ publicid: string }>, res) => {
if (!req.query.publicid) {
return res.status(400).send("no public id specified!")
if (!req.query.publicid || typeof req.query.publicid !== "string") {
return res.status(400).send("no/invalid public id specified!")
}
assert.equal(typeof req.query.publicid, "string")
res.json({
template: getVersionedConfig(
"LookupContractByIdTemplate",
@ -1584,7 +1588,7 @@ menuDataRouter.post(
specialContracts,
)
let searchResult: contractSearchResult = undefined
let searchResult: ContractSearchResult
if (specialContracts.length > 0) {
// Handled by a plugin

View File

@ -26,6 +26,9 @@ export type MissionEndRequestQuery = Partial<{
*/
export type StashpointQuery = Partial<{
contractid: string
/**
* Can be a number or a UUID.
*/
slotid: number | string
slotname: "gear" | "disguise" | "stashpoint" | string
stashpoint?: string

View File

@ -185,7 +185,7 @@ export type MissionType =
/**
* The data acquired when using the "contract search" functionality.
*/
export interface contractSearchResult {
export interface ContractSearchResult {
Data: {
Contracts: {
UserCentricContract: UserCentricContract