From 4106b9a0efc97baeb38a1134f48f9707b945afd9 Mon Sep 17 00:00:00 2001 From: Daniel Schick Date: Wed, 3 Apr 2024 10:39:32 +0200 Subject: [PATCH] For intervals there are now 2 fields in the times object: eta_interval_end and etd_interval_end --- misc/BreCalApi.cs | 27 ++++++++++++++++++--------- misc/BreCalApi.yaml | 9 +++++++-- misc/update_1.1_to_1.2.sql | 3 ++- src/server/BreCal/impl/times.py | 6 +++--- src/server/BreCal/schemas/model.py | 6 ++++-- 5 files changed, 34 insertions(+), 17 deletions(-) diff --git a/misc/BreCalApi.cs b/misc/BreCalApi.cs index 8c5cb10..a025cd2 100644 --- a/misc/BreCalApi.cs +++ b/misc/BreCalApi.cs @@ -1,7 +1,7 @@ //---------------------- // -// Generated REST API Client Code Generator v1.9.8.0 on 02.04.2024 11:36:53 +// Generated REST API Client Code Generator v1.9.8.0 on 03.04.2024 10:37:27 // Using the tool OpenAPI Generator v7.4.0 // //---------------------- @@ -7781,10 +7781,11 @@ namespace BreCalClient.misc.Model /// participantType. /// can be set by mooring if actual times are different from planned. /// can be set by mooring if actual times are different from planned. - /// End of the interval for the times entry. + /// Optional end of the interval for the times eta entry. + /// Optional end of the interval for the times etd entry. /// Readonly field set by the database. /// Readonly field set by the database. - public Times(int id = default(int), DateTime? etaBerth = default(DateTime?), bool? etaBerthFixed = default(bool?), DateTime? etdBerth = default(DateTime?), bool? etdBerthFixed = default(bool?), DateTime? lockTime = default(DateTime?), bool? lockTimeFixed = default(bool?), DateTime? zoneEntry = default(DateTime?), bool? zoneEntryFixed = default(bool?), DateTime? operationsStart = default(DateTime?), DateTime? operationsEnd = default(DateTime?), string remarks = default(string), int shipcallId = default(int), int participantId = default(int), int? berthId = default(int?), string berthInfo = default(string), bool? pierSide = default(bool?), int participantType = default(int), DateTime? ata = default(DateTime?), DateTime? atd = default(DateTime?), DateTime? intervalEnd = default(DateTime?), DateTime created = default(DateTime), DateTime? modified = default(DateTime?)) + public Times(int id = default(int), DateTime? etaBerth = default(DateTime?), bool? etaBerthFixed = default(bool?), DateTime? etdBerth = default(DateTime?), bool? etdBerthFixed = default(bool?), DateTime? lockTime = default(DateTime?), bool? lockTimeFixed = default(bool?), DateTime? zoneEntry = default(DateTime?), bool? zoneEntryFixed = default(bool?), DateTime? operationsStart = default(DateTime?), DateTime? operationsEnd = default(DateTime?), string remarks = default(string), int shipcallId = default(int), int participantId = default(int), int? berthId = default(int?), string berthInfo = default(string), bool? pierSide = default(bool?), int participantType = default(int), DateTime? ata = default(DateTime?), DateTime? atd = default(DateTime?), DateTime? etaIntervalEnd = default(DateTime?), DateTime? etdIntervalEnd = default(DateTime?), DateTime created = default(DateTime), DateTime? modified = default(DateTime?)) { this.ShipcallId = shipcallId; this.ParticipantId = participantId; @@ -7806,7 +7807,8 @@ namespace BreCalClient.misc.Model this.ParticipantType = participantType; this.Ata = ata; this.Atd = atd; - this.IntervalEnd = intervalEnd; + this.EtaIntervalEnd = etaIntervalEnd; + this.EtdIntervalEnd = etdIntervalEnd; this.Created = created; this.Modified = modified; } @@ -7928,11 +7930,17 @@ namespace BreCalClient.misc.Model [DataMember(Name = "atd", EmitDefaultValue = true)] public DateTime? Atd { get; set; } /// - /// End of the interval for the times entry + /// Optional end of the interval for the times eta entry /// - /// End of the interval for the times entry - [DataMember(Name = "interval_end", EmitDefaultValue = true)] - public DateTime? IntervalEnd { get; set; } + /// Optional end of the interval for the times eta entry + [DataMember(Name = "eta_interval_end", EmitDefaultValue = true)] + public DateTime? EtaIntervalEnd { get; set; } + /// + /// Optional end of the interval for the times etd entry + /// + /// Optional end of the interval for the times etd entry + [DataMember(Name = "etd_interval_end", EmitDefaultValue = true)] + public DateTime? EtdIntervalEnd { get; set; } /// /// Readonly field set by the database /// @@ -7973,7 +7981,8 @@ namespace BreCalClient.misc.Model sb.Append(" ParticipantType: ").Append(ParticipantType).Append("\n"); sb.Append(" Ata: ").Append(Ata).Append("\n"); sb.Append(" Atd: ").Append(Atd).Append("\n"); - sb.Append(" IntervalEnd: ").Append(IntervalEnd).Append("\n"); + sb.Append(" EtaIntervalEnd: ").Append(EtaIntervalEnd).Append("\n"); + sb.Append(" EtdIntervalEnd: ").Append(EtdIntervalEnd).Append("\n"); sb.Append(" Created: ").Append(Created).Append("\n"); sb.Append(" Modified: ").Append(Modified).Append("\n"); sb.Append("}\n"); diff --git a/misc/BreCalApi.yaml b/misc/BreCalApi.yaml index 211916c..3aa5650 100644 --- a/misc/BreCalApi.yaml +++ b/misc/BreCalApi.yaml @@ -681,11 +681,16 @@ components: format: date-time nullable: true description: can be set by mooring if actual times are different from planned - interval_end: + eta_interval_end: type: string format: date-time nullable: true - description: End of the interval for the times entry + description: Optional end of the interval for the times eta entry + etd_interval_end: + type: string + format: date-time + nullable: true + description: Optional end of the interval for the times etd entry created: type: string format: date-time diff --git a/misc/update_1.1_to_1.2.sql b/misc/update_1.1_to_1.2.sql index 9fb7a80..4ccc23d 100644 --- a/misc/update_1.1_to_1.2.sql +++ b/misc/update_1.1_to_1.2.sql @@ -91,4 +91,5 @@ ADD CONSTRAINT `FK_HISTORY_USER` ALTER TABLE `bremen_calling_devel`.`times` ADD COLUMN `ata` DATETIME NULL DEFAULT NULL COMMENT 'Relevant only for mooring, this field can be used to record actual ATA' AFTER `participant_type`, ADD COLUMN `atd` DATETIME NULL DEFAULT NULL COMMENT 'Relevant only for mooring, this field can be used to record actual ATD' AFTER `ata`, -ADD COLUMN `interval_end` DATETIME NULL DEFAULT NULL COMMENT 'If this value is set the times are given as interval instead of a single point in time. The start time value depends on the participant type.' AFTER `atd`; \ No newline at end of file +ADD COLUMN `eta_interval_end` DATETIME NULL DEFAULT NULL COMMENT 'If this value is set the times are given as interval instead of a single point in time. The start time value depends on the participant type.' AFTER `atd`; +ADD COLUMN `etd_interval_end` DATETIME NULL DEFAULT NULL COMMENT 'If this value is set the times are given as interval instead of a single point in time. The start time value depends on the participant type.' AFTER `eta_interval_end`; \ No newline at end of file diff --git a/src/server/BreCal/impl/times.py b/src/server/BreCal/impl/times.py index 3c22b4d..1f16574 100644 --- a/src/server/BreCal/impl/times.py +++ b/src/server/BreCal/impl/times.py @@ -22,7 +22,7 @@ def GetTimes(options): commands = pydapper.using(pooledConnection) data = commands.query("SELECT id, eta_berth, eta_berth_fixed, etd_berth, etd_berth_fixed, lock_time, lock_time_fixed, " + "zone_entry, zone_entry_fixed, operations_start, operations_end, remarks, shipcall_id, participant_id, " + - "berth_id, berth_info, pier_side, participant_type, created, modified, ata, atd, interval_end FROM times " + + "berth_id, berth_info, pier_side, participant_type, created, modified, ata, atd, eta_interval_end, etd_interval_end FROM times " + "WHERE times.shipcall_id = ?scid?", model=model.Times, param={"scid" : options["shipcall_id"]}) pooledConnection.close() @@ -175,9 +175,9 @@ def DeleteTimes(options): pooledConnection = local_db.getPoolConnection() commands = pydapper.using(pooledConnection) - shipcall_id = commands.execute_scalar("SELECT shipcall_id FROM times WHERE id = ?id?", param={"id" : options["id"]}) + shipcall_id = commands.execute_scalar("SELECT shipcall_id FROM times WHERE id = ?id?", param={"id" : options["id"]}) affected_rows = commands.execute("DELETE FROM times WHERE id = ?id?", param={"id" : options["id"]}) - + # TODO: set ETA properly? # save history data diff --git a/src/server/BreCal/schemas/model.py b/src/server/BreCal/schemas/model.py index 29866d7..86204d7 100644 --- a/src/server/BreCal/schemas/model.py +++ b/src/server/BreCal/schemas/model.py @@ -307,7 +307,8 @@ class TimesSchema(Schema): participant_type = fields.Int(Required = False, allow_none=True) ata = fields.DateTime(Required = False, allow_none=True) atd = fields.DateTime(Required = False, allow_none=True) - interval_end = fields.DateTime(Required = False, allow_none=True) + eta_interval_end = fields.DateTime(Required = False, allow_none=True) + etd_interval_end = fields.DateTime(Required = False, allow_none=True) created = fields.DateTime(Required = False, allow_none=True) modified = fields.DateTime(Required = False, allow_none=True) @@ -347,7 +348,8 @@ class Times: shipcall_id: int ata: datetime atd: datetime - interval_end: datetime + eta_interval_end: datetime + etd_interval_end: datetime created: datetime modified: datetime