diff --git a/src/booking_entities.v b/src/booking_entities.v new file mode 100644 index 0000000..237447c --- /dev/null +++ b/src/booking_entities.v @@ -0,0 +1,13 @@ +module main + +import time + +@[table: 'booking'] +pub struct Booking { +mut: + id int @[primary; sql: serial] + user_id int + flight_id int + status string @[sql_type: 'TEXT'] + created_at time.Time +} diff --git a/src/flight_entities.v b/src/flight_entities.v new file mode 100644 index 0000000..82dcb90 --- /dev/null +++ b/src/flight_entities.v @@ -0,0 +1,16 @@ +module main + +import time + +@[table: 'flight'] +pub struct Flight { +mut: + id int @[primary; sql: serial] + from string @[sql_type: 'TEXT'] + to string @[sql_type: 'TEXT'] + date string @[sql_type: 'TEXT'] + price int @[sql_type: 'INT'] + status string @[sql_type: 'TEXT'] + bookings []Booking @[fkey: 'flight_id'] + created_at time.Time +} diff --git a/src/plane_entities.v b/src/plane_entities.v deleted file mode 100644 index de72478..0000000 --- a/src/plane_entities.v +++ /dev/null @@ -1,14 +0,0 @@ -module main - -@[table: 'planes'] -pub struct Plane { -mut: - id int @[primary; sql: serial] - from string @[sql_type: 'TEXT'] - to string @[sql_type: 'TEXT'] - time string @[sql_type: 'TEXT'] - date string @[sql_type: 'TEXT'] - price int @[sql_type: 'INT'] - status string @[sql_type: 'TEXT'] - tickets []Ticket @[fkey: 'plane_id'] -} diff --git a/src/ticket_entities.v b/src/ticket_entities.v deleted file mode 100644 index 49cb7f9..0000000 --- a/src/ticket_entities.v +++ /dev/null @@ -1,10 +0,0 @@ -module main - -@[table: 'tickets'] -pub struct Ticket { -mut: - id int @[primary; sql: serial] - user_id int - plane_id int - status string @[sql_type: 'TEXT'] -}