如何为旅行行程设计间歇性通过点

问题描述:

我尝试设计后端并具有以下用例。

I am trying to design the backend and have the following use case.

我有从A点到B的航班信息,需要定义一个支持不同

I have flight information from point A to B and need to define a schema which supports different use cases.

我试图找到一个很好的方法来处理这种情况,当有中途停留点。

I'm trying to find a good way to handle the case, when there are stopover via points.

例如A - > B的飞行路线实际上看起来像这样:

For e.g. flight route for A -> B actually looks like this:

A -> C
C -> D
D -> B

所以A - > B是一个实体,但它又由几条腿组成。

so A -> B is one entity, but in turn, it is comprised of several legs.

我目前的设计:

AirLeg表:

- id
- departure and arrival information
- viaPoints: BOOL

viaPoints表格:

viaPoints table:

- id
- airLegId // FK into Airleg table
- similar departure and arrival information from airLeg table

//如果viaPoints标志为True可以查询AirLeg表,viaPoints表,使用airLegId表检索中介。

// if viaPoints flag is True in AirLeg table, viaPoints table can be queried for, using airLegId table to retrieve intermediaries.

有没有更好的方法来处理这个?

Is there a better way to deal with this ?

我想我会添加我存储的关于单程旅行或细分的信息:

I thought I'll add the info I am storing about a one way trip or segment:


  • AirLeg-id

  • 离开机场:FK进入机场

  • 到达机场:FK进入机场

  • 出发时间戳(出发城市当地时间)

  • 到达时间戳(到达城市当地时间)


  • 行李政策:文字

  • Misc(TEXT:Cancellation policy)
  • AirLeg-id
  • Departure Airport : FK into airports
  • Arrival Airport : FK into airports
  • Departure timestamp (in departure city's local time)
  • Arrival timestamp (in arrival city's local time)
  • flight duration of this airleg: static value
  • flightId : FK into airlines yielding airline name and flight number
  • Baggage Policy : text
  • Misc (TEXT: Cancellation policy)

EDIT:

我添加了一个相关的问题我认为这个问题的答案必须满足这两个要求。

I added a related question and I think the answer to this problem will have to cater to both the requirements.

如果一个行程中有多个细分,而不是单个分段

If there are multiple segments in a trip, price is defined for the complete trip and not individual segments

类似地,往返的价格被指定为单位,而不是从A-> B和返回,B-> A的单个组件。

Similarly, the price for a round trip is specified as a unit and not individual components from A->B and back, B->A.

我会这样设计:

Journeys:

 - ID
 - Other info (billing, whatever)

Segments:

 - ID
 - JourneyID (FK)
 - departure, arrival, etc

附加视图

Journeys_View

 - Journeys.*
 - First departure
 - Last arrival