Initial commit

This commit is contained in:
Carl Tibule
2023-01-25 00:06:14 -06:00
commit e0b38beff6
37 changed files with 1593 additions and 0 deletions

24
YABA.Models/Bookmark.cs Normal file
View File

@ -0,0 +1,24 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using YABA.Models.Interfaces;
namespace YABA.Models
{
public class Bookmark : IIdentifiable, ISoftDeletable, IDateCreatedTrackable, IDateModifiedTrackable
{
public int Id { get; set; }
public bool IsDeleted { get; set; }
public DateTimeOffset CreatedOn { get; set; }
public DateTimeOffset LastModified { get; set; }
public string Title { get; set; }
public string Description { get; set; }
public string Note { get; set; }
public bool IsHidden { get; set; }
[Required]
[ForeignKey(nameof(User))]
public int UserId { get; set; }
public virtual User User { get; set; }
}
}

View File

@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using YABA.Models.Interfaces;
namespace YABA.Models
{
public class BookmarkTag : IIdentifiable
{
public int Id { get; set; }
[Required]
[ForeignKey(nameof(Bookmark))]
public int BookmarkId { get; set; }
public virtual Bookmark Bookmark { get; set; }
[Required]
[ForeignKey(nameof(Tag))]
public int TagId { get; set; }
public virtual Tag Tag { get; set; }
}
}

View File

@ -0,0 +1,9 @@
using System;
namespace YABA.Models.Interfaces
{
public interface IDateCreatedTrackable
{
public DateTimeOffset CreatedOn { get; set; }
}
}

View File

@ -0,0 +1,9 @@
using System;
namespace YABA.Models.Interfaces
{
public interface IDateModifiedTrackable
{
public DateTimeOffset LastModified { get; set; }
}
}

View File

@ -0,0 +1,8 @@

namespace YABA.Models.Interfaces
{
public interface IIdentifiable
{
public int Id { get; set; }
}
}

View File

@ -0,0 +1,8 @@

namespace YABA.Models.Interfaces
{
public interface ISoftDeletable
{
public bool IsDeleted { get; set; }
}
}

19
YABA.Models/Tag.cs Normal file
View File

@ -0,0 +1,19 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using YABA.Models.Interfaces;
namespace YABA.Models
{
public class Tag : IIdentifiable, ISoftDeletable
{
public int Id { get; set; }
public bool IsDeleted { get; set; }
public string Name { get; set; }
public bool IsHidden { get; set; }
[Required]
[ForeignKey(nameof(User))]
public int UserId { get; set; }
public virtual User User { get; set; }
}
}

17
YABA.Models/User.cs Normal file
View File

@ -0,0 +1,17 @@
using System;
using System.ComponentModel.DataAnnotations;
using YABA.Models.Interfaces;
namespace YABA.Models
{
public class User : IIdentifiable, ISoftDeletable, IDateCreatedTrackable, IDateModifiedTrackable
{
public int Id { get; set; }
public bool IsDeleted { get; set; }
public DateTimeOffset CreatedOn { get; set; }
public DateTimeOffset LastModified { get; set; }
[Required]
public string Auth0Id { get; set; }
}
}

View File

@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
</ItemGroup>
</Project>