--- /dev/null
+import { Knex } from "knex";
+
+
+export async function up(knex: Knex): Promise<void> {
+ return knex.schema.alterTable('locations', table => {
+ table.boolean('is_visible').defaultTo(true);
+ });
+}
+
+
+export async function down(knex: Knex): Promise<void> {
+ return knex.schema.alterTable('locations', table => {
+ table.dropColumn('is_visible');
+ })
+}
+
city_id: r.fields.city_id[0],
display_order: r.fields["Display Order"],
event_name: r.fields['event_name'],
- min_level: Math.max(parseInt(r.fields['Min Level'].toString()), 1)
+ min_level: Math.max(parseInt(r.fields['Min Level'].toString()), 1),
+ is_visible: !!(r.fields['Visible'] ?? true)
}
})).onConflict('id').merge();
// display the default explore view
const [city, locations, paths] = await Promise.all([
getCityDetails(req.player.city_id),
- getAllServices(req.player.city_id, req.player.level),
+ getAllServices(req.player.city_id),
getAllPaths(req.player.city_id)
]);
import { db } from './lib/db';
import { random } from 'lodash';
-export async function getAllServices(city_id: number, min_level: number): Promise<Location[]> {
+export async function getAllServices(city_id: number): Promise<Location[]> {
return db.select('*')
.from<Location>('locations')
.where({city_id})
- .andWhere('min_level', '<=', min_level)
+ .andWhere('is_visible', true)
.orderBy('type')
.orderBy('display_order');
}
const [city, locations, paths] = await Promise.all([
getCityDetails(travel.destination_id),
- getAllServices(travel.destination_id, req.player.level),
+ getAllServices(travel.destination_id),
getAllPaths(travel.destination_id)
]);
else {
const [city, locations, paths] = await Promise.all([
getCityDetails(req.player.city_id),
- getAllServices(req.player.city_id, req.player.level),
+ getAllServices(req.player.city_id),
getAllPaths(req.player.city_id)
]);
type: LocationType,
display_order: number;
event_name: string;
+ min_level: number;
}
export type LocationWithCity = Location & {