Skip to content

Commit

Permalink
move the routes to /plotsystem
Browse files Browse the repository at this point in the history
  • Loading branch information
MineFact committed Sep 18, 2023
1 parent 8334f53 commit dac7dca
Show file tree
Hide file tree
Showing 30 changed files with 16 additions and 37 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,10 @@ export async function initRoutes(app, joi, plotSystem) {

app.get('/api/plotsystem/teams/:apikey/cities', function (req, res) {


console.log(req.params)
console.log("e")

// Validate that the API key is a valid GUID
if(!plotSystem.validateAPIKey(req, res))
return;


const buildTeam = plotSystem.getBuildTeam(req.params.apikey);

res.setHeader('Content-Type', 'application/json');
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions src/routes/teams/GET.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export async function initRoutes(app, joi, plotSystem) {

app.get('/api/teams/:apikey', function (req, res) {

// Validate that the API key is a valid GUID
if(!plotSystem.validateAPIKey(req, res))
return;

const buildTeam = plotSystem.getBuildTeam(req.params.apikey);

res.setHeader('Content-Type', 'application/json');
res.send(JSON.stringify(buildTeam.getCities()))
})

}
33 changes: 1 addition & 32 deletions src/struct/core/buildteam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default class BuildTeam {


/* ======================================= */
/* CITIES */
/* PlotSystem */
/* ======================================= */


Expand Down Expand Up @@ -87,13 +87,6 @@ export default class BuildTeam {
return this.cities.get(country_id);
}



/* ======================================= */
/* COUNTRIES */
/* ======================================= */


// Returns a map of countries with the country id as the key. If no countries are found, an empty map is returned.
getCountries(){
if(this.countries == null || this.countries.size == 0){
Expand All @@ -105,12 +98,6 @@ export default class BuildTeam {
}



/* ======================================= */
/* SERVERS */
/* ======================================= */


// Returns a map of servers with the server id as the key. If no servers are found, an empty map is returned.
getServers(){
if(this.servers == null || this.servers.size == 0){
Expand All @@ -121,12 +108,6 @@ export default class BuildTeam {
return this.servers;
}



/* ======================================= */
/* FTP CONFIGURATION */
/* ======================================= */

// Returns a map of ftp configurations with the server id as the key. If no ftp configurations are found, an empty map is returned.
getFTPConfiguration(){
if(this.ftp_configuration == null || this.ftp_configuration.size == 0){
Expand All @@ -137,12 +118,6 @@ export default class BuildTeam {
return this.ftp_configuration;
}



/* ======================================= */
/* PLOTS */
/* ======================================= */

// Returns an uncached list of plots of this team. If no plots are found, an empty list is returned.
async getPlots(){
if(this.cities == null || this.cities.size == 0)
Expand Down Expand Up @@ -207,12 +182,6 @@ export default class BuildTeam {
return await this.updatePlotInDatabase(plot_id, city_project_id, difficulty_id, review_id, owner_uuid, member_uuids, status, mc_coordinates, outline, score, last_activity, pasted, type, version);
}



/* ======================================= */
/* REVIEWS */
/* ======================================= */

// Returns an uncached list of reviews.
async getReviews(){
if(this.cities == null || this.cities.size == 0)
Expand Down

0 comments on commit dac7dca

Please sign in to comment.