49 lines
No EOL
1.2 KiB
C#
49 lines
No EOL
1.2 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Mizuki.Database.Models;
|
|
|
|
/// <summary>
|
|
/// An uploaded file.
|
|
/// </summary>
|
|
[Index(nameof(Filename), IsUnique = true)]
|
|
public class Upload
|
|
{
|
|
/// <summary>
|
|
/// The ID of the uploaded file.
|
|
/// </summary>
|
|
[Key]
|
|
public required Guid Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// The filename.
|
|
/// </summary>
|
|
public required string Filename { get; set; }
|
|
|
|
/// <summary>
|
|
/// The filename.
|
|
/// </summary>
|
|
public required string OriginalFilename { get; set; }
|
|
|
|
/// <summary>
|
|
/// The size of the file in bytes.
|
|
/// </summary>
|
|
public required long SizeInBytes { get; set; }
|
|
|
|
/// <summary>
|
|
/// The time of upload.
|
|
/// </summary>
|
|
public required DateTimeOffset TimeOfUpload { get; set; }
|
|
|
|
/// <summary>
|
|
/// The author of the uploaded file.
|
|
/// </summary>
|
|
public required User Author { get; set; }
|
|
|
|
/// <summary>
|
|
/// The ID of the author.
|
|
/// </summary>
|
|
[ForeignKey(nameof(Author))]
|
|
public required Guid AuthorId { get; set; }
|
|
} |