Add project files

This commit is contained in:
2025-10-04 13:27:29 +03:00
parent 75eba696c9
commit cc53824229
46 changed files with 3328 additions and 7 deletions

View File

@@ -0,0 +1,16 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace T120B165_ImgBoard.Models;
public class Comment
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public string Text { get; set; }
public User Author { get; set; }
public Post OriginalPost { get; set; }
public DateTime Created { get; set; }
public DateTime? Updated { get; set; }
}

View File

@@ -0,0 +1,24 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace T120B165_ImgBoard.Models;
public class File
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
// The physical path where the file is stored
public required string FilePath { get; set; }
// Original file name uploaded by the user
public required string OriginalFileName { get; set; }
// The size of the file in bytes
public required long Size { get; set; }
// The MIME type, will be validated at the end of the upload
public required string ContentType { get; set; }
// Tracks when the file metadata was created/upload process started
public required DateTime CreatedDate { get; set; }
// Tracks when the file was successfully finalized
// Null until the final PATCH request completes
public DateTime? FinishedDate { get; set; }
}

View File

@@ -0,0 +1,17 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace T120B165_ImgBoard.Models;
public class Post
{
[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int Id { get; set; }
public required string Title { get; set; }
public required string Description { get; set; }
public User Author { get; set; }
public required DateTime Created { get; set; }
public required List<Tag> Tags { get; set; }
public required File File { get; set; }
}

View File

@@ -0,0 +1,17 @@
using System.ComponentModel.DataAnnotations;
namespace T120B165_ImgBoard.Models;
public enum TagType
{
General,
Copyright,
}
public class Tag
{
[Key]
public required string Name { get; init; }
public required TagType Type { get; set; }
}

View File

@@ -0,0 +1,23 @@
using System.ComponentModel.DataAnnotations;
using Microsoft.AspNetCore.Identity;
namespace T120B165_ImgBoard.Models;
public static class UserRoles
{
public const string Admin = "Admin";
public const string Regular = "Regular";
}
public class RefreshToken
{
[Key]
public string Token { get; set; }
public User User { get; set; }
public DateTime Expires { get; set; }
}
public class User : IdentityUser
{
//public List<Post> Posts { get; set; }
};