Skip to content

Commit

Permalink
[#18] update sample data creation with owner
Browse files Browse the repository at this point in the history
  • Loading branch information
philipphoeninger committed Nov 1, 2024
1 parent 3bf766a commit 845baf2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions DAL/DAL.FileSharing/Initialization/SampleData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ public static class SampleData
}
};

public static List<FileItem> FileItems => new()
public static List<FileItem> FileItems(User user) => new()
{
new() { Id = 1, Name = "First Folder", IsDeleted = false, ParentId = null, IsFolder = true },
new() { Id = 2, Name = "First File", IsDeleted = false, ParentId = 1, IsFolder = false },
new() { Id = 3, Name = "Second File", IsDeleted = false, ParentId = 1, IsFolder = false },
new() { Id = 4, Name = "Second Folder", IsDeleted = false, ParentId = null, IsFolder = true },
new() { Id = 5, Name = "Third Folder", IsDeleted = false, ParentId = 4, IsFolder = true },
new() { Id = 1, Name = "First Folder", IsDeleted = false, ParentId = null, IsFolder = true, Owner = user.Id },
new() { Id = 2, Name = "First File", IsDeleted = false, ParentId = 1, IsFolder = false, Owner = user.Id },
new() { Id = 3, Name = "Second File", IsDeleted = false, ParentId = 1, IsFolder = false, Owner = user.Id },
new() { Id = 4, Name = "Second Folder", IsDeleted = false, ParentId = null, IsFolder = true, Owner = user.Id },
new() { Id = 5, Name = "Third Folder", IsDeleted = false, ParentId = 4, IsFolder = true, Owner = user.Id },
};

public static List<Link> Links(List<FileItem> fileItems, User user) => new()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ internal static async Task SeedData(ApplicationDBContext dbContext, UserManager<
try
{
var succeeded = await ProcessUserInsert(dbContext, userManager, SampleData.Users);
ProcessInsert(dbContext, dbContext.FileItems, SampleData.FileItems);
ProcessInsert(dbContext, dbContext.FileItems, SampleData.FileItems(userManager.Users.First()));
ProcessInsert(dbContext, dbContext.Links, SampleData.Links(dbContext.FileItems.ToList(), userManager.Users.First()));
}
catch (Exception ex)
Expand Down

0 comments on commit 845baf2

Please sign in to comment.