From c1a2f78a14a6b9e77a688c5d25706d7329a561ca Mon Sep 17 00:00:00 2001 From: puls200 Date: Mon, 9 Oct 2023 17:37:44 +0200 Subject: [PATCH] saving is possible (again), fixed the nested parameter --- misc/BreCalApi.cs | 562 +++++++++++------- misc/BreCalApi.yaml | 21 +- src/BreCalClient/EditShipcallControl.xaml.cs | 55 +- .../EditTimesAgencyIncomingControl.xaml.cs | 42 +- .../EditTimesAgencyOutgoingControl.xaml.cs | 42 +- .../EditTimesAgencyShiftingControl.xaml.cs | 42 +- src/BreCalClient/MainWindow.xaml.cs | 13 +- src/BreCalClient/ShipcallControlModel.cs | 26 +- src/server/BreCal/impl/shipcalls.py | 26 +- src/server/BreCal/schemas/model.py | 11 +- 10 files changed, 526 insertions(+), 314 deletions(-) diff --git a/misc/BreCalApi.cs b/misc/BreCalApi.cs index d4a06ed..02ce2c2 100644 --- a/misc/BreCalApi.cs +++ b/misc/BreCalApi.cs @@ -1,7 +1,7 @@ //---------------------- // -// Generated REST API Client Code Generator v1.8.4.0 on 04.10.2023 07:39:32 +// Generated REST API Client Code Generator v1.8.4.0 on 09.10.2023 09:18:15 // Using the tool OpenAPI Generator v7.0.0 // //---------------------- @@ -71,7 +71,7 @@ namespace BreCalClient.misc.Api /// Gets a list of all berths registered /// /// - /// + /// /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -89,7 +89,7 @@ namespace BreCalClient.misc.Api /// Returns a JWT session token and user data if successful /// /// - /// + /// /// /// Thrown when fails to make API call /// Login credentials @@ -109,7 +109,7 @@ namespace BreCalClient.misc.Api /// Gets a list of notifications pursuant to a specified participant and ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// **Id of participant**. *Example: 2*. Id returned through loading of participant @@ -129,7 +129,7 @@ namespace BreCalClient.misc.Api /// gets a particular participant entry corresponding to user id /// /// - /// + /// /// /// Thrown when fails to make API call /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) @@ -147,7 +147,7 @@ namespace BreCalClient.misc.Api /// Gets a list of ship calls /// /// - /// + /// /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -165,7 +165,7 @@ namespace BreCalClient.misc.Api /// Create a new ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Creates a new ship call. **Do not** provide id parameter. @@ -184,7 +184,7 @@ namespace BreCalClient.misc.Api /// Updates a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Creates a new ship call. The id parameter is **required**. @@ -202,7 +202,7 @@ namespace BreCalClient.misc.Api /// gets a list of registered shipcalls /// /// - /// + /// /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -220,7 +220,7 @@ namespace BreCalClient.misc.Api /// Delete a times entry for a ship call. /// /// - /// + /// /// /// Thrown when fails to make API call /// @@ -239,7 +239,7 @@ namespace BreCalClient.misc.Api /// Get all recorded times for a a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// **Id**. *Example: 42*. Id of referenced ship call. (optional) @@ -258,7 +258,7 @@ namespace BreCalClient.misc.Api /// Create a new times entry for a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. **Do not** provide id parameter. @@ -277,7 +277,7 @@ namespace BreCalClient.misc.Api /// Update a times entry for a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. The id parameter is **required**. @@ -296,7 +296,7 @@ namespace BreCalClient.misc.Api /// Update user details (first/last name, phone, password) /// /// - /// + /// /// /// Thrown when fails to make API call /// User details @@ -315,7 +315,7 @@ namespace BreCalClient.misc.Api /// Gets a list of all berths registered /// /// - /// + /// /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -326,7 +326,7 @@ namespace BreCalClient.misc.Api /// Gets a list of all berths registered /// /// - /// + /// /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -337,7 +337,7 @@ namespace BreCalClient.misc.Api /// Returns a JWT session token and user data if successful /// /// - /// + /// /// /// Thrown when fails to make API call /// Login credentials @@ -349,7 +349,7 @@ namespace BreCalClient.misc.Api /// Returns a JWT session token and user data if successful /// /// - /// + /// /// /// Thrown when fails to make API call /// Login credentials @@ -361,7 +361,7 @@ namespace BreCalClient.misc.Api /// Gets a list of notifications pursuant to a specified participant and ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// **Id of participant**. *Example: 2*. Id returned through loading of participant @@ -374,7 +374,7 @@ namespace BreCalClient.misc.Api /// Gets a list of notifications pursuant to a specified participant and ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// **Id of participant**. *Example: 2*. Id returned through loading of participant @@ -387,7 +387,7 @@ namespace BreCalClient.misc.Api /// gets a particular participant entry corresponding to user id /// /// - /// + /// /// /// Thrown when fails to make API call /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) @@ -399,7 +399,7 @@ namespace BreCalClient.misc.Api /// gets a particular participant entry corresponding to user id /// /// - /// + /// /// /// Thrown when fails to make API call /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) @@ -411,7 +411,7 @@ namespace BreCalClient.misc.Api /// Gets a list of ship calls /// /// - /// + /// /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -422,7 +422,7 @@ namespace BreCalClient.misc.Api /// Gets a list of ship calls /// /// - /// + /// /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -433,7 +433,7 @@ namespace BreCalClient.misc.Api /// Create a new ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Creates a new ship call. **Do not** provide id parameter. @@ -445,7 +445,7 @@ namespace BreCalClient.misc.Api /// Create a new ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Creates a new ship call. **Do not** provide id parameter. @@ -457,7 +457,7 @@ namespace BreCalClient.misc.Api /// Updates a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Creates a new ship call. The id parameter is **required**. @@ -469,7 +469,7 @@ namespace BreCalClient.misc.Api /// Updates a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Creates a new ship call. The id parameter is **required**. @@ -481,7 +481,7 @@ namespace BreCalClient.misc.Api /// gets a list of registered shipcalls /// /// - /// + /// /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -492,7 +492,7 @@ namespace BreCalClient.misc.Api /// gets a list of registered shipcalls /// /// - /// + /// /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -503,7 +503,7 @@ namespace BreCalClient.misc.Api /// Delete a times entry for a ship call. /// /// - /// + /// /// /// Thrown when fails to make API call /// @@ -515,7 +515,7 @@ namespace BreCalClient.misc.Api /// Delete a times entry for a ship call. /// /// - /// + /// /// /// Thrown when fails to make API call /// @@ -527,7 +527,7 @@ namespace BreCalClient.misc.Api /// Get all recorded times for a a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// **Id**. *Example: 42*. Id of referenced ship call. (optional) @@ -539,7 +539,7 @@ namespace BreCalClient.misc.Api /// Get all recorded times for a a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// **Id**. *Example: 42*. Id of referenced ship call. (optional) @@ -551,7 +551,7 @@ namespace BreCalClient.misc.Api /// Create a new times entry for a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. **Do not** provide id parameter. @@ -563,7 +563,7 @@ namespace BreCalClient.misc.Api /// Create a new times entry for a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. **Do not** provide id parameter. @@ -575,7 +575,7 @@ namespace BreCalClient.misc.Api /// Update a times entry for a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. The id parameter is **required**. @@ -587,7 +587,7 @@ namespace BreCalClient.misc.Api /// Update a times entry for a ship call /// /// - /// + /// /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. The id parameter is **required**. @@ -599,7 +599,7 @@ namespace BreCalClient.misc.Api /// Update user details (first/last name, phone, password) /// /// - /// + /// /// /// Thrown when fails to make API call /// User details @@ -611,7 +611,7 @@ namespace BreCalClient.misc.Api /// Update user details (first/last name, phone, password) /// /// - /// + /// /// /// Thrown when fails to make API call /// User details @@ -725,7 +725,7 @@ namespace BreCalClient.misc.Api set { _exceptionFactory = value; } } /// - /// Gets a list of all berths registered + /// Gets a list of all berths registered /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -736,7 +736,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Gets a list of all berths registered + /// Gets a list of all berths registered /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -780,7 +780,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Gets a list of all berths registered + /// Gets a list of all berths registered /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -792,7 +792,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Gets a list of all berths registered + /// Gets a list of all berths registered /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -837,7 +837,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Returns a JWT session token and user data if successful + /// Returns a JWT session token and user data if successful /// /// Thrown when fails to make API call /// Login credentials @@ -849,7 +849,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Returns a JWT session token and user data if successful + /// Returns a JWT session token and user data if successful /// /// Thrown when fails to make API call /// Login credentials @@ -901,7 +901,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Returns a JWT session token and user data if successful + /// Returns a JWT session token and user data if successful /// /// Thrown when fails to make API call /// Login credentials @@ -914,7 +914,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Returns a JWT session token and user data if successful + /// Returns a JWT session token and user data if successful /// /// Thrown when fails to make API call /// Login credentials @@ -967,7 +967,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Gets a list of notifications pursuant to a specified participant and ship call + /// Gets a list of notifications pursuant to a specified participant and ship call /// /// Thrown when fails to make API call /// **Id of participant**. *Example: 2*. Id returned through loading of participant @@ -980,7 +980,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Gets a list of notifications pursuant to a specified participant and ship call + /// Gets a list of notifications pursuant to a specified participant and ship call /// /// Thrown when fails to make API call /// **Id of participant**. *Example: 2*. Id returned through loading of participant @@ -1028,7 +1028,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Gets a list of notifications pursuant to a specified participant and ship call + /// Gets a list of notifications pursuant to a specified participant and ship call /// /// Thrown when fails to make API call /// **Id of participant**. *Example: 2*. Id returned through loading of participant @@ -1042,7 +1042,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Gets a list of notifications pursuant to a specified participant and ship call + /// Gets a list of notifications pursuant to a specified participant and ship call /// /// Thrown when fails to make API call /// **Id of participant**. *Example: 2*. Id returned through loading of participant @@ -1091,7 +1091,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// gets a particular participant entry corresponding to user id + /// gets a particular participant entry corresponding to user id /// /// Thrown when fails to make API call /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) @@ -1103,7 +1103,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// gets a particular participant entry corresponding to user id + /// gets a particular participant entry corresponding to user id /// /// Thrown when fails to make API call /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) @@ -1152,7 +1152,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// gets a particular participant entry corresponding to user id + /// gets a particular participant entry corresponding to user id /// /// Thrown when fails to make API call /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) @@ -1165,7 +1165,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// gets a particular participant entry corresponding to user id + /// gets a particular participant entry corresponding to user id /// /// Thrown when fails to make API call /// **Id of user**. *Example: 2*. User id returned by verify call. (optional) @@ -1215,7 +1215,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Gets a list of ship calls + /// Gets a list of ship calls /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -1226,7 +1226,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Gets a list of ship calls + /// Gets a list of ship calls /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -1270,7 +1270,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Gets a list of ship calls + /// Gets a list of ship calls /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -1282,7 +1282,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Gets a list of ship calls + /// Gets a list of ship calls /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -1327,7 +1327,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Create a new ship call + /// Create a new ship call /// /// Thrown when fails to make API call /// Creates a new ship call. **Do not** provide id parameter. @@ -1339,7 +1339,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Create a new ship call + /// Create a new ship call /// /// Thrown when fails to make API call /// Creates a new ship call. **Do not** provide id parameter. @@ -1391,7 +1391,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Create a new ship call + /// Create a new ship call /// /// Thrown when fails to make API call /// Creates a new ship call. **Do not** provide id parameter. @@ -1404,7 +1404,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Create a new ship call + /// Create a new ship call /// /// Thrown when fails to make API call /// Creates a new ship call. **Do not** provide id parameter. @@ -1457,7 +1457,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Updates a ship call + /// Updates a ship call /// /// Thrown when fails to make API call /// Creates a new ship call. The id parameter is **required**. @@ -1469,7 +1469,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Updates a ship call + /// Updates a ship call /// /// Thrown when fails to make API call /// Creates a new ship call. The id parameter is **required**. @@ -1521,7 +1521,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Updates a ship call + /// Updates a ship call /// /// Thrown when fails to make API call /// Creates a new ship call. The id parameter is **required**. @@ -1534,7 +1534,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Updates a ship call + /// Updates a ship call /// /// Thrown when fails to make API call /// Creates a new ship call. The id parameter is **required**. @@ -1587,7 +1587,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// gets a list of registered shipcalls + /// gets a list of registered shipcalls /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -1598,7 +1598,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// gets a list of registered shipcalls + /// gets a list of registered shipcalls /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -1642,7 +1642,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// gets a list of registered shipcalls + /// gets a list of registered shipcalls /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -1654,7 +1654,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// gets a list of registered shipcalls + /// gets a list of registered shipcalls /// /// Thrown when fails to make API call /// Index associated with the operation. @@ -1699,7 +1699,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Delete a times entry for a ship call. + /// Delete a times entry for a ship call. /// /// Thrown when fails to make API call /// @@ -1710,7 +1710,7 @@ namespace BreCalClient.misc.Api TimesDeleteWithHttpInfo(id); } /// - /// Delete a times entry for a ship call. + /// Delete a times entry for a ship call. /// /// Thrown when fails to make API call /// @@ -1756,7 +1756,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Delete a times entry for a ship call. + /// Delete a times entry for a ship call. /// /// Thrown when fails to make API call /// @@ -1768,7 +1768,7 @@ namespace BreCalClient.misc.Api await TimesDeleteWithHttpInfoAsync(id, operationIndex, cancellationToken).ConfigureAwait(false); } /// - /// Delete a times entry for a ship call. + /// Delete a times entry for a ship call. /// /// Thrown when fails to make API call /// @@ -1815,7 +1815,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Get all recorded times for a a ship call + /// Get all recorded times for a a ship call /// /// Thrown when fails to make API call /// **Id**. *Example: 42*. Id of referenced ship call. (optional) @@ -1827,7 +1827,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Get all recorded times for a a ship call + /// Get all recorded times for a a ship call /// /// Thrown when fails to make API call /// **Id**. *Example: 42*. Id of referenced ship call. (optional) @@ -1876,7 +1876,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Get all recorded times for a a ship call + /// Get all recorded times for a a ship call /// /// Thrown when fails to make API call /// **Id**. *Example: 42*. Id of referenced ship call. (optional) @@ -1889,7 +1889,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Get all recorded times for a a ship call + /// Get all recorded times for a a ship call /// /// Thrown when fails to make API call /// **Id**. *Example: 42*. Id of referenced ship call. (optional) @@ -1939,7 +1939,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Create a new times entry for a ship call + /// Create a new times entry for a ship call /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. **Do not** provide id parameter. @@ -1951,7 +1951,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Create a new times entry for a ship call + /// Create a new times entry for a ship call /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. **Do not** provide id parameter. @@ -2003,7 +2003,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Create a new times entry for a ship call + /// Create a new times entry for a ship call /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. **Do not** provide id parameter. @@ -2016,7 +2016,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Create a new times entry for a ship call + /// Create a new times entry for a ship call /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. **Do not** provide id parameter. @@ -2069,7 +2069,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Update a times entry for a ship call + /// Update a times entry for a ship call /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. The id parameter is **required**. @@ -2081,7 +2081,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Update a times entry for a ship call + /// Update a times entry for a ship call /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. The id parameter is **required**. @@ -2133,7 +2133,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Update a times entry for a ship call + /// Update a times entry for a ship call /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. The id parameter is **required**. @@ -2146,7 +2146,7 @@ namespace BreCalClient.misc.Api return localVarResponse.Data; } /// - /// Update a times entry for a ship call + /// Update a times entry for a ship call /// /// Thrown when fails to make API call /// Times entry that will be added to the ship call. The id parameter is **required**. @@ -2199,7 +2199,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Update user details (first/last name, phone, password) + /// Update user details (first/last name, phone, password) /// /// Thrown when fails to make API call /// User details @@ -2210,7 +2210,7 @@ namespace BreCalClient.misc.Api UserPutWithHttpInfo(userDetails); } /// - /// Update user details (first/last name, phone, password) + /// Update user details (first/last name, phone, password) /// /// Thrown when fails to make API call /// User details @@ -2262,7 +2262,7 @@ namespace BreCalClient.misc.Api return localVarResponse; } /// - /// Update user details (first/last name, phone, password) + /// Update user details (first/last name, phone, password) /// /// Thrown when fails to make API call /// User details @@ -2274,7 +2274,7 @@ namespace BreCalClient.misc.Api await UserPutWithHttpInfoAsync(userDetails, operationIndex, cancellationToken).ConfigureAwait(false); } /// - /// Update user details (first/last name, phone, password) + /// Update user details (first/last name, phone, password) /// /// Thrown when fails to make API call /// User details @@ -3623,7 +3623,7 @@ namespace BreCalClient.misc.Client /// /// Gets or sets the base path for API access. /// - public virtual string BasePath + public virtual string BasePath { get { return _basePath; } set { _basePath = value; } @@ -3770,7 +3770,7 @@ namespace BreCalClient.misc.Client /// /// ApiKeyPrefix["Authorization"] = "Bearer"; /// - /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. + /// � where ApiKey["Authorization"] would then be used to set the value of your bearer token. /// /// /// OAuth2 workflows should set tokens via AccessToken. @@ -4913,16 +4913,18 @@ namespace BreCalClient.misc.Model /// /// id. /// name. - /// participantId. + /// ownerId. + /// authorityId. /// varLock. /// created. /// modified. /// deleted (default to false). - public Berth(int id = default(int), string name = default(string), int? participantId = default(int?), bool? varLock = default(bool?), DateTime created = default(DateTime), DateTime? modified = default(DateTime?), bool deleted = false) + public Berth(int id = default(int), string name = default(string), int? ownerId = default(int?), int? authorityId = default(int?), bool? varLock = default(bool?), DateTime created = default(DateTime), DateTime? modified = default(DateTime?), bool deleted = false) { this.Id = id; this.Name = name; - this.ParticipantId = participantId; + this.OwnerId = ownerId; + this.AuthorityId = authorityId; this.VarLock = varLock; this.Created = created; this.Modified = modified; @@ -4939,10 +4941,15 @@ namespace BreCalClient.misc.Model [DataMember(Name = "name", EmitDefaultValue = true)] public string Name { get; set; } /// - /// Gets or Sets ParticipantId + /// Gets or Sets OwnerId /// - [DataMember(Name = "participant_id", EmitDefaultValue = true)] - public int? ParticipantId { get; set; } + [DataMember(Name = "owner_id", EmitDefaultValue = true)] + public int? OwnerId { get; set; } + /// + /// Gets or Sets AuthorityId + /// + [DataMember(Name = "authority_id", EmitDefaultValue = true)] + public int? AuthorityId { get; set; } /// /// Gets or Sets VarLock /// @@ -4973,7 +4980,8 @@ namespace BreCalClient.misc.Model sb.Append("class Berth {\n"); sb.Append(" Id: ").Append(Id).Append("\n"); sb.Append(" Name: ").Append(Name).Append("\n"); - sb.Append(" ParticipantId: ").Append(ParticipantId).Append("\n"); + sb.Append(" OwnerId: ").Append(OwnerId).Append("\n"); + sb.Append(" AuthorityId: ").Append(AuthorityId).Append("\n"); sb.Append(" VarLock: ").Append(VarLock).Append("\n"); sb.Append(" Created: ").Append(Created).Append("\n"); sb.Append(" Modified: ").Append(Modified).Append("\n"); @@ -5009,36 +5017,41 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Id == input.Id || this.Id.Equals(input.Id) - ) && + ) && ( this.Name == input.Name || (this.Name != null && this.Name.Equals(input.Name)) - ) && + ) && ( - this.ParticipantId == input.ParticipantId || - (this.ParticipantId != null && - this.ParticipantId.Equals(input.ParticipantId)) - ) && + this.OwnerId == input.OwnerId || + (this.OwnerId != null && + this.OwnerId.Equals(input.OwnerId)) + ) && + ( + this.AuthorityId == input.AuthorityId || + (this.AuthorityId != null && + this.AuthorityId.Equals(input.AuthorityId)) + ) && ( this.VarLock == input.VarLock || (this.VarLock != null && this.VarLock.Equals(input.VarLock)) - ) && + ) && ( this.Created == input.Created || (this.Created != null && this.Created.Equals(input.Created)) - ) && + ) && ( this.Modified == input.Modified || (this.Modified != null && this.Modified.Equals(input.Modified)) - ) && + ) && ( this.Deleted == input.Deleted || this.Deleted.Equals(input.Deleted) @@ -5058,9 +5071,13 @@ namespace BreCalClient.misc.Model { hashCode = (hashCode * 59) + this.Name.GetHashCode(); } - if (this.ParticipantId != null) + if (this.OwnerId != null) { - hashCode = (hashCode * 59) + this.ParticipantId.GetHashCode(); + hashCode = (hashCode * 59) + this.OwnerId.GetHashCode(); + } + if (this.AuthorityId != null) + { + hashCode = (hashCode * 59) + this.AuthorityId.GetHashCode(); } if (this.VarLock != null) { @@ -5188,12 +5205,12 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Username == input.Username || (this.Username != null && this.Username.Equals(input.Username)) - ) && + ) && ( this.Password == input.Password || (this.Password != null && @@ -5313,7 +5330,7 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Message == input.Message || (this.Message != null && @@ -5418,7 +5435,7 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.VarId == input.VarId || this.VarId.Equals(input.VarId) @@ -5575,39 +5592,39 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Id == input.Id || this.Id.Equals(input.Id) - ) && + ) && ( this.ParticipantId == input.ParticipantId || this.ParticipantId.Equals(input.ParticipantId) - ) && + ) && ( this.FirstName == input.FirstName || (this.FirstName != null && this.FirstName.Equals(input.FirstName)) - ) && + ) && ( this.LastName == input.LastName || (this.LastName != null && this.LastName.Equals(input.LastName)) - ) && + ) && ( this.UserName == input.UserName || (this.UserName != null && this.UserName.Equals(input.UserName)) - ) && + ) && ( this.UserPhone == input.UserPhone || (this.UserPhone != null && this.UserPhone.Equals(input.UserPhone)) - ) && + ) && ( this.Exp == input.Exp || this.Exp.Equals(input.Exp) - ) && + ) && ( this.Token == input.Token || (this.Token != null && @@ -5809,37 +5826,37 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Id == input.Id || this.Id.Equals(input.Id) - ) && + ) && ( this.TimesId == input.TimesId || this.TimesId.Equals(input.TimesId) - ) && + ) && ( this.ParticipantId == input.ParticipantId || this.ParticipantId.Equals(input.ParticipantId) - ) && + ) && ( this.NotificationType == input.NotificationType || this.NotificationType.Equals(input.NotificationType) - ) && + ) && ( this.Timestamp == input.Timestamp || (this.Timestamp != null && this.Timestamp.Equals(input.Timestamp)) - ) && + ) && ( this.Acknowledged == input.Acknowledged || this.Acknowledged.Equals(input.Acknowledged) - ) && + ) && ( this.Created == input.Created || (this.Created != null && this.Created.Equals(input.Created)) - ) && + ) && ( this.Modified == input.Modified || (this.Modified != null && @@ -6029,50 +6046,50 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Id == input.Id || this.Id.Equals(input.Id) - ) && + ) && ( this.Name == input.Name || (this.Name != null && this.Name.Equals(input.Name)) - ) && + ) && ( this.Street == input.Street || (this.Street != null && this.Street.Equals(input.Street)) - ) && + ) && ( this.PostalCode == input.PostalCode || (this.PostalCode != null && this.PostalCode.Equals(input.PostalCode)) - ) && + ) && ( this.City == input.City || (this.City != null && this.City.Equals(input.City)) - ) && + ) && ( this.Type == input.Type || this.Type.Equals(input.Type) - ) && + ) && ( this.Flags == input.Flags || (this.Flags != null && this.Flags.Equals(input.Flags)) - ) && + ) && ( this.Created == input.Created || (this.Created != null && this.Created.Equals(input.Created)) - ) && + ) && ( this.Modified == input.Modified || (this.Modified != null && this.Modified.Equals(input.Modified)) - ) && + ) && ( this.Deleted == input.Deleted || this.Deleted.Equals(input.Deleted) @@ -6153,6 +6170,125 @@ namespace BreCalClient.misc.Model } } +/* + * Bremen calling API + * + * Administer DEBRE ship calls, times and notifications + * + * The version of the OpenAPI document: 0.6.0 + * Contact: info@textbausteine.net + * Generated by: https://github.com/openapitools/openapi-generator.git + */ +namespace BreCalClient.misc.Model +{ + /// + /// Participant assigned to a shipcall with a given role (type) + /// + [DataContract(Name = "participant_assignment")] + public partial class ParticipantAssignment : IEquatable, IValidatableObject + { + /// + /// Initializes a new instance of the class. + /// + [JsonConstructorAttribute] + protected ParticipantAssignment() { } + /// + /// Initializes a new instance of the class. + /// + /// participantId (required). + /// type (required). + public ParticipantAssignment(int participantId = default(int), int type = default(int)) + { + this.ParticipantId = participantId; + this.Type = type; + } + /// + /// Gets or Sets ParticipantId + /// + [DataMember(Name = "participant_id", IsRequired = true, EmitDefaultValue = true)] + public int ParticipantId { get; set; } + /// + /// Gets or Sets Type + /// + [DataMember(Name = "type", IsRequired = true, EmitDefaultValue = true)] + public int Type { get; set; } + /// + /// Returns the string presentation of the object + /// + /// String presentation of the object + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + sb.Append("class ParticipantAssignment {\n"); + sb.Append(" ParticipantId: ").Append(ParticipantId).Append("\n"); + sb.Append(" Type: ").Append(Type).Append("\n"); + sb.Append("}\n"); + return sb.ToString(); + } + /// + /// Returns the JSON string presentation of the object + /// + /// JSON string presentation of the object + public virtual string ToJson() + { + return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented); + } + /// + /// Returns true if objects are equal + /// + /// Object to be compared + /// Boolean + public override bool Equals(object input) + { + return this.Equals(input as ParticipantAssignment); + } + /// + /// Returns true if ParticipantAssignment instances are equal + /// + /// Instance of ParticipantAssignment to be compared + /// Boolean + public bool Equals(ParticipantAssignment input) + { + if (input == null) + { + return false; + } + return + ( + this.ParticipantId == input.ParticipantId || + this.ParticipantId.Equals(input.ParticipantId) + ) && + ( + this.Type == input.Type || + this.Type.Equals(input.Type) + ); + } + /// + /// Gets the hash code + /// + /// Hash code + public override int GetHashCode() + { + unchecked // Overflow is fine, just wrap + { + int hashCode = 41; + hashCode = (hashCode * 59) + this.ParticipantId.GetHashCode(); + hashCode = (hashCode * 59) + this.Type.GetHashCode(); + return hashCode; + } + } + /// + /// To validate all properties of the instance + /// + /// Validation context + /// Validation Result + IEnumerable IValidatableObject.Validate(ValidationContext validationContext) + { + yield break; + } + } +} + /* * Bremen calling API * @@ -6319,65 +6455,65 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Id == input.Id || this.Id.Equals(input.Id) - ) && + ) && ( this.Name == input.Name || (this.Name != null && this.Name.Equals(input.Name)) - ) && + ) && ( this.Imo == input.Imo || (this.Imo != null && this.Imo.Equals(input.Imo)) - ) && + ) && ( this.Callsign == input.Callsign || (this.Callsign != null && this.Callsign.Equals(input.Callsign)) - ) && + ) && ( this.ParticipantId == input.ParticipantId || (this.ParticipantId != null && this.ParticipantId.Equals(input.ParticipantId)) - ) && + ) && ( this.Length == input.Length || (this.Length != null && this.Length.Equals(input.Length)) - ) && + ) && ( this.Width == input.Width || (this.Width != null && this.Width.Equals(input.Width)) - ) && + ) && ( this.IsTug == input.IsTug || this.IsTug.Equals(input.IsTug) - ) && + ) && ( this.BollardPull == input.BollardPull || (this.BollardPull != null && this.BollardPull.Equals(input.BollardPull)) - ) && + ) && ( this.Eni == input.Eni || (this.Eni != null && this.Eni.Equals(input.Eni)) - ) && + ) && ( this.Created == input.Created || (this.Created != null && this.Created.Equals(input.Created)) - ) && + ) && ( this.Modified == input.Modified || (this.Modified != null && this.Modified.Equals(input.Modified)) - ) && + ) && ( this.Deleted == input.Deleted || this.Deleted.Equals(input.Deleted) @@ -6513,7 +6649,7 @@ namespace BreCalClient.misc.Model /// participants. /// created. /// modified. - public Shipcall(int id = default(int), int shipId = default(int), int type = default(int), DateTime eta = default(DateTime), string voyage = default(string), DateTime? etd = default(DateTime?), int? arrivalBerthId = default(int?), int? departureBerthId = default(int?), bool? tugRequired = default(bool?), bool? pilotRequired = default(bool?), int? flags = default(int?), bool? pierSide = default(bool?), bool? bunkering = default(bool?), bool? replenishingTerminal = default(bool?), bool? replenishingLock = default(bool?), float? draft = default(float?), DateTime? tidalWindowFrom = default(DateTime?), DateTime? tidalWindowTo = default(DateTime?), bool? rainSensitiveCargo = default(bool?), int? recommendedTugs = default(int?), bool? anchored = default(bool?), bool? mooredLock = default(bool?), bool? canceled = default(bool?), int? evaluation = default(int?), string evaluationMessage = default(string), List participants = default(List), DateTime created = default(DateTime), DateTime? modified = default(DateTime?)) + public Shipcall(int id = default(int), int shipId = default(int), int type = default(int), DateTime eta = default(DateTime), string voyage = default(string), DateTime? etd = default(DateTime?), int? arrivalBerthId = default(int?), int? departureBerthId = default(int?), bool? tugRequired = default(bool?), bool? pilotRequired = default(bool?), int? flags = default(int?), bool? pierSide = default(bool?), bool? bunkering = default(bool?), bool? replenishingTerminal = default(bool?), bool? replenishingLock = default(bool?), float? draft = default(float?), DateTime? tidalWindowFrom = default(DateTime?), DateTime? tidalWindowTo = default(DateTime?), bool? rainSensitiveCargo = default(bool?), int? recommendedTugs = default(int?), bool? anchored = default(bool?), bool? mooredLock = default(bool?), bool? canceled = default(bool?), int? evaluation = default(int?), string evaluationMessage = default(string), List participants = default(List), DateTime created = default(DateTime), DateTime? modified = default(DateTime?)) { this.Id = id; this.ShipId = shipId; @@ -6673,9 +6809,8 @@ namespace BreCalClient.misc.Model /// /// Gets or Sets Participants /// - /// [1,5,7] [DataMember(Name = "participants", EmitDefaultValue = true)] - public List Participants { get; set; } + public List Participants { get; set; } /// /// Gets or Sets Created /// @@ -6753,140 +6888,140 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Id == input.Id || this.Id.Equals(input.Id) - ) && + ) && ( this.ShipId == input.ShipId || this.ShipId.Equals(input.ShipId) - ) && + ) && ( this.Type == input.Type || this.Type.Equals(input.Type) - ) && + ) && ( this.Eta == input.Eta || (this.Eta != null && this.Eta.Equals(input.Eta)) - ) && + ) && ( this.Voyage == input.Voyage || (this.Voyage != null && this.Voyage.Equals(input.Voyage)) - ) && + ) && ( this.Etd == input.Etd || (this.Etd != null && this.Etd.Equals(input.Etd)) - ) && + ) && ( this.ArrivalBerthId == input.ArrivalBerthId || (this.ArrivalBerthId != null && this.ArrivalBerthId.Equals(input.ArrivalBerthId)) - ) && + ) && ( this.DepartureBerthId == input.DepartureBerthId || (this.DepartureBerthId != null && this.DepartureBerthId.Equals(input.DepartureBerthId)) - ) && + ) && ( this.TugRequired == input.TugRequired || (this.TugRequired != null && this.TugRequired.Equals(input.TugRequired)) - ) && + ) && ( this.PilotRequired == input.PilotRequired || (this.PilotRequired != null && this.PilotRequired.Equals(input.PilotRequired)) - ) && + ) && ( this.Flags == input.Flags || (this.Flags != null && this.Flags.Equals(input.Flags)) - ) && + ) && ( this.PierSide == input.PierSide || (this.PierSide != null && this.PierSide.Equals(input.PierSide)) - ) && + ) && ( this.Bunkering == input.Bunkering || (this.Bunkering != null && this.Bunkering.Equals(input.Bunkering)) - ) && + ) && ( this.ReplenishingTerminal == input.ReplenishingTerminal || (this.ReplenishingTerminal != null && this.ReplenishingTerminal.Equals(input.ReplenishingTerminal)) - ) && + ) && ( this.ReplenishingLock == input.ReplenishingLock || (this.ReplenishingLock != null && this.ReplenishingLock.Equals(input.ReplenishingLock)) - ) && + ) && ( this.Draft == input.Draft || (this.Draft != null && this.Draft.Equals(input.Draft)) - ) && + ) && ( this.TidalWindowFrom == input.TidalWindowFrom || (this.TidalWindowFrom != null && this.TidalWindowFrom.Equals(input.TidalWindowFrom)) - ) && + ) && ( this.TidalWindowTo == input.TidalWindowTo || (this.TidalWindowTo != null && this.TidalWindowTo.Equals(input.TidalWindowTo)) - ) && + ) && ( this.RainSensitiveCargo == input.RainSensitiveCargo || (this.RainSensitiveCargo != null && this.RainSensitiveCargo.Equals(input.RainSensitiveCargo)) - ) && + ) && ( this.RecommendedTugs == input.RecommendedTugs || (this.RecommendedTugs != null && this.RecommendedTugs.Equals(input.RecommendedTugs)) - ) && + ) && ( this.Anchored == input.Anchored || (this.Anchored != null && this.Anchored.Equals(input.Anchored)) - ) && + ) && ( this.MooredLock == input.MooredLock || (this.MooredLock != null && this.MooredLock.Equals(input.MooredLock)) - ) && + ) && ( this.Canceled == input.Canceled || (this.Canceled != null && this.Canceled.Equals(input.Canceled)) - ) && + ) && ( this.Evaluation == input.Evaluation || (this.Evaluation != null && this.Evaluation.Equals(input.Evaluation)) - ) && + ) && ( this.EvaluationMessage == input.EvaluationMessage || (this.EvaluationMessage != null && this.EvaluationMessage.Equals(input.EvaluationMessage)) - ) && + ) && ( this.Participants == input.Participants || this.Participants != null && input.Participants != null && this.Participants.SequenceEqual(input.Participants) - ) && + ) && ( this.Created == input.Created || (this.Created != null && this.Created.Equals(input.Created)) - ) && + ) && ( this.Modified == input.Modified || (this.Modified != null && @@ -7252,99 +7387,99 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Id == input.Id || this.Id.Equals(input.Id) - ) && + ) && ( this.EtaBerth == input.EtaBerth || (this.EtaBerth != null && this.EtaBerth.Equals(input.EtaBerth)) - ) && + ) && ( this.EtaBerthFixed == input.EtaBerthFixed || (this.EtaBerthFixed != null && this.EtaBerthFixed.Equals(input.EtaBerthFixed)) - ) && + ) && ( this.EtdBerth == input.EtdBerth || (this.EtdBerth != null && this.EtdBerth.Equals(input.EtdBerth)) - ) && + ) && ( this.EtdBerthFixed == input.EtdBerthFixed || (this.EtdBerthFixed != null && this.EtdBerthFixed.Equals(input.EtdBerthFixed)) - ) && + ) && ( this.LockTime == input.LockTime || (this.LockTime != null && this.LockTime.Equals(input.LockTime)) - ) && + ) && ( this.LockTimeFixed == input.LockTimeFixed || (this.LockTimeFixed != null && this.LockTimeFixed.Equals(input.LockTimeFixed)) - ) && + ) && ( this.ZoneEntry == input.ZoneEntry || (this.ZoneEntry != null && this.ZoneEntry.Equals(input.ZoneEntry)) - ) && + ) && ( this.ZoneEntryFixed == input.ZoneEntryFixed || (this.ZoneEntryFixed != null && this.ZoneEntryFixed.Equals(input.ZoneEntryFixed)) - ) && + ) && ( this.OperationsStart == input.OperationsStart || (this.OperationsStart != null && this.OperationsStart.Equals(input.OperationsStart)) - ) && + ) && ( this.OperationsEnd == input.OperationsEnd || (this.OperationsEnd != null && this.OperationsEnd.Equals(input.OperationsEnd)) - ) && + ) && ( this.Remarks == input.Remarks || (this.Remarks != null && this.Remarks.Equals(input.Remarks)) - ) && + ) && ( this.ShipcallId == input.ShipcallId || this.ShipcallId.Equals(input.ShipcallId) - ) && + ) && ( this.ParticipantId == input.ParticipantId || this.ParticipantId.Equals(input.ParticipantId) - ) && + ) && ( this.BerthId == input.BerthId || (this.BerthId != null && this.BerthId.Equals(input.BerthId)) - ) && + ) && ( this.BerthInfo == input.BerthInfo || (this.BerthInfo != null && this.BerthInfo.Equals(input.BerthInfo)) - ) && + ) && ( this.PierSide == input.PierSide || (this.PierSide != null && this.PierSide.Equals(input.PierSide)) - ) && + ) && ( this.ParticipantType == input.ParticipantType || (this.ParticipantType != null && this.ParticipantType.Equals(input.ParticipantType)) - ) && + ) && ( this.Created == input.Created || (this.Created != null && this.Created.Equals(input.Created)) - ) && + ) && ( this.Modified == input.Modified || (this.Modified != null && @@ -7561,31 +7696,31 @@ namespace BreCalClient.misc.Model { return false; } - return + return ( this.Id == input.Id || this.Id.Equals(input.Id) - ) && + ) && ( this.OldPassword == input.OldPassword || (this.OldPassword != null && this.OldPassword.Equals(input.OldPassword)) - ) && + ) && ( this.NewPassword == input.NewPassword || (this.NewPassword != null && this.NewPassword.Equals(input.NewPassword)) - ) && + ) && ( this.FirstName == input.FirstName || (this.FirstName != null && this.FirstName.Equals(input.FirstName)) - ) && + ) && ( this.LastName == input.LastName || (this.LastName != null && this.LastName.Equals(input.LastName)) - ) && + ) && ( this.UserPhone == input.UserPhone || (this.UserPhone != null && @@ -7639,4 +7774,3 @@ namespace BreCalClient.misc.Model #pragma warning restore CS8073 // The result of the expression is always the same since a value of this type is never equal to 'null' } - diff --git a/misc/BreCalApi.yaml b/misc/BreCalApi.yaml index 4836513..009115b 100644 --- a/misc/BreCalApi.yaml +++ b/misc/BreCalApi.yaml @@ -331,7 +331,18 @@ components: type: integer shipcallId: description: The unique identifier of a ship call - type: integer + type: integer + participant_assignment: + description: Participant assigned to a shipcall with a given role (type) + type: object + required: + - participant_id + - type + properties: + participant_id: + type: integer + type: + type: integer shipcall: type: object required: @@ -421,13 +432,7 @@ components: participants: type: array items: - type: object - properties: - participant_id: - type: integer - type: - type: integer - example: [{ "participant_id" : 1, "type" : 1}, { "participant_id" : 5, "type": 2}, { "participant_id" : 7, "type" : 3} ] + $ref: "#/components/schemas/participant_assignment" created: type: string format: date-time diff --git a/src/BreCalClient/EditShipcallControl.xaml.cs b/src/BreCalClient/EditShipcallControl.xaml.cs index 3c9ef71..aa0159a 100644 --- a/src/BreCalClient/EditShipcallControl.xaml.cs +++ b/src/BreCalClient/EditShipcallControl.xaml.cs @@ -145,16 +145,16 @@ namespace BreCalClient if (this.ShipcallModel.Shipcall != null) { this.ShipcallModel.Shipcall.Type = (int)this.comboBoxCategories.SelectedItem; - this.ShipcallModel.Shipcall.Eta = this.datePickerETA.Value ?? DateTime.Now; + this.ShipcallModel.Shipcall.Eta = this.datePickerETA.Value ?? DateTime.Now; this.ShipcallModel.Shipcall.Etd = this.datePickerETD.Value ?? DateTime.Now.AddDays(1); - + this.ShipcallModel.Shipcall.ShipId = ((Ship)this.comboBoxShip.SelectedItem).Id; this.ShipcallModel.Ship = (Ship)this.comboBoxShip.SelectedItem; this.ShipcallModel.Shipcall.ArrivalBerthId = (this.comboBoxArrivalBerth.SelectedItem != null) ? ((Berth)this.comboBoxArrivalBerth.SelectedItem).Id : null; this.ShipcallModel.Shipcall.DepartureBerthId = (this.comboBoxDepartureBerth.SelectedItem != null) ? ((Berth)this.comboBoxDepartureBerth.SelectedItem).Id : null; - - - + + + // remove all and add selected participants this.ShipcallModel.Shipcall.Participants.Clear(); this.ShipcallModel.AssignedParticipants.Clear(); @@ -163,23 +163,42 @@ namespace BreCalClient participant = (Participant?)this.comboBoxAgency.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.AGENCY] = participant; + ParticipantAssignment pa = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.AGENCY + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.AGENCY] = pa; } - + // BSMD and port authority are always added - foreach (Participant p in BreCalLists.Participants) + + // get port authority from berth + + int? berthId = this.ShipcallModel.Shipcall.ArrivalBerthId; + if (berthId == null) berthId = this.ShipcallModel.Shipcall.DepartureBerthId; + if (berthId != null) { - if (p.Type == (int)Extensions.ParticipantType.PORT_ADMINISTRATION) + Berth? selectedBerth = BreCalLists.Berths.Find((x) => x.Id == berthId); + if (selectedBerth?.AuthorityId != null) { - this.ShipcallModel.Shipcall.Participants.Add(p.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PORT_ADMINISTRATION] = p; + if (BreCalLists.ParticipantLookupDict.ContainsKey(selectedBerth.AuthorityId.Value)) + { + ParticipantAssignment pab = new() + { + ParticipantId = selectedBerth.AuthorityId.Value, + Type = (int)Extensions.ParticipantType.PORT_ADMINISTRATION + }; + this.ShipcallModel.AssignedParticipants[ParticipantType.PORT_ADMINISTRATION] = pab; + } } - if (p.Type == (int)Extensions.ParticipantType.BSMD) + + ParticipantAssignment pa = new() { - this.ShipcallModel.Shipcall.Participants.Add(p.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.BSMD] = p; - } + ParticipantId = App.Participant.Id, + Type = (int)Extensions.ParticipantType.BSMD + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.BSMD] = pa; } } } @@ -200,9 +219,9 @@ namespace BreCalClient if (this.ShipcallModel.Shipcall.Participants == null) this.ShipcallModel.Shipcall.Participants = new(); - foreach (int participant_id in this.ShipcallModel.Shipcall.Participants) + foreach (ParticipantAssignment participantAssignment in this.ShipcallModel.Shipcall.Participants) { - if (((List)this.comboBoxAgency.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxAgency.SelectedValue = participant_id; + if (((List)this.comboBoxAgency.ItemsSource).Any(x => x.Id == participantAssignment.ParticipantId)) this.comboBoxAgency.SelectedValue = participantAssignment.ParticipantId; } } } diff --git a/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs b/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs index 968923f..bc5d2ed 100644 --- a/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs +++ b/src/BreCalClient/EditTimesAgencyIncomingControl.xaml.cs @@ -98,26 +98,42 @@ namespace BreCalClient Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participant; + ParticipantAssignment participantAssignment = new() { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.MOORING + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participantAssignment; } + participant = (Participant?)this.comboBoxPilot.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participant; + ParticipantAssignment participantAssignment = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.PILOT + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participantAssignment; } participant = (Participant?)this.comboBoxTerminal.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participant; + ParticipantAssignment participantAssignment = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.TERMINAL + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participantAssignment; } participant = (Participant?)this.comboBoxTug.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participant; + ParticipantAssignment participantAssignment = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.TUG + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participantAssignment; } } } @@ -168,12 +184,12 @@ namespace BreCalClient if(!string.IsNullOrEmpty(this.Times.Remarks)) this.textBoxRemarks.Text = this.Times.Remarks; - foreach (int participant_id in this.ShipcallModel.Shipcall.Participants) + foreach (ParticipantAssignment participantAssignment in this.ShipcallModel.Shipcall.Participants) { - if (((List)this.comboBoxMooring.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxMooring.SelectedValue = participant_id; - if (((List)this.comboBoxPilot.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxPilot.SelectedValue = participant_id; - if (((List)this.comboBoxTerminal.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTerminal.SelectedValue = participant_id; - if (((List)this.comboBoxTug.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTug.SelectedValue = participant_id; + if (((List)this.comboBoxMooring.ItemsSource).Any(x => x.Id == participantAssignment.ParticipantId)) this.comboBoxMooring.SelectedValue = participantAssignment.ParticipantId; + if (((List)this.comboBoxPilot.ItemsSource).Any(x => x.Id == participantAssignment.ParticipantId)) this.comboBoxPilot.SelectedValue = participantAssignment.ParticipantId; + if (((List)this.comboBoxTerminal.ItemsSource).Any(x => x.Id == participantAssignment.ParticipantId)) this.comboBoxTerminal.SelectedValue = participantAssignment.ParticipantId; + if (((List)this.comboBoxTug.ItemsSource).Any(x => x.Id == participantAssignment.ParticipantId)) this.comboBoxTug.SelectedValue = participantAssignment.ParticipantId; } } } diff --git a/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs b/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs index 17ccaf1..66490ef 100644 --- a/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs +++ b/src/BreCalClient/EditTimesAgencyOutgoingControl.xaml.cs @@ -93,26 +93,42 @@ namespace BreCalClient Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participant; + ParticipantAssignment participantAssignment = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.MOORING + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participantAssignment; } participant = (Participant?)this.comboBoxPilot.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participant; + ParticipantAssignment participantAssignment = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.PILOT + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participantAssignment; } participant = (Participant?)this.comboBoxTerminal.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participant; + ParticipantAssignment participantAssignment = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.TERMINAL + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participantAssignment; } participant = (Participant?)this.comboBoxTug.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participant; + ParticipantAssignment participantAssignment = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.TUG + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participantAssignment; } } } @@ -158,12 +174,12 @@ namespace BreCalClient if(!string.IsNullOrEmpty(this.Times.Remarks)) this.textBoxRemarks.Text = this.Times.Remarks; - foreach (int participant_id in this.ShipcallModel.Shipcall.Participants) + foreach (ParticipantAssignment participantAssignment in this.ShipcallModel.Shipcall.Participants) { - if (((List)this.comboBoxMooring.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxMooring.SelectedValue = participant_id; - if (((List)this.comboBoxPilot.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxPilot.SelectedValue = participant_id; - if (((List)this.comboBoxTerminal.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTerminal.SelectedValue = participant_id; - if (((List)this.comboBoxTug.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTug.SelectedValue = participant_id; + if (((List)this.comboBoxMooring.ItemsSource).Any(x => x.Id == participantAssignment.ParticipantId)) this.comboBoxMooring.SelectedValue = participantAssignment.ParticipantId; + if (((List)this.comboBoxPilot.ItemsSource).Any(x => x.Id == participantAssignment.ParticipantId)) this.comboBoxPilot.SelectedValue = participantAssignment.ParticipantId; + if (((List)this.comboBoxTerminal.ItemsSource).Any(x => x.Id == participantAssignment.ParticipantId)) this.comboBoxTerminal.SelectedValue = participantAssignment.ParticipantId; + if (((List)this.comboBoxTug.ItemsSource).Any(x => x.Id == participantAssignment.ParticipantId)) this.comboBoxTug.SelectedValue = participantAssignment.ParticipantId; } } } diff --git a/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs b/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs index eaf3478..1cd91e8 100644 --- a/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs +++ b/src/BreCalClient/EditTimesAgencyShiftingControl.xaml.cs @@ -98,26 +98,42 @@ namespace BreCalClient Participant? participant = (Participant?)this.comboBoxMooring.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = participant; + ParticipantAssignment pa = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.MOORING + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.MOORING] = pa; } participant = (Participant?)this.comboBoxPilot.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = participant; + ParticipantAssignment pa = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.PILOT + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.PILOT] = pa; } participant = (Participant?)this.comboBoxTerminal.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = participant; + ParticipantAssignment pa = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.TERMINAL + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TERMINAL] = pa; } participant = (Participant?)this.comboBoxTug.SelectedItem; if (participant != null) { - this.ShipcallModel.Shipcall.Participants.Add(participant.Id); - this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = participant; + ParticipantAssignment pa = new() + { + ParticipantId = participant.Id, + Type = (int)Extensions.ParticipantType.TUG + }; + this.ShipcallModel.AssignedParticipants[Extensions.ParticipantType.TUG] = pa; } } } @@ -175,12 +191,12 @@ namespace BreCalClient if(!string.IsNullOrEmpty(this.Times.Remarks)) this.textBoxRemarks.Text = this.Times.Remarks; - foreach (int participant_id in this.ShipcallModel.Shipcall.Participants) + foreach (ParticipantAssignment participantAssignment in this.ShipcallModel.Shipcall.Participants) { - if (((List)this.comboBoxMooring.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxMooring.SelectedValue = participant_id; - if (((List)this.comboBoxPilot.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxPilot.SelectedValue = participant_id; - if (((List)this.comboBoxTerminal.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTerminal.SelectedValue = participant_id; - if (((List)this.comboBoxTug.ItemsSource).Any(x => x.Id == participant_id)) this.comboBoxTug.SelectedValue = participant_id; + if (((List)this.comboBoxMooring.ItemsSource).Any(x => x.Id == participantAssignment.ParticipantId)) this.comboBoxMooring.SelectedValue = participantAssignment.ParticipantId; + if (((List)this.comboBoxPilot.ItemsSource).Any(x => x.Id == participantAssignment.ParticipantId)) this.comboBoxPilot.SelectedValue = participantAssignment.ParticipantId; + if (((List)this.comboBoxTerminal.ItemsSource).Any(x => x.Id == participantAssignment.ParticipantId)) this.comboBoxTerminal.SelectedValue = participantAssignment.ParticipantId; + if (((List)this.comboBoxTug.ItemsSource).Any(x => x.Id == participantAssignment.ParticipantId)) this.comboBoxTug.SelectedValue = participantAssignment.ParticipantId; } } } diff --git a/src/BreCalClient/MainWindow.xaml.cs b/src/BreCalClient/MainWindow.xaml.cs index dc43dcc..97ed76c 100644 --- a/src/BreCalClient/MainWindow.xaml.cs +++ b/src/BreCalClient/MainWindow.xaml.cs @@ -172,6 +172,9 @@ namespace BreCalClient { this.UpdateUI(); + esc.ShipcallModel.Shipcall?.Participants.Clear(); + foreach (ParticipantAssignment pa in esc.ShipcallModel.AssignedParticipants.Values) + esc.ShipcallModel.Shipcall?.Participants.Add(pa); this._api.ShipcallsPost(esc.ShipcallModel.Shipcall); // save new ship call this.AddShipcall(esc.ShipcallModel); @@ -365,7 +368,7 @@ namespace BreCalClient scm.Ship = BreCalLists.ShipLookupDict[shipcall.ShipId]; if (BreCalLists.BerthLookupDict.ContainsKey(shipcall.ArrivalBerthId ?? 0)) scm.Berth = BreCalLists.BerthLookupDict[shipcall.ArrivalBerthId ?? 0].Name; - scm.AssignParticipants(BreCalLists.Participants); + scm.AssignParticipants(); this.Dispatcher.Invoke(() => { @@ -390,7 +393,7 @@ namespace BreCalClient scm.Ship = BreCalLists.ShipLookupDict[shipcall.ShipId]; if (BreCalLists.BerthLookupDict.ContainsKey(shipcall.ArrivalBerthId ?? 0)) scm.Berth = BreCalLists.BerthLookupDict[shipcall.ArrivalBerthId ?? 0].Name; - scm.AssignParticipants(BreCalLists.Participants); + scm.AssignParticipants(); } private void RemoveShipcall(int shipcallId) @@ -533,6 +536,9 @@ namespace BreCalClient { try { + obj.ShipcallControlModel.Shipcall?.Participants.Clear(); + foreach(ParticipantAssignment pa in obj.ShipcallControlModel.AssignedParticipants.Values) + obj.ShipcallControlModel.Shipcall?.Participants.Add(pa); await _api.ShipcallsPutAsync(obj.ShipcallControlModel.Shipcall); obj.RefreshData(); _refreshImmediately = true; @@ -637,6 +643,9 @@ namespace BreCalClient sc.ShipcallControlModel?.Times.Add(editControl.Times); } + editControl.ShipcallModel.Shipcall?.Participants.Clear(); + foreach (ParticipantAssignment pa in editControl.ShipcallModel.AssignedParticipants.Values) + editControl.ShipcallModel.Shipcall?.Participants.Add(pa); await _api.ShipcallsPutAsync(editControl.ShipcallModel.Shipcall); _refreshImmediately = true; _tokenSource.Cancel(); diff --git a/src/BreCalClient/ShipcallControlModel.cs b/src/BreCalClient/ShipcallControlModel.cs index 36857e3..f3148d0 100644 --- a/src/BreCalClient/ShipcallControlModel.cs +++ b/src/BreCalClient/ShipcallControlModel.cs @@ -47,7 +47,7 @@ namespace BreCalClient public string? Berth { get; set; } - internal Dictionary AssignedParticipants { get; } = new(); + internal Dictionary AssignedParticipants { get; } = new(); public List Times { get; set; } = new(); @@ -79,22 +79,14 @@ namespace BreCalClient #region public methods - public void AssignParticipants(List participants) + public void AssignParticipants() { this.AssignedParticipants.Clear(); if (Shipcall != null) { - foreach (int participantId in Shipcall.Participants) + foreach (ParticipantAssignment participantAssignment in Shipcall.Participants) { - Participant? participant = participants.Find((x) => x.Id == participantId); - if (participant != null) - { - foreach(Extensions.ParticipantType participantType in Enum.GetValues(typeof(Extensions.ParticipantType))) - { - if(participant.IsTypeFlagSet(participantType)) - AssignedParticipants[participantType] = participant; - } - } + AssignedParticipants[(Extensions.ParticipantType)participantAssignment.Type] = participantAssignment; } } } @@ -103,7 +95,7 @@ namespace BreCalClient { if (AssignedParticipants.ContainsKey(type)) { - int participantId = AssignedParticipants[type].Id; + int participantId = AssignedParticipants[type].ParticipantId; foreach (Times times in this.Times) { if ((times.ParticipantId == participantId) && (times.ParticipantType == (int) type)) @@ -145,11 +137,9 @@ namespace BreCalClient internal Participant? GetParticipantForType(Extensions.ParticipantType participantType) { - foreach(Participant p in AssignedParticipants.Values) - { - if (p.IsTypeFlagSet(participantType)) - return p; - } + if(AssignedParticipants.ContainsKey(participantType) && BreCalLists.ParticipantLookupDict.ContainsKey(AssignedParticipants[participantType].ParticipantId)) + return BreCalLists.ParticipantLookupDict[AssignedParticipants[participantType].ParticipantId]; + return null; } diff --git a/src/server/BreCal/impl/shipcalls.py b/src/server/BreCal/impl/shipcalls.py index 2bf0bae..72cbfd3 100644 --- a/src/server/BreCal/impl/shipcalls.py +++ b/src/server/BreCal/impl/shipcalls.py @@ -25,7 +25,8 @@ def GetShipcalls(options): participant_query = "SELECT participant_id, type 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): # model.Participant_Assignment = model.Participant_Assignment() - shipcall.participants.append(record["participant_id"]) + pa = model.Participant_Assignment(record["participant_id"], record["type"]) + shipcall.participants.append(pa) pooledConnection.close() @@ -93,11 +94,9 @@ def PostShipcalls(schemaModel): new_id = commands.execute_scalar("select last_insert_id()") # add participant assignments - # TODO: make sure there are not two participants of the same type - - pquery = "INSERT INTO shipcall_participant_map (shipcall_id, participant_id) VALUES (?shipcall_id?, ?participant_id?)" - for participant_id in schemaModel["participants"]: - commands.execute(pquery, param={"shipcall_id" : new_id, "participant_id" : participant_id}) + pquery = "INSERT INTO shipcall_participant_map (shipcall_id, participant_id, type) VALUES (?shipcall_id?, ?participant_id?, ?type?)" + for participant_assignment in schemaModel["participants"]: + commands.execute(pquery, param={"shipcall_id" : new_id, "participant_id" : participant_assignment["participant_id"], "type" : participant_assignment["type"]}) pooledConnection.close() @@ -154,27 +153,26 @@ def PutShipcalls(schemaModel): query += "WHERE id = ?id?" affected_rows = commands.execute(query, param=schemaModel) - pquery = "SELECT id, participant_id FROM shipcall_participant_map where shipcall_id = ?id?" + pquery = "SELECT id, participant_id, type FROM shipcall_participant_map where shipcall_id = ?id?" pdata = commands.query(pquery,param={"id" : schemaModel["id"]}) # existing list of assignments # loop across passed participant ids, creating entries for those not present in pdata - # TODO: make sure there are not two participants of the same type - for participant_id in schemaModel["participants"]: + for participant_assignment in schemaModel["participants"]: found_participant = False for elem in pdata: - if elem["participant_id"] == participant_id: + if elem["participant_id"] == participant_assignment["participant_id"] and elem["type"] == participant_assignment["type"]: found_participant = True break if not found_participant: - nquery = "INSERT INTO shipcall_participant_map (shipcall_id, participant_id) VALUES (?shipcall_id?, ?participant_id?)" - commands.execute(nquery, param={"shipcall_id" : schemaModel["id"], "participant_id" : participant_id}) + nquery = "INSERT INTO shipcall_participant_map (shipcall_id, participant_id, type) VALUES (?shipcall_id?, ?participant_id?, ?type?)" + commands.execute(nquery, param={"shipcall_id" : schemaModel["id"], "participant_id" : participant_assignment["participant_id"], "type" : participant_assignment["type"]}) # loop across existing pdata entries, deleting those not present in participant list for elem in pdata: found_participant = False - for participant_id in schemaModel["participants"]: - if(participant_id == elem["participant_id"]): + for participant_assignment in schemaModel["participants"]: + if(participant_assignment["participant_id"] == elem["participant_id"] and participant_assignment["type"] == elem["type"]): found_participant = True break; if not found_participant: diff --git a/src/server/BreCal/schemas/model.py b/src/server/BreCal/schemas/model.py index 0d70a87..a022a17 100644 --- a/src/server/BreCal/schemas/model.py +++ b/src/server/BreCal/schemas/model.py @@ -59,6 +59,10 @@ class Participant(Schema): class ParticipantList(Participant): pass +class ParticipantAssignmentSchema(Schema): + participant_id = fields.Int() + type = fields.Int() + class ShipcallSchema(Schema): def __init__(self): super().__init__(unknown=None) @@ -89,12 +93,17 @@ class ShipcallSchema(Schema): canceled = fields.Bool(Required = False, allow_none=True) evaluation = fields.Int(Required = False, allow_none=True) evaluation_message = fields.Str(Required = False, allow_none=True) - participants = fields.List(fields.Int) + participants = fields.List(fields.Nested(ParticipantAssignmentSchema)) created = fields.DateTime(Required = False, allow_none=True) modified = fields.DateTime(Required = False, allow_none=True) @dataclass class Participant_Assignment: + def __init__(self, participant_id, type): + self.participant_id = participant_id + self.type = type + pass + participant_id: int type: int