1
0
mirror of synced 2025-02-20 20:41:19 +01:00

search car in store

This commit is contained in:
ghkkk090 2022-08-25 10:41:22 +07:00
parent fd01f89e75
commit ceb6218f04
2 changed files with 41 additions and 7 deletions

View File

@ -72,6 +72,9 @@ export default class AllnetModule extends Module {
let shopName = Config.getConfig().shopName;
let shopNick = Config.getConfig().shopNickname;
let regionName = Config.getConfig().regionName;
let placeId = Config.getConfig().placeId;
let country = Config.getConfig().country;
let regionId = Config.getConfig().regionId;
// TODO: Implement board authentication here.
@ -79,15 +82,15 @@ export default class AllnetModule extends Module {
stat: 1,
uri: STARTUP_URI,
host: STARTUP_HOST,
place_id: "JPN0123",
place_id: placeId,
name: shopName,
nickname: shopNick,
region0: "1",
region0: regionId,
region_name0: regionName,
region_name1: "X",
region_name2: "Y",
region_name3: "Z",
country: "JPN",
country: country,
allnet_id: "456",
timezone: "002:00",
setting: "",

View File

@ -188,14 +188,45 @@ export default class TerminalModule extends Module {
// Get the query from the request
let query = req.query;
console.log(query);
// Check the query limit
let queryLimit = 10
if(query.limit)
{
queryLimit = Number(query.limit);
}
// Check the last played place id
let queryLastPlayedPlaceId = 1;
if(query.limit)
{
let getLastPlayedPlaceId = await prisma.placeList.findFirst({
where:{
placeId: String(query.last_played_place_id)
}
})
if(getLastPlayedPlaceId)
{
queryLastPlayedPlaceId = getLastPlayedPlaceId.id
}
}
// Get all of the cars matching the query
let cars = await prisma.car.findMany({
take: Number(query.limit),
take: queryLimit,
where: {
name: {
startsWith: String(query.name)
}
OR:[
{
name: {
startsWith: String(query.name)
}
},
{
lastPlayedPlaceId: queryLastPlayedPlaceId
}
]
},
include:{
gtWing: true,