Fixed dockerfiles and fixed chapter upserts
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -19,24 +19,27 @@ public class NovelRepository : BaseRepository<Novel>, INovelRepository
|
||||
|
||||
public override async Task<Novel> Upsert(Novel entity, bool saveAfter=true)
|
||||
{
|
||||
var dbEntity = await GetIncluded(entity) ?? entity;
|
||||
// Author
|
||||
if (entity.Author != null)
|
||||
{
|
||||
entity.Author = await _authorRepository.Upsert(entity.Author, saveAfter);
|
||||
entity.Author = await _authorRepository.Upsert(entity.Author, false);
|
||||
}
|
||||
|
||||
//Tags
|
||||
var newTags = await _tagRepository.UpsertMany(entity.Tags, false);
|
||||
entity.Tags.Clear();
|
||||
entity.Tags = newTags.ToList();
|
||||
//chapters
|
||||
|
||||
//chapters are getting deleted now that their required...
|
||||
var newChapters = await _chapterRepository.UpsertMany(entity.Chapters, false);
|
||||
entity.Chapters.Clear();
|
||||
entity.Chapters = newChapters.ToList();
|
||||
|
||||
// update in db
|
||||
var dbEntity = await GetIncluded(entity) ?? entity;
|
||||
entity.Guid = dbEntity.Guid;
|
||||
DbContext.Entry(dbEntity).CurrentValues.SetValues(entity);
|
||||
dbEntity.Tags.Clear();
|
||||
dbEntity.Tags.AddRange(newTags);
|
||||
dbEntity.Chapters.Clear();
|
||||
dbEntity.Chapters.AddRange(newChapters);
|
||||
|
||||
if (DbContext.Entry(dbEntity).State == EntityState.Detached)
|
||||
{
|
||||
dbEntity.Guid = Guid.NewGuid();
|
||||
|
||||
Reference in New Issue
Block a user