From 585c5c8537eb21dfc9f16108548e63d9ced3d971 Mon Sep 17 00:00:00 2001 From: ivarlovlie Date: Mon, 24 Oct 2022 12:29:23 +0800 Subject: feat: Before move to FastEndpoints --- code/api/src/Data/Dtos/UserArchiveDto.cs | 131 ------------------------------- 1 file changed, 131 deletions(-) delete mode 100644 code/api/src/Data/Dtos/UserArchiveDto.cs (limited to 'code/api/src/Data/Dtos/UserArchiveDto.cs') diff --git a/code/api/src/Data/Dtos/UserArchiveDto.cs b/code/api/src/Data/Dtos/UserArchiveDto.cs deleted file mode 100644 index 42e0600..0000000 --- a/code/api/src/Data/Dtos/UserArchiveDto.cs +++ /dev/null @@ -1,131 +0,0 @@ - -namespace IOL.GreatOffice.Api.Data.Dtos; - -/// -/// Represents a user archive as it is provided to users. -/// -public class UserArchiveDto -{ - /// - public UserArchiveDto(User user) { - Meta = new MetaDto { - GeneratedAt = AppDateTime.UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ") - }; - User = new UserDto(user); - Entries = new List(); - } - - /// - /// Metadata for the user archive. - /// - public MetaDto Meta { get; } - - /// - /// Relevant user data for the archive. - /// - public UserDto User { get; } - - /// - /// List of entries that the user has created. - /// - public List Entries { get; } - - public void CountEntries() { - Meta.EntryCount = Entries.Count; - } - - /// - /// Represents a time entry in the data archive. - /// - public class EntryDto - { - public string CreatedAt { get; init; } - - [JsonIgnore] - public DateTime StartDateTime { get; init; } - - /// - /// ISO 8601 string of the UTC date the time entry started. - /// - public string Start => StartDateTime.ToString("yyyy-MM-ddTHH:mm:ssZ"); - - [JsonIgnore] - public DateTime StopDateTime { get; init; } - - /// - /// ISO 8601 string of the UTC date the time entry stopped. - /// - public string Stop => StopDateTime.ToString("yyyy-MM-ddTHH:mm:ssZ"); - - /// - /// Total amount of minutes elapsed from start to stop on this time entry. - /// - public double Minutes => StopDateTime.Subtract(StartDateTime).TotalMinutes; - - public string Description { get; init; } - - /// - /// Archive spesific category for this time entry. - /// - public CategoryDto Category { get; init; } - - /// - /// Archive spesific list of labels for this time entry. - /// - public List Labels { get; init; } - } - - /// - /// Time entry category as it is written to the user archive. - /// - public class CategoryDto - { - public string Name { get; init; } - public string Color { get; init; } - } - - /// - /// Time entry label as it is written to the user archive. - /// - public class LabelDto - { - public string Name { get; init; } - public string Color { get; init; } - } - - - /// - /// Represents the user who this archive's data is based on. - /// - public class UserDto - { - /// - public UserDto(User user) { - Username = user.Username; - CreatedAt = user.CreatedAt; - } - - /// - /// UTC date this user was created. - /// - public DateTime CreatedAt { get; } - - public string Username { get; } - } - - /// - /// Represents the meta object which contains metdata for this archive. - /// - public class MetaDto - { - /// - /// ISO 8601 UTC date string for when this archive was created. - /// - public string GeneratedAt { get; init; } - - /// - /// Amount of entries in the archive. - /// - public int EntryCount { get; set; } - } -} -- cgit v1.3