mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-14 00:31:25 +10:00
feat: beginnings of platform & redist management
This commit is contained in:
@ -128,29 +128,23 @@ class LibraryManager {
|
||||
}
|
||||
}
|
||||
|
||||
async fetchGamesWithStatus() {
|
||||
const games = await prisma.game.findMany({
|
||||
include: {
|
||||
versions: {
|
||||
select: {
|
||||
versionName: true,
|
||||
},
|
||||
},
|
||||
library: true,
|
||||
},
|
||||
orderBy: {
|
||||
mName: "asc",
|
||||
},
|
||||
});
|
||||
|
||||
async fetchLibraryObjectWithStatus<T>(
|
||||
objects: Array<
|
||||
{
|
||||
libraryId: string;
|
||||
libraryPath: string;
|
||||
versions: Array<unknown>;
|
||||
} & T
|
||||
>,
|
||||
) {
|
||||
return await Promise.all(
|
||||
games.map(async (e) => {
|
||||
objects.map(async (e) => {
|
||||
const versions = await this.fetchUnimportedGameVersions(
|
||||
e.libraryId ?? "",
|
||||
e.libraryPath,
|
||||
);
|
||||
return {
|
||||
game: e,
|
||||
value: e,
|
||||
status: versions
|
||||
? {
|
||||
noVersions: e.versions.length == 0,
|
||||
@ -162,6 +156,55 @@ class LibraryManager {
|
||||
);
|
||||
}
|
||||
|
||||
async fetchGamesWithStatus() {
|
||||
const games = await prisma.game.findMany({
|
||||
include: {
|
||||
versions: {
|
||||
select: {
|
||||
versionId: true,
|
||||
versionName: true,
|
||||
},
|
||||
},
|
||||
library: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
orderBy: {
|
||||
mName: "asc",
|
||||
},
|
||||
});
|
||||
|
||||
return await this.fetchLibraryObjectWithStatus(games);
|
||||
}
|
||||
|
||||
async fetchRedistsWithStatus() {
|
||||
const redists = await prisma.redist.findMany({
|
||||
include: {
|
||||
versions: {
|
||||
select: {
|
||||
versionId: true,
|
||||
versionName: true,
|
||||
},
|
||||
},
|
||||
library: {
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
},
|
||||
},
|
||||
platform: true,
|
||||
},
|
||||
orderBy: {
|
||||
mName: "asc",
|
||||
},
|
||||
});
|
||||
|
||||
return await this.fetchLibraryObjectWithStatus(redists);
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches recommendations and extra data about the version. Doesn't actually check if it's been imported.
|
||||
* @param gameId
|
||||
|
||||
Reference in New Issue
Block a user