mirror of
https://github.com/mauriceboe/TREK.git
synced 2026-12-05 18:34:09 +00:00
fix(tours): one tour type catalogue, and no column nothing writes
tour_types now holds every key the shared contract accepts, all but hike disabled, and create and edit turn a disabled type away with a 400 instead of failing on the foreign key. tours.tour_group_id is dropped: nothing ever wrote or read it. difficulty and wanderer_ref stay for the Wanderer import.
This commit is contained in:
@@ -35,7 +35,6 @@ const tour: TourListItem = {
|
||||
difficulty: null,
|
||||
wanderer_ref: null,
|
||||
match_confidence: null,
|
||||
tour_group_id: null,
|
||||
max_hiking_difficulty: 2,
|
||||
planned: false,
|
||||
caution: false,
|
||||
|
||||
@@ -27,7 +27,6 @@ const tour: TourListItem = {
|
||||
difficulty: null,
|
||||
wanderer_ref: null,
|
||||
match_confidence: null,
|
||||
tour_group_id: null,
|
||||
max_hiking_difficulty: 2,
|
||||
planned: false,
|
||||
caution: false,
|
||||
|
||||
@@ -25,7 +25,6 @@ const tour: TourListItem = {
|
||||
difficulty: null,
|
||||
wanderer_ref: null,
|
||||
match_confidence: 1,
|
||||
tour_group_id: null,
|
||||
max_hiking_difficulty: 2,
|
||||
planned: false,
|
||||
caution: false,
|
||||
|
||||
@@ -40,7 +40,6 @@ const savedTour = {
|
||||
difficulty: null,
|
||||
wanderer_ref: null,
|
||||
match_confidence: 1,
|
||||
tour_group_id: null,
|
||||
max_hiking_difficulty: 2,
|
||||
planned: false,
|
||||
caution: false,
|
||||
|
||||
@@ -21,7 +21,7 @@ vi.mock('better-sqlite3', () => { throw new Error('SQLite imports are forbidden
|
||||
const tour: TourListItem = {
|
||||
place_id: 42, name: 'Ridge walk', tour_type: 'hike', distance: 4,
|
||||
elevation_gain: 100, elevation_loss: 80, duration: 60, difficulty: null,
|
||||
wanderer_ref: null, match_confidence: 1, tour_group_id: null,
|
||||
wanderer_ref: null, match_confidence: 1,
|
||||
max_hiking_difficulty: 2, planned: false, caution: false,
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ vi.mock('../../store/tripStore', () => ({
|
||||
const tour: TourListItem = {
|
||||
place_id: 42, name: 'Ridge walk', tour_type: 'hike', distance: 4,
|
||||
elevation_gain: 100, elevation_loss: 80, duration: 60, difficulty: null,
|
||||
wanderer_ref: null, match_confidence: 1, tour_group_id: null,
|
||||
wanderer_ref: null, match_confidence: 1,
|
||||
max_hiking_difficulty: 2, planned: false, caution: false,
|
||||
}
|
||||
const days = [{ id: 7, trip_id: 1, day_number: 1, title: 'Summit day', date: '2026-05-15' } as Day]
|
||||
|
||||
@@ -19,7 +19,6 @@ const tour: TourListItem = {
|
||||
difficulty: null,
|
||||
wanderer_ref: null,
|
||||
match_confidence: null,
|
||||
tour_group_id: null,
|
||||
max_hiking_difficulty: 2,
|
||||
planned: false,
|
||||
caution: false,
|
||||
|
||||
@@ -46,7 +46,6 @@ const baseTour: TourListItem = {
|
||||
difficulty: null,
|
||||
wanderer_ref: null,
|
||||
match_confidence: null,
|
||||
tour_group_id: null,
|
||||
max_hiking_difficulty: 2,
|
||||
planned: false,
|
||||
caution: false,
|
||||
|
||||
@@ -19,7 +19,6 @@ const tour: TourListItem = {
|
||||
difficulty: null,
|
||||
wanderer_ref: null,
|
||||
match_confidence: null,
|
||||
tour_group_id: null,
|
||||
has_waypoints: true,
|
||||
max_hiking_difficulty: 2,
|
||||
planned: false,
|
||||
|
||||
@@ -28,7 +28,6 @@ const tour: TourListItem = {
|
||||
difficulty: null,
|
||||
wanderer_ref: null,
|
||||
match_confidence: null,
|
||||
tour_group_id: null,
|
||||
max_hiking_difficulty: 2,
|
||||
planned: false,
|
||||
caution: false,
|
||||
|
||||
@@ -546,7 +546,6 @@ describe('TripPlannerPage — shell', () => {
|
||||
difficulty: null,
|
||||
wanderer_ref: null,
|
||||
match_confidence: 1,
|
||||
tour_group_id: null,
|
||||
max_hiking_difficulty: 2,
|
||||
planned: false,
|
||||
caution: false,
|
||||
@@ -600,7 +599,6 @@ describe('TripPlannerPage — shell', () => {
|
||||
difficulty: null,
|
||||
wanderer_ref: null,
|
||||
match_confidence: 1,
|
||||
tour_group_id: null,
|
||||
max_hiking_difficulty: 2,
|
||||
planned: false,
|
||||
caution: false,
|
||||
@@ -735,7 +733,6 @@ describe('TripPlannerPage — shell', () => {
|
||||
difficulty: null,
|
||||
wanderer_ref: null,
|
||||
match_confidence: null,
|
||||
tour_group_id: null,
|
||||
max_hiking_difficulty: 2,
|
||||
planned: true,
|
||||
caution: false,
|
||||
@@ -762,7 +759,6 @@ describe('TripPlannerPage — shell', () => {
|
||||
difficulty: null,
|
||||
wanderer_ref: null,
|
||||
match_confidence: null,
|
||||
tour_group_id: null,
|
||||
max_hiking_difficulty: 2,
|
||||
planned: false,
|
||||
caution: false,
|
||||
@@ -866,7 +862,6 @@ describe('TripPlannerPage — shell', () => {
|
||||
difficulty: null,
|
||||
wanderer_ref: null,
|
||||
match_confidence: 1,
|
||||
tour_group_id: null,
|
||||
planned: false,
|
||||
caution: false,
|
||||
has_waypoints: false,
|
||||
|
||||
@@ -667,7 +667,7 @@ describe('useTripPlanner — map derivations', () => {
|
||||
const tour: TourListItem = {
|
||||
place_id: 7, name: 'Ridge walk', tour_type: 'hike', distance: 4, elevation_gain: 100,
|
||||
elevation_loss: 80, duration: null, difficulty: null, wanderer_ref: null, match_confidence: 1,
|
||||
tour_group_id: null, max_hiking_difficulty: 2, planned: false, caution: false,
|
||||
max_hiking_difficulty: 2, planned: false, caution: false,
|
||||
}
|
||||
useAddonStore.setState({ addons: [{ id: 'tours', enabled: true } as never], loaded: true })
|
||||
vi.mocked(addonsApi.enabled).mockResolvedValue({ addons: [{ id: 'tours' }] })
|
||||
@@ -1439,7 +1439,6 @@ describe('useTripPlanner — place CRUD', () => {
|
||||
difficulty: null,
|
||||
wanderer_ref: null,
|
||||
match_confidence: 1,
|
||||
tour_group_id: null,
|
||||
max_hiking_difficulty: 2,
|
||||
planned: false,
|
||||
caution: false,
|
||||
@@ -1638,7 +1637,7 @@ describe('useTripPlanner — day plan CRUD', () => {
|
||||
const tour: TourListItem = {
|
||||
place_id: 1, name: 'Ridge walk', tour_type: 'hike', distance: 4, elevation_gain: 100,
|
||||
elevation_loss: 80, duration: null, difficulty: null, wanderer_ref: null, match_confidence: 1,
|
||||
tour_group_id: null, max_hiking_difficulty: 2, planned: false, caution: false,
|
||||
max_hiking_difficulty: 2, planned: false, caution: false,
|
||||
}
|
||||
const tourPlace = buildPlace({ id: 1, name: 'Ridge walk', tour_place_id: 1 })
|
||||
const ordinaryPlace = buildPlace({ id: 2, name: 'Ordinary place' })
|
||||
@@ -1669,7 +1668,7 @@ describe('useTripPlanner — day plan CRUD', () => {
|
||||
const unplanned: TourListItem = {
|
||||
place_id: 1, name: 'Ridge walk', tour_type: 'hike', distance: 4, elevation_gain: 100,
|
||||
elevation_loss: 80, duration: null, difficulty: null, wanderer_ref: null, match_confidence: 1,
|
||||
tour_group_id: null, max_hiking_difficulty: 2, planned: false, caution: false,
|
||||
max_hiking_difficulty: 2, planned: false, caution: false,
|
||||
}
|
||||
const planned = { ...unplanned, planned: true }
|
||||
useAddonStore.setState({ addons: [{ id: 'tours', enabled: true } as never], loaded: true })
|
||||
@@ -1707,7 +1706,7 @@ describe('useTripPlanner — day plan CRUD', () => {
|
||||
const unplanned: TourListItem = {
|
||||
place_id: 1, name: 'Ridge walk', tour_type: 'hike', distance: 4, elevation_gain: 100,
|
||||
elevation_loss: 80, duration: null, difficulty: null, wanderer_ref: null, match_confidence: 1,
|
||||
tour_group_id: null, max_hiking_difficulty: 2, planned: false, caution: false,
|
||||
max_hiking_difficulty: 2, planned: false, caution: false,
|
||||
}
|
||||
useAddonStore.setState({ addons: [{ id: 'tours', enabled: true } as never], loaded: true })
|
||||
const listTours = vi.spyOn(toursApi, 'list').mockResolvedValue({ tours: [unplanned] })
|
||||
@@ -1729,7 +1728,7 @@ describe('useTripPlanner — day plan CRUD', () => {
|
||||
const unplanned: TourListItem = {
|
||||
place_id: 1, name: 'Ridge walk', tour_type: 'hike', distance: 4, elevation_gain: 100,
|
||||
elevation_loss: 80, duration: null, difficulty: null, wanderer_ref: null, match_confidence: 1,
|
||||
tour_group_id: null, max_hiking_difficulty: 2, planned: false, caution: false,
|
||||
max_hiking_difficulty: 2, planned: false, caution: false,
|
||||
}
|
||||
const planned: TourListItem = { ...unplanned, planned: true }
|
||||
useAddonStore.setState({ addons: [{ id: 'tours', enabled: true } as never], loaded: true })
|
||||
|
||||
Reference in New Issue
Block a user