reformatted models

This commit is contained in:
2023-01-04 17:22:36 -07:00
parent c8175971b7
commit c28230691e
122 changed files with 3812 additions and 4005 deletions

View File

@@ -2,39 +2,40 @@ using System;
using System.Collections.Generic;
namespace Model.Analytics {
// The format of this model in the documentation is COMPLETELY WRONG. Each property is an array of objects, not an object,
// and each of those objects have some extra fields: {id, date, views, participations} in by_date and
// {id, category, views} in by_category. In both cases, id seems to be null 100% of the time, so I am omitting that one.
// The primary keys (date and category) are thankfully discrete, so we can trivially build the dictionary ourselves.
public class DepartmentParticipationModel {
namespace CanvasModel.Analytics;
// The format of this model in the documentation is COMPLETELY WRONG. Each property is an array of objects, not an object,
// and each of those objects have some extra fields: {id, date, views, participations} in by_date and
// {id, category, views} in by_category. In both cases, id seems to be null 100% of the time, so I am omitting that one.
// The primary keys (date and category) are thankfully discrete, so we can trivially build the dictionary ourselves.
public class DepartmentParticipationModel
{
[JsonPropertyName("by_date")]
public IEnumerable<DepartmentParticipationDateEntryModel> ByDate { get; set; }
[JsonPropertyName("by_date")]
public IEnumerable<DepartmentParticipationDateEntryModel> ByDate { get; set; }
[JsonPropertyName("by_category")]
public IEnumerable<DepartmentParticipationCategoryEntryModel> ByCategory { get; set; }
}
public class DepartmentParticipationDateEntryModel {
[JsonPropertyName("date")]
public DateTime Date { get; set; }
[JsonPropertyName("views")]
public ulong Views { get; set; }
[JsonPropertyName("participations")]
public ulong Participations { get; set; }
}
public class DepartmentParticipationCategoryEntryModel {
[JsonPropertyName("category")]
public string Category { get; set; }
[JsonPropertyName("views")]
public ulong Views { get; set; }
}
[JsonPropertyName("by_category")]
public IEnumerable<DepartmentParticipationCategoryEntryModel> ByCategory { get; set; }
}
public class DepartmentParticipationDateEntryModel
{
[JsonPropertyName("date")]
public DateTime Date { get; set; }
[JsonPropertyName("views")]
public ulong Views { get; set; }
[JsonPropertyName("participations")]
public ulong Participations { get; set; }
}
public class DepartmentParticipationCategoryEntryModel
{
[JsonPropertyName("category")]
public string Category { get; set; }
[JsonPropertyName("views")]
public ulong Views { get; set; }
}