Skip to content

Commit

Permalink
Version 8 1 contracts (#11)
Browse files Browse the repository at this point in the history
* Created PersonChangeDelta entity

* Added Key attribute to Id property of Game entity

* Made PersonId property non-mandatory in the Person entity

* Code tidy up

Co-authored-by: Rajeev Shenoy <itft.github@itftennis.com>
  • Loading branch information
itftennis and Rajeev Shenoy committed Sep 9, 2021
1 parent 55c45c5 commit b834672
Show file tree
Hide file tree
Showing 8 changed files with 114 additions and 19 deletions.
13 changes: 7 additions & 6 deletions src/Tennis-Open-Data-Standards/Court.cs
Expand Up @@ -11,8 +11,9 @@ public class Courts
[XmlElement(IsNullable = false)]
public Collection<Court> Court { get; set; }
}

public class Court : CommonElements
{
{
/// <summary>
/// CourtId
/// </summary>
Expand All @@ -21,8 +22,8 @@ public class Court : CommonElements
/// Please see the <see href="https://itftennis.atlassian.net/wiki/spaces/TODS/pages/1273102565/Including+Multiple+Identifiers">How to Include multiple Identifiers</see>
/// </remarks>

//XML minOccurs=1 to 1
[XmlElement(IsNullable = true)]
//XML minOccurs=1 to 1
[XmlElement(IsNullable = true)]
[JsonProperty(Required = Required.Always)]
public string CourtId { get; set; }
/// <summary>
Expand Down Expand Up @@ -82,7 +83,7 @@ public class Court : CommonElements
/// </remarks>

//XML minOccurs=0 to 1
public DateTime? SurfacedDate { get; set; }
}
public DateTime? SurfacedDate { get; set; }

}
}
6 changes: 6 additions & 0 deletions src/Tennis-Open-Data-Standards/Game.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.ObjectModel;
using System.ComponentModel.DataAnnotations;
using System.Xml.Serialization;
using Newtonsoft.Json;
using Tennis_Open_Data_Standards.Attributes;
Expand All @@ -15,6 +16,11 @@ public class Games
}
public class Game : CommonElements
{
[Key]
public Guid Id { get; set; }
public string GameId { get; set; }
public CommonElements CommonElements { get; set; }

[JsonProperty(Required = Required.Always)]
public int GameNumber { get; set; }
//XML minOccurs=0 to 1
Expand Down
7 changes: 0 additions & 7 deletions src/Tennis-Open-Data-Standards/Person.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
using Newtonsoft.Json;
using Tennis_Open_Data_Standards.Attributes;

namespace Tennis_Open_Data_Standards
Expand All @@ -27,13 +26,7 @@ public class Person : CommonElements
/// <remarks>
/// Please see the <see href="https://itftennis.atlassian.net/wiki/spaces/TODS/pages/1273102565/Including+Multiple+Identifiers">How to Include multiple Identifiers</see>
/// </remarks>

//XML minOccurs=1 to 1
[XmlElement(IsNullable = true)]
[JsonProperty(Required = Required.Always)]
public string PersonId { get; set; }
//[JsonProperty(Required = Required.Always)] ITF requirement and not TODS
// Validation ?
/// <summary>
/// Tennis Identifier
/// </summary>
Expand Down
87 changes: 87 additions & 0 deletions src/Tennis-Open-Data-Standards/PersonChangeDelta.cs
@@ -0,0 +1,87 @@
using System;
using System.Collections.ObjectModel;
using System.Xml.Serialization;
using Tennis_Open_Data_Standards.Attributes;

namespace Tennis_Open_Data_Standards
{
[NoUnboundCustom]
[XmlRoot("Upserted"), XmlType(TypeName = "Upserted")]
public class Upserted
{
[XmlElement(IsNullable = false)]
public Collection<UpsertedItem> UpsertedItems { get; set; }
}
public class UpsertedItem
{
public string OrganisationID { get; set; }
public string ClientID { get; set; }
public DateTime DateTime { get; set; }
public Collection<Person> Person { get; set; }
}

[NoUnboundCustom]
[XmlRoot("Deleted"), XmlType(TypeName = "Deleted")]
public class Deleted
{
[XmlElement(IsNullable = false)]
public Collection<DeletedItem> DeletedItems { get; set; }
}
public class DeletedItem
{
public string OrganisationID { get; set; }
public string ClientID { get; set; }
public DateTime DateTime { get; set; }
public string TennisId { get; set; }
}


[NoUnboundCustom]
[XmlRoot("Merged"), XmlType(TypeName = "Merged")]
public class Merged
{
[XmlElement(IsNullable = false)]
public Collection<MergedItem> MergedItems { get; set; }
}
public class MergedItem
{
public string OrganisationID { get; set; }
public string ClientID { get; set; }
public DateTime DateTime { get; set; }
public string KeeperTennisId { get; set; }
public string RemoverTennisId { get; set; }
}



public class PersonChangeDelta
{
/// <summary>
/// Upserted
/// </summary>
/// <remarks>
/// Please see <see cref="Upserted">Upserted</see>
/// </remarks>
[NoUnboundCustom]
[XmlElement("Upserted", typeof(Upserted))]
public Collection<Upserted> Upserted { get; set; }
/// <summary>
/// Deleted
/// </summary>
/// <remarks>
/// Please see <see cref="Deleted">Deleted</see>
/// </remarks>
[NoUnboundCustom]
[XmlElement("Deleted", typeof(Deleted))]
public Collection<Deleted> Deleted { get; set; }
/// <summary>
/// Merged
/// </summary>
/// <remarks>
/// Please see <see cref="Merged">Merged</see>
/// </remarks>
[NoUnboundCustom]
[XmlElement("Merged", typeof(Merged))]
public Collection<Merged> Merged { get; set; }
}
}
1 change: 0 additions & 1 deletion src/Tennis-Open-Data-Standards/Shot.cs
Expand Up @@ -20,7 +20,6 @@ public class Shots
/// </remarks>
public class Shot
{

/// <summary>
/// Number
/// </summary>
Expand Down
Expand Up @@ -3,9 +3,9 @@
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RootNamespace>Tennis_Open_Data_Standards</RootNamespace>
<PackageVersion>0.8.0</PackageVersion>
<InformationalVersion>0.8.0</InformationalVersion>
<AssemblyVersion>0.8.0.0</AssemblyVersion>
<PackageVersion>0.8.1</PackageVersion>
<InformationalVersion>0.8.1</InformationalVersion>
<AssemblyVersion>0.8.1.0</AssemblyVersion>
<Copyright>ITF Tennis - MIT License</Copyright>
</PropertyGroup>

Expand Down
11 changes: 10 additions & 1 deletion src/Tennis-Open-Data-Standards/Tennis.cs
Expand Up @@ -14,7 +14,7 @@ namespace Tennis_Open_Data_Standards
/// <remarks>
/// This is a root element and holds all the collections
/// </remarks>
[Tods(Version = "0.0.8")]
[Tods(Version = "0.0.8.1")]
public class Tennis : ITennis
{
/// <summary>
Expand Down Expand Up @@ -154,6 +154,15 @@ public class Tennis : ITennis
[NoUnboundCustom]
[XmlElement("WorldTennisNumbers", typeof(WorldTennisNumbers))]
public Collection<WorldTennisNumber> WorldTennisNumbers { get; set; }
/// <summary>
/// PersonChangeDelta
/// </summary>
/// <remarks>
/// Please see <see cref="PersonChangeDelta">PersonChangeDelta</see>
/// </remarks>
[NoUnboundCustom]
[XmlElement("PersonChangeDelta", typeof(PersonChangeDelta))]
public Collection<PersonChangeDelta> PersonChangeDelta { get; set; }

}
}
2 changes: 1 addition & 1 deletion src/Tennis-Open-Data-Standards/WorldTennisNumber.cs
Expand Up @@ -35,7 +35,7 @@ public class WorldTennisNumber : CommonElements

//XML minOccurs=1 to 1
public DateTime RatingDate { get; set; }

//XML minOccurs=0 to 1
[NoUnboundCustom]
[XmlElement("MatchUps", typeof(MatchUps))]
Expand Down

0 comments on commit b834672

Please sign in to comment.