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
{
public int LibraryId { get; set; }
public LibraryType LibraryType { get; set; }
public DateTime Created { get; set; }
public int SeriesId { get; set; }
public string SeriesName { get; set; }
public Series Series { get; set; }
public IList<Chapter> Chapters { get; set; } // I don't know if I need this
public Chapter Chapter { get; set; } // for Alt implementation
public MangaFormat Format { get; set; }
public int ChapterId { get; set; } // for Alt implementation
public int VolumeId { get; set; } // for Alt implementation
public string ChapterNumber { get; set; }
public string ChapterRange { get; set; }
public string ChapterTitle { get; set; }
public bool IsSpecial { get; set; }
public int VolumeNumber { get; set; }
public int LibraryId { get; init; }
public LibraryType LibraryType { get; init; }
public DateTime Created { get; init; }
public int SeriesId { get; init; }
public string SeriesName { get; init; }
public MangaFormat Format { get; init; }
public int ChapterId { get; init; }
public int VolumeId { get; init; }
public string ChapterNumber { get; init; }
public string ChapterRange { get; init; }
public string ChapterTitle { get; init; }
public bool IsSpecial { get; init; }
public int VolumeNumber { get; init; }
}
public interface ISeriesRepository
@ -950,7 +947,7 @@ public class SeriesRepository : ISeriesRepository
/// <returns></returns>
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>();
@ -981,7 +978,7 @@ public class SeriesRepository : ISeriesRepository
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
.Where(u => u.Id == userId)
@ -1004,7 +1001,6 @@ public class SeriesRepository : ISeriesRepository
Created = c.Created,
SeriesId = c.Volume.Series.Id,
SeriesName = c.Volume.Series.Name,
Series = c.Volume.Series,
VolumeId = c.VolumeId,
ChapterId = c.Id,
Format = c.Volume.Series.Format,
@ -1014,7 +1010,7 @@ public class SeriesRepository : ISeriesRepository
VolumeNumber = c.Volume.Number,
ChapterTitle = c.Title
})
.Take(50)
.Take(maxRecords)
.Where(c => c.Created >= withinLastWeek && libraryIds.Contains(c.LibraryId))
.ToListAsync();
return ret;

View File

@ -47,8 +47,10 @@ export class AddEmailToAccountMigrationModalComponent implements OnInit {
// Display the email to the user
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>');
this.modal.close(true);
} else {
await this.confirmService.alert('Please check your email for the confirmation link. You must confirm to be able to login.');
this.modal.close(true);
}
});
});