added shipcall participant list to API GET call
This commit is contained in:
parent
c08ba046c9
commit
794cd8efaf
@ -1,7 +1,7 @@
|
|||||||
|
|
||||||
//----------------------
|
//----------------------
|
||||||
// <auto-generated>
|
// <auto-generated>
|
||||||
// Generated REST API Client Code Generator v1.7.17.0 on 07.08.2023 15:13:59
|
// Generated REST API Client Code Generator v1.7.17.0 on 11.08.2023 12:15:43
|
||||||
// Using the tool OpenAPI Generator v6.6.0
|
// Using the tool OpenAPI Generator v6.6.0
|
||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//----------------------
|
//----------------------
|
||||||
@ -6017,9 +6017,10 @@ namespace BreCalClient.misc.Model
|
|||||||
/// <param name="tidalWindowTo">tidalWindowTo.</param>
|
/// <param name="tidalWindowTo">tidalWindowTo.</param>
|
||||||
/// <param name="rainSensitiveCargo">rainSensitiveCargo.</param>
|
/// <param name="rainSensitiveCargo">rainSensitiveCargo.</param>
|
||||||
/// <param name="recommendedTugs">recommendedTugs.</param>
|
/// <param name="recommendedTugs">recommendedTugs.</param>
|
||||||
|
/// <param name="participants">participants.</param>
|
||||||
/// <param name="created">created.</param>
|
/// <param name="created">created.</param>
|
||||||
/// <param name="modified">modified.</param>
|
/// <param name="modified">modified.</param>
|
||||||
public Shipcall(int id = default(int), int shipId = default(int), TypeEnum type = default(TypeEnum), DateTime eta = default(DateTime), string voyage = default(string), DateTime? etd = default(DateTime?), int? arrivalBerthId = default(int?), int? departureBerthId = default(int?), bool? tugReguired = default(bool?), bool? pilotRequired = default(bool?), int? flags = default(int?), bool? pierSide = default(bool?), bool? bunkering = default(bool?), bool? replenishing = default(bool?), float? draft = default(float?), DateTime? tidalWindowFrom = default(DateTime?), DateTime? tidalWindowTo = default(DateTime?), bool? rainSensitiveCargo = default(bool?), int? recommendedTugs = default(int?), DateTime created = default(DateTime), DateTime? modified = default(DateTime?))
|
public Shipcall(int id = default(int), int shipId = default(int), TypeEnum type = default(TypeEnum), DateTime eta = default(DateTime), string voyage = default(string), DateTime? etd = default(DateTime?), int? arrivalBerthId = default(int?), int? departureBerthId = default(int?), bool? tugReguired = default(bool?), bool? pilotRequired = default(bool?), int? flags = default(int?), bool? pierSide = default(bool?), bool? bunkering = default(bool?), bool? replenishing = default(bool?), float? draft = default(float?), DateTime? tidalWindowFrom = default(DateTime?), DateTime? tidalWindowTo = default(DateTime?), bool? rainSensitiveCargo = default(bool?), int? recommendedTugs = default(int?), List<int> participants = default(List<int>), DateTime created = default(DateTime), DateTime? modified = default(DateTime?))
|
||||||
{
|
{
|
||||||
this.Id = id;
|
this.Id = id;
|
||||||
this.ShipId = shipId;
|
this.ShipId = shipId;
|
||||||
@ -6050,6 +6051,7 @@ namespace BreCalClient.misc.Model
|
|||||||
this.TidalWindowTo = tidalWindowTo;
|
this.TidalWindowTo = tidalWindowTo;
|
||||||
this.RainSensitiveCargo = rainSensitiveCargo;
|
this.RainSensitiveCargo = rainSensitiveCargo;
|
||||||
this.RecommendedTugs = recommendedTugs;
|
this.RecommendedTugs = recommendedTugs;
|
||||||
|
this.Participants = participants;
|
||||||
this.Created = created;
|
this.Created = created;
|
||||||
this.Modified = modified;
|
this.Modified = modified;
|
||||||
}
|
}
|
||||||
@ -6145,6 +6147,11 @@ namespace BreCalClient.misc.Model
|
|||||||
[DataMember(Name = "recommended_tugs", EmitDefaultValue = true)]
|
[DataMember(Name = "recommended_tugs", EmitDefaultValue = true)]
|
||||||
public int? RecommendedTugs { get; set; }
|
public int? RecommendedTugs { get; set; }
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
/// Gets or Sets Participants
|
||||||
|
/// </summary>
|
||||||
|
[DataMember(Name = "participants", EmitDefaultValue = true)]
|
||||||
|
public List<int> Participants { get; set; }
|
||||||
|
/// <summary>
|
||||||
/// Gets or Sets Created
|
/// Gets or Sets Created
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[DataMember(Name = "created", EmitDefaultValue = true)]
|
[DataMember(Name = "created", EmitDefaultValue = true)]
|
||||||
@ -6181,6 +6188,7 @@ namespace BreCalClient.misc.Model
|
|||||||
sb.Append(" TidalWindowTo: ").Append(TidalWindowTo).Append("\n");
|
sb.Append(" TidalWindowTo: ").Append(TidalWindowTo).Append("\n");
|
||||||
sb.Append(" RainSensitiveCargo: ").Append(RainSensitiveCargo).Append("\n");
|
sb.Append(" RainSensitiveCargo: ").Append(RainSensitiveCargo).Append("\n");
|
||||||
sb.Append(" RecommendedTugs: ").Append(RecommendedTugs).Append("\n");
|
sb.Append(" RecommendedTugs: ").Append(RecommendedTugs).Append("\n");
|
||||||
|
sb.Append(" Participants: ").Append(Participants).Append("\n");
|
||||||
sb.Append(" Created: ").Append(Created).Append("\n");
|
sb.Append(" Created: ").Append(Created).Append("\n");
|
||||||
sb.Append(" Modified: ").Append(Modified).Append("\n");
|
sb.Append(" Modified: ").Append(Modified).Append("\n");
|
||||||
sb.Append("}\n");
|
sb.Append("}\n");
|
||||||
@ -6307,6 +6315,12 @@ namespace BreCalClient.misc.Model
|
|||||||
(this.RecommendedTugs != null &&
|
(this.RecommendedTugs != null &&
|
||||||
this.RecommendedTugs.Equals(input.RecommendedTugs))
|
this.RecommendedTugs.Equals(input.RecommendedTugs))
|
||||||
) &&
|
) &&
|
||||||
|
(
|
||||||
|
this.Participants == input.Participants ||
|
||||||
|
this.Participants != null &&
|
||||||
|
input.Participants != null &&
|
||||||
|
this.Participants.SequenceEqual(input.Participants)
|
||||||
|
) &&
|
||||||
(
|
(
|
||||||
this.Created == input.Created ||
|
this.Created == input.Created ||
|
||||||
(this.Created != null &&
|
(this.Created != null &&
|
||||||
@ -6394,6 +6408,10 @@ namespace BreCalClient.misc.Model
|
|||||||
{
|
{
|
||||||
hashCode = (hashCode * 59) + this.RecommendedTugs.GetHashCode();
|
hashCode = (hashCode * 59) + this.RecommendedTugs.GetHashCode();
|
||||||
}
|
}
|
||||||
|
if (this.Participants != null)
|
||||||
|
{
|
||||||
|
hashCode = (hashCode * 59) + this.Participants.GetHashCode();
|
||||||
|
}
|
||||||
if (this.Created != null)
|
if (this.Created != null)
|
||||||
{
|
{
|
||||||
hashCode = (hashCode * 59) + this.Created.GetHashCode();
|
hashCode = (hashCode * 59) + this.Created.GetHashCode();
|
||||||
|
|||||||
@ -375,6 +375,11 @@ components:
|
|||||||
recommended_tugs:
|
recommended_tugs:
|
||||||
type: integer
|
type: integer
|
||||||
nullable: true
|
nullable: true
|
||||||
|
participants:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: integer
|
||||||
|
example: [1, 5, 7]
|
||||||
created:
|
created:
|
||||||
type: string
|
type: string
|
||||||
format: date-time
|
format: date-time
|
||||||
|
|||||||
@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"host" : "lager",
|
"host" : "localhost",
|
||||||
"port" : 3306,
|
"port" : 33306,
|
||||||
"user" : "ds",
|
"user" : "ds",
|
||||||
"password" : "HalloWach23",
|
"password" : "HalloWach_2323XXL!!",
|
||||||
"pool_name" : "brecal_pool",
|
"pool_name" : "brecal_pool",
|
||||||
"pool_size" : 20,
|
"pool_size" : 20,
|
||||||
"database" : "bremen_calling",
|
"database" : "bremen_calling",
|
||||||
|
|||||||
@ -21,6 +21,11 @@ def GetShipcalls(options):
|
|||||||
"flags, pier_side, bunkering, replenishing, draft, tidal_window_from, tidal_window_to, rain_sensitive_cargo, recommended_tugs, " +
|
"flags, pier_side, bunkering, replenishing, draft, tidal_window_from, tidal_window_to, rain_sensitive_cargo, recommended_tugs, " +
|
||||||
"created, modified FROM shipcall WHERE eta IS NULL OR eta >= DATE(NOW() - INTERVAL 2 DAY) " +
|
"created, modified FROM shipcall WHERE eta IS NULL OR eta >= DATE(NOW() - INTERVAL 2 DAY) " +
|
||||||
"ORDER BY eta", model=model.Shipcall)
|
"ORDER BY eta", model=model.Shipcall)
|
||||||
|
for shipcall in data:
|
||||||
|
participant_query = "SELECT participant_id FROM shipcall_participant_map WHERE shipcall_id=?shipcall_id?";
|
||||||
|
for record in commands.query(participant_query, model=dict, param={"shipcall_id" : shipcall.id}, buffered=False):
|
||||||
|
shipcall.participants.append(record["participant_id"])
|
||||||
|
|
||||||
pooledConnection.close()
|
pooledConnection.close()
|
||||||
|
|
||||||
except Exception as ex:
|
except Exception as ex:
|
||||||
@ -52,6 +57,8 @@ def PostShipcalls(schemaModel):
|
|||||||
for key in schemaModel.keys():
|
for key in schemaModel.keys():
|
||||||
if key == "id":
|
if key == "id":
|
||||||
continue
|
continue
|
||||||
|
if key == "participants":
|
||||||
|
continue
|
||||||
if isNotFirst:
|
if isNotFirst:
|
||||||
query += ","
|
query += ","
|
||||||
isNotFirst = True
|
isNotFirst = True
|
||||||
@ -61,6 +68,8 @@ def PostShipcalls(schemaModel):
|
|||||||
for key in schemaModel.keys():
|
for key in schemaModel.keys():
|
||||||
if key == "id":
|
if key == "id":
|
||||||
continue
|
continue
|
||||||
|
if key == "participants":
|
||||||
|
continue
|
||||||
if isNotFirst:
|
if isNotFirst:
|
||||||
query += ","
|
query += ","
|
||||||
isNotFirst = True
|
isNotFirst = True
|
||||||
@ -99,6 +108,8 @@ def PutShipcalls(schemaModel):
|
|||||||
for key in schemaModel.keys():
|
for key in schemaModel.keys():
|
||||||
if key == "id":
|
if key == "id":
|
||||||
continue
|
continue
|
||||||
|
if key == "participants":
|
||||||
|
continue
|
||||||
if isNotFirst:
|
if isNotFirst:
|
||||||
query += ", "
|
query += ", "
|
||||||
isNotFirst = True
|
isNotFirst = True
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
|
from dataclasses import field
|
||||||
from marshmallow import Schema, fields, INCLUDE, ValidationError
|
from marshmallow import Schema, fields, INCLUDE, ValidationError
|
||||||
from marshmallow_dataclass import dataclass
|
from marshmallow_dataclass import dataclass
|
||||||
|
from typing import List
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import datetime
|
import datetime
|
||||||
@ -104,7 +106,7 @@ class Shipcall:
|
|||||||
recommended_tugs: int
|
recommended_tugs: int
|
||||||
created: datetime
|
created: datetime
|
||||||
modified: datetime
|
modified: datetime
|
||||||
|
participants: List[int] = field(default_factory=list)
|
||||||
|
|
||||||
class ShipcallId(Schema):
|
class ShipcallId(Schema):
|
||||||
pass
|
pass
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user