More Cleanup (#1033)

* Tweaked the backend for recently updated series to allow for 100 more items to be calculated against.

Close the account migration screen after migration email is sent.

* Cleaned up some code
This commit is contained in:
Joseph Milazzo 2022-02-04 15:00:49 -08:00 committed by GitHub
parent 10984278f3
commit 7fab1cc30d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 20 deletions

View File

@ -25,22 +25,19 @@ namespace API.Data.Repositories;
internal class RecentlyAddedSeries internal class RecentlyAddedSeries
{ {
public int LibraryId { get; set; } public int LibraryId { get; init; }
public LibraryType LibraryType { get; set; } public LibraryType LibraryType { get; init; }
public DateTime Created { get; set; } public DateTime Created { get; init; }
public int SeriesId { get; set; } public int SeriesId { get; init; }
public string SeriesName { get; set; } public string SeriesName { get; init; }
public Series Series { get; set; } public MangaFormat Format { get; init; }
public IList<Chapter> Chapters { get; set; } // I don't know if I need this public int ChapterId { get; init; }
public Chapter Chapter { get; set; } // for Alt implementation public int VolumeId { get; init; }
public MangaFormat Format { get; set; } public string ChapterNumber { get; init; }
public int ChapterId { get; set; } // for Alt implementation public string ChapterRange { get; init; }
public int VolumeId { get; set; } // for Alt implementation public string ChapterTitle { get; init; }
public string ChapterNumber { get; set; } public bool IsSpecial { get; init; }
public string ChapterRange { get; set; } public int VolumeNumber { get; init; }
public string ChapterTitle { get; set; }
public bool IsSpecial { get; set; }
public int VolumeNumber { get; set; }
} }
public interface ISeriesRepository public interface ISeriesRepository
@ -950,7 +947,7 @@ public class SeriesRepository : ISeriesRepository
/// <returns></returns> /// <returns></returns>
public async Task<IList<GroupedSeriesDto>> GetRecentlyUpdatedSeries(int userId) public async Task<IList<GroupedSeriesDto>> GetRecentlyUpdatedSeries(int userId)
{ {
var ret = await GetRecentlyAddedChaptersQuery(userId); var ret = await GetRecentlyAddedChaptersQuery(userId, 150);
var seriesMap = new Dictionary<string, GroupedSeriesDto>(); var seriesMap = new Dictionary<string, GroupedSeriesDto>();
@ -981,7 +978,7 @@ public class SeriesRepository : ISeriesRepository
return seriesMap.Values.ToList(); return seriesMap.Values.ToList();
} }
private async Task<List<RecentlyAddedSeries>> GetRecentlyAddedChaptersQuery(int userId) private async Task<List<RecentlyAddedSeries>> GetRecentlyAddedChaptersQuery(int userId, int maxRecords = 50)
{ {
var libraries = await _context.AppUser var libraries = await _context.AppUser
.Where(u => u.Id == userId) .Where(u => u.Id == userId)
@ -1004,7 +1001,6 @@ public class SeriesRepository : ISeriesRepository
Created = c.Created, Created = c.Created,
SeriesId = c.Volume.Series.Id, SeriesId = c.Volume.Series.Id,
SeriesName = c.Volume.Series.Name, SeriesName = c.Volume.Series.Name,
Series = c.Volume.Series,
VolumeId = c.VolumeId, VolumeId = c.VolumeId,
ChapterId = c.Id, ChapterId = c.Id,
Format = c.Volume.Series.Format, Format = c.Volume.Series.Format,
@ -1014,7 +1010,7 @@ public class SeriesRepository : ISeriesRepository
VolumeNumber = c.Volume.Number, VolumeNumber = c.Volume.Number,
ChapterTitle = c.Title ChapterTitle = c.Title
}) })
.Take(50) .Take(maxRecords)
.Where(c => c.Created >= withinLastWeek && libraryIds.Contains(c.LibraryId)) .Where(c => c.Created >= withinLastWeek && libraryIds.Contains(c.LibraryId))
.ToListAsync(); .ToListAsync();
return ret; return ret;

View File

@ -47,8 +47,10 @@ export class AddEmailToAccountMigrationModalComponent implements OnInit {
// Display the email to the user // Display the email to the user
this.emailLink = email; this.emailLink = email;
await this.confirmService.alert('Please click this link to confirm your email. You must confirm to be able to login. You may need to log out of the current account before clicking. <br/> <a href="' + this.emailLink + '" target="_blank">' + this.emailLink + '</a>'); await this.confirmService.alert('Please click this link to confirm your email. You must confirm to be able to login. You may need to log out of the current account before clicking. <br/> <a href="' + this.emailLink + '" target="_blank">' + this.emailLink + '</a>');
this.modal.close(true);
} else { } else {
await this.confirmService.alert('Please check your email for the confirmation link. You must confirm to be able to login.'); await this.confirmService.alert('Please check your email for the confirmation link. You must confirm to be able to login.');
this.modal.close(true);
} }
}); });
}); });