From 7d869c64df1a298b08f61eefe5be4bf9472de8f8 Mon Sep 17 00:00:00 2001 From: RudiThoeni Date: Tue, 17 Dec 2024 15:20:20 +0100 Subject: [PATCH 1/3] showing accommodation post in swagger --- OdhApiCore/Controllers/api/AccommodationApiController.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OdhApiCore/Controllers/api/AccommodationApiController.cs b/OdhApiCore/Controllers/api/AccommodationApiController.cs index 1b7eb9d2..3339f724 100644 --- a/OdhApiCore/Controllers/api/AccommodationApiController.cs +++ b/OdhApiCore/Controllers/api/AccommodationApiController.cs @@ -962,7 +962,7 @@ private IActionResult GetFeatureListXML(CancellationToken cancellationToken) /// /// Accommodation Object /// Http Response - [ApiExplorerSettings(IgnoreApi = true)] + //[ApiExplorerSettings(IgnoreApi = true)] [InvalidateCacheOutput(typeof(AccommodationController), nameof(GetAccommodations))] //[Authorize(Roles = "DataWriter,DataCreate,AccoManager,AccoCreate,AccommodationWriter,AccommodationManager,AccommodationCreate")] [AuthorizeODH(PermissionAction.Create)] @@ -995,7 +995,7 @@ public Task Post([FromBody] AccommodationV2 accommodation) /// Accommodation Id /// Accommodation Object /// Http Response - [ApiExplorerSettings(IgnoreApi = true)] + //[ApiExplorerSettings(IgnoreApi = true)] [InvalidateCacheOutput(typeof(AccommodationController), nameof(GetAccommodations))] [AuthorizeODH(PermissionAction.Update)] //[Authorize(Roles = "DataWriter,DataModify,AccoManager,AccoModify,AccommodationWriter,AccommodationManager,AccommodationModify,AccommodationUpdate")] From 25a2d439f28f6a5c8ffc4459c329f06d5ced0ac7 Mon Sep 17 00:00:00 2001 From: RudiThoeni Date: Tue, 17 Dec 2024 15:32:14 +0100 Subject: [PATCH 2/3] adding nullable accommodation categories --- DataModel/datamodels/DataModelsLinked.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/DataModel/datamodels/DataModelsLinked.cs b/DataModel/datamodels/DataModelsLinked.cs index 2578a7fe..05d82aa7 100644 --- a/DataModel/datamodels/DataModelsLinked.cs +++ b/DataModel/datamodels/DataModelsLinked.cs @@ -399,7 +399,7 @@ public ICollection ODHTags } [SwaggerSchema(Description = "generated field", ReadOnly = true)] - public AccoType AccoType + public AccoType? AccoType { get { @@ -408,7 +408,7 @@ public AccoType AccoType } [SwaggerSchema(Description = "generated field", ReadOnly = true)] - public AccoCategory AccoCategory + public AccoCategory? AccoCategory { get { From 12a66d370cd2098042e781d049ed204a7641f39a Mon Sep 17 00:00:00 2001 From: RudiThoeni Date: Tue, 17 Dec 2024 16:15:15 +0100 Subject: [PATCH 3/3] Datamodel changes --- DataModel/datamodels/DataModels.cs | 2 +- DataModel/datamodels/DataModelsLinked.cs | 2 +- DataModel/datamodels/DataModelsV2.cs | 4 ++-- Helper/Generic/MetaInfoHelper.cs | 15 ++++++++++++++- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/DataModel/datamodels/DataModels.cs b/DataModel/datamodels/DataModels.cs index fdc23b66..faadcc16 100644 --- a/DataModel/datamodels/DataModels.cs +++ b/DataModel/datamodels/DataModels.cs @@ -483,7 +483,7 @@ public Accommodation() public bool? IsCamping { get; set; } public bool? IsGastronomy { get; set; } - public bool? IsBookable { get; set; } + public bool IsBookable { get; set; } public bool? IsAccommodation { get; set; } [SwaggerDeprecated("Obsolete, use PublishedOn")] public bool SmgActive { get; set; } diff --git a/DataModel/datamodels/DataModelsLinked.cs b/DataModel/datamodels/DataModelsLinked.cs index 05d82aa7..77d7f3ea 100644 --- a/DataModel/datamodels/DataModelsLinked.cs +++ b/DataModel/datamodels/DataModelsLinked.cs @@ -767,7 +767,7 @@ public ICollection? Areas //Overwrites LTSTags public new List? LTSTags { get; set; } - public ICollection TagIds { get; set; } + public ICollection? TagIds { get; set; } } public class LTSPoiLinked : PoiBaseInfos, IMetaData, IGPSInfoAware, IGPSPointsAware, IHasLocationInfoLinked diff --git a/DataModel/datamodels/DataModelsV2.cs b/DataModel/datamodels/DataModelsV2.cs index 9d4ac675..6b9d4c58 100644 --- a/DataModel/datamodels/DataModelsV2.cs +++ b/DataModel/datamodels/DataModelsV2.cs @@ -321,7 +321,7 @@ public class AccommodationV2 : AccommodationLinked, IHasTagInfo //Accommodation Properties [SwaggerDeprecated("Deprecated, use AccoProperties.HasApartment")] - public new bool? HasApartment { get { return this.AccoProperties != null ? this.AccoProperties.HasApartment : null; } } + public new bool HasApartment { get { return this.AccoProperties != null ? this.AccoProperties.HasApartment.Value : false; } } [SwaggerDeprecated("Deprecated, use AccoProperties.HasRoom")] public new bool? HasRoom { get { return this.AccoProperties != null ? this.AccoProperties.HasRoom : null; } } @@ -333,7 +333,7 @@ public class AccommodationV2 : AccommodationLinked, IHasTagInfo public bool? IsGastronomy { get { return this.AccoProperties != null ? this.AccoProperties.IsGastronomy : null; } } [SwaggerDeprecated("Deprecated, use AccoProperties.IsBookable")] - public new bool? IsBookable { get { return this.AccoProperties != null ? this.AccoProperties.IsBookable : null; } } + public new bool IsBookable { get { return this.AccoProperties != null ? this.AccoProperties.IsBookable.Value : false; } } [SwaggerDeprecated("Deprecated, use AccoProperties.IsAccommodation")] public new bool? IsAccommodation { get { return this.AccoProperties != null ? this.AccoProperties.IsAccommodation : null; } } diff --git a/Helper/Generic/MetaInfoHelper.cs b/Helper/Generic/MetaInfoHelper.cs index bb1ca945..b6f5c386 100644 --- a/Helper/Generic/MetaInfoHelper.cs +++ b/Helper/Generic/MetaInfoHelper.cs @@ -88,7 +88,20 @@ public static Metadata GetMetadataforAccommodation(AccommodationV2 data) if (data._Meta != null) reduced = (bool)data._Meta.Reduced; - return GetMetadata(data, "lts", data.LastChange, reduced); + //fix if source is null + string? datasource = data.Source; + + if (datasource == null) + { + datasource = "unknown"; + } + else + { + datasource = datasource.ToLower(); + } + + + return GetMetadata(data, datasource, data.LastChange, reduced); } public static Metadata GetMetadataforAccommodationRoom(AccommodationRoomLinked data)