Changed sdkVersion type to string, renamed package with pkg since "package" means something else

This commit is contained in:
xx-TheDoctor-xx
2020-04-21 12:35:20 +01:00
parent 913d7d016a
commit bf3ced4d54
3 changed files with 8 additions and 9 deletions

View File

@ -13,7 +13,7 @@ namespace PMF
public static string RepositoryEndpoint { get; set; } public static string RepositoryEndpoint { get; set; }
public static Version CurrentSdkVersion { get; set; } public static string CurrentSdkVersion { get; set; }
public static bool IsDebugging { get; set; } public static bool IsDebugging { get; set; }

View File

@ -13,8 +13,7 @@ namespace PMF
[JsonConverter(typeof(VersionConverter))] [JsonConverter(typeof(VersionConverter))]
public Version Version { get; set; } public Version Version { get; set; }
[JsonConverter(typeof(VersionConverter))] public string SdkVersion { get; set; }
public Version SdkVersion { get; set; }
public string Checksum { get; set; } public string Checksum { get; set; }

View File

@ -11,14 +11,14 @@ app.use(express.static('public'))
app.get('/package/:id', async (req, res) => app.get('/package/:id', async (req, res) =>
{ {
var con = await pool.getConnection() var con = await pool.getConnection()
var package = (await con.query("SELECT id_package, ID, Type, Name, Description FROM package WHERE BINARY ID = BINARY ? LIMIT 1", [req.params.id])) var pkg = (await con.query("SELECT id_package, ID, Type, Name, Description FROM package WHERE BINARY ID = BINARY ? LIMIT 1", [req.params.id]))
if (package.length === 1) if (pkg.length === 1)
{ {
package = package[0] pkg = pkg[0]
var assets = await con.query("SELECT id_asset, Version, SdkVersion, Checksum, FileName, Url FROM asset_table WHERE id_package = ?", [package["id_package"]]) var assets = await con.query("SELECT id_asset, Version, SdkVersion, Checksum, FileName, Url FROM asset_table WHERE id_package = ?", [package["id_package"]])
// don't need this anymore // don't need this anymore
delete package["id_package"] delete pkg["id_package"]
if (assets.length > 0) if (assets.length > 0)
{ {
@ -32,11 +32,11 @@ app.get('/package/:id', async (req, res) =>
assets[i]["Dependencies"] = dependencies assets[i]["Dependencies"] = dependencies
} }
package["Assets"] = assets pkg["Assets"] = assets
} }
} }
res.json(package) res.json(pkg)
}); });
app.listen(port, () => console.log(`http://localhost:${port}`)); app.listen(port, () => console.log(`http://localhost:${port}`));