Skip to content

Commit

Permalink
Add MusicFile model
Browse files Browse the repository at this point in the history
Also update DB for this.
  • Loading branch information
maacpiash committed Sep 24, 2024
1 parent aa5b767 commit 6ceadc2
Show file tree
Hide file tree
Showing 6 changed files with 473 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/Data/ApplicationDbContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ protected override void OnModelCreating(ModelBuilder builder)
builder.Entity<ApplicationUser>()
.HasMany(user => user.CalendarEvents)
.WithOne(calEvent => calEvent.User);
builder.Entity<ApplicationUser>()
.HasMany(user => user.MusicFiles)
.WithOne(calEvent => calEvent.User);
}

public DbSet<CalendarEvent> CalendarEvents { get; set; } = default!;
public DbSet<MusicFile> MusicFiles { get; set; } = default!;
}
3 changes: 1 addition & 2 deletions src/Data/ApplicationUser.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
using Microsoft.AspNetCore.Identity;
using NanoidDotNet;
using static NanoidDotNet.Nanoid.Alphabets;

namespace Blazing.Data;

// Add profile data for application users by adding properties to the ApplicationUser class
public class ApplicationUser : IdentityUser
{
public ICollection<CalendarEvent> CalendarEvents { get; set; } = new List<CalendarEvent>();
public ICollection<MusicFile> MusicFiles { get; set; } = new List<MusicFile>();
}
12 changes: 12 additions & 0 deletions src/Data/MusicFile.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Blazing.Data;

public class MusicFile
{
public Guid Id { get; set; }

public required ApplicationUser User { get; set; }
public string Title { get; set; } = "";
public string S3Url { get; set; } = "";

public DateTime Expires { get; set; }
}
Loading

0 comments on commit 6ceadc2

Please sign in to comment.