Navigation Menu

Skip to content

Commit

Permalink
API - subs - add additional authors and publication id, pubs - add ad…
Browse files Browse the repository at this point in the history
…ditional authors
  • Loading branch information
adelikat committed Jul 6, 2022
1 parent cd0a29c commit caf16bd
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
9 changes: 7 additions & 2 deletions TASVideos.Api/Extensions/EntityExtensions.cs
Expand Up @@ -47,6 +47,7 @@ public static IQueryable<PublicationsResponse> ToPublicationsResponse(this IQuer
RerecordCount = p.RerecordCount,
SystemFrameRate = p.SystemFrameRate!.FrameRate,
MovieFileName = p.MovieFileName,
AdditionalAuthors = p.AdditionalAuthors,
Authors = p.Authors
.OrderBy(pa => pa.Ordinal)
.Select(a => a.Author!.UserName),
Expand All @@ -66,6 +67,9 @@ public static IQueryable<SubmissionsResponse> ToSubmissionsResponse(this IQuerya
return query.Select(s => new SubmissionsResponse
{
Id = s.Id,
PublicationId = s.Publication != null
? s.Publication.Id
: null,
Title = s.Title,
IntendedClass = s.IntendedClass != null
? s.IntendedClass.Name
Expand Down Expand Up @@ -100,8 +104,9 @@ public static IQueryable<SubmissionsResponse> ToSubmissionsResponse(this IQuerya
EmulatorVersion = s.EmulatorVersion,
MovieStartType = s.MovieStartType,
Authors = s.SubmissionAuthors
.OrderBy(s => s.Ordinal)
.Select(a => a.Author!.UserName)
.OrderBy(a => a.Ordinal)
.Select(a => a.Author!.UserName),
AdditionalAuthors = s.AdditionalAuthors
});
}
}
3 changes: 3 additions & 0 deletions TASVideos.Api/Responses/PublicationsResponse.cs
Expand Up @@ -50,6 +50,9 @@ public class PublicationsResponse
[Sortable]
public string MovieFileName { get; init; } = "";

[Sortable]
public string? AdditionalAuthors { get; init; }

public IEnumerable<string> Authors { get; init; } = Array.Empty<string>();
public IEnumerable<string> Tags { get; init; } = Array.Empty<string>();
public IEnumerable<string> Flags { get; init; } = Array.Empty<string>();
Expand Down
6 changes: 6 additions & 0 deletions TASVideos.Api/Responses/SubmissionsResponse.cs
Expand Up @@ -9,6 +9,9 @@ public class SubmissionsResponse
[Sortable]
public int Id { get; init; }

[Sortable]
public int? PublicationId { get; init; }

[Sortable]
public string Title { get; init; } = "";

Expand Down Expand Up @@ -66,5 +69,8 @@ public class SubmissionsResponse
[Sortable]
public int? MovieStartType { get; init; }

[Sortable]
public string? AdditionalAuthors { get; init; }

public IEnumerable<string> Authors { get; init; } = new List<string>();
}

0 comments on commit caf16bd

Please sign in to comment.