Skip to content

Commit

Permalink
Merge pull request #483 from noi-techpark/main
Browse files Browse the repository at this point in the history
dev model changes
  • Loading branch information
RudiThoeni authored Dec 17, 2024
2 parents 073f384 + 12a66d3 commit 8ee607f
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 9 deletions.
2 changes: 1 addition & 1 deletion DataModel/datamodels/DataModels.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
6 changes: 3 additions & 3 deletions DataModel/datamodels/DataModelsLinked.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ public ICollection<ODHTags> ODHTags
}

[SwaggerSchema(Description = "generated field", ReadOnly = true)]
public AccoType AccoType
public AccoType? AccoType
{
get
{
Expand All @@ -408,7 +408,7 @@ public AccoType AccoType
}

[SwaggerSchema(Description = "generated field", ReadOnly = true)]
public AccoCategory AccoCategory
public AccoCategory? AccoCategory
{
get
{
Expand Down Expand Up @@ -767,7 +767,7 @@ public ICollection<AreaLink>? Areas

//Overwrites LTSTags
public new List<LTSTagsLinked>? LTSTags { get; set; }
public ICollection<string> TagIds { get; set; }
public ICollection<string>? TagIds { get; set; }
}

public class LTSPoiLinked : PoiBaseInfos, IMetaData, IGPSInfoAware, IGPSPointsAware, IHasLocationInfoLinked
Expand Down
4 changes: 2 additions & 2 deletions DataModel/datamodels/DataModelsV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; } }
Expand All @@ -333,7 +333,7 @@ public class AccommodationV2 : AccommodationLinked, IHasTagInfo
public bool? IsGastronomy { get { return this.AccoProperties != null ? this.AccoProperties.IsGastronomy : null; } }

Check warning on line 333 in DataModel/datamodels/DataModelsV2.cs

View workflow job for this annotation

GitHub Actions / test

'AccommodationV2.IsGastronomy' hides inherited member 'Accommodation.IsGastronomy'. Use the new keyword if hiding was intended.

[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; } }
Expand Down
15 changes: 14 additions & 1 deletion Helper/Generic/MetaInfoHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions OdhApiCore/Controllers/api/AccommodationApiController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ private IActionResult GetFeatureListXML(CancellationToken cancellationToken)
/// </summary>
/// <param name="accommodation">Accommodation Object</param>
/// <returns>Http Response</returns>
[ApiExplorerSettings(IgnoreApi = true)]
//[ApiExplorerSettings(IgnoreApi = true)]
[InvalidateCacheOutput(typeof(AccommodationController), nameof(GetAccommodations))]
//[Authorize(Roles = "DataWriter,DataCreate,AccoManager,AccoCreate,AccommodationWriter,AccommodationManager,AccommodationCreate")]
[AuthorizeODH(PermissionAction.Create)]
Expand Down Expand Up @@ -995,7 +995,7 @@ public Task<IActionResult> Post([FromBody] AccommodationV2 accommodation)
/// <param name="id">Accommodation Id</param>
/// <param name="accommodation">Accommodation Object</param>
/// <returns>Http Response</returns>
[ApiExplorerSettings(IgnoreApi = true)]
//[ApiExplorerSettings(IgnoreApi = true)]
[InvalidateCacheOutput(typeof(AccommodationController), nameof(GetAccommodations))]
[AuthorizeODH(PermissionAction.Update)]
//[Authorize(Roles = "DataWriter,DataModify,AccoManager,AccoModify,AccommodationWriter,AccommodationManager,AccommodationModify,AccommodationUpdate")]
Expand Down

0 comments on commit 8ee607f

Please sign in to comment.