Initial files

This commit is contained in:
Neil Brommer 2021-11-12 19:21:59 -08:00
commit 691e049103
65 changed files with 4312 additions and 0 deletions

View file

@ -0,0 +1,14 @@
using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace Start.Server.Models
{
public class ApplicationUser : IdentityUser
{
/// <summary>The <see cref="BookmarkContainer"/>s that belong to this user</summary>
public List<BookmarkContainer>? BookmarkContainers { get; set; }
}
}

View file

@ -0,0 +1,37 @@
using System;
using System.ComponentModel.DataAnnotations;
namespace Start.Server.Models {
/// <summary>A bookmark with display text and a URL to link to</summary>
public class Bookmark {
/// <summary>A unique ID for the bookmark</summary>
[Key]
public int BookmarkId { get; set; }
/// <summary>The text to display for the bookmark</summary>
[MaxLength(300)]
public string Title { get; set; }
/// <summary>The URL the bookmark links to</summary>
[MaxLength(2000)] // De facto max length of URLs
public string Url { get; set; }
/// <summary>Arbitrary notes about the bookmark</summary>
[MaxLength(5000)]
public string? Notes { get; set; }
/// <summary>The unique ID for the group the bookmark is in</summary>
public int BookmarkGroupId { get; set; }
/// <summary>The group the bookmark is in</summary>
public BookmarkGroup? BookmarkGroup { get; set; }
public Bookmark(string title, string url, int bookmarkGroupId) {
this.Title = title;
this.Url = url;
this.BookmarkGroupId = bookmarkGroupId;
}
public Bookmark(int bookmarkId, string title, string url, int bookmarkGroupId)
: this(title, url, bookmarkGroupId) {
this.BookmarkId = bookmarkId;
}
}
}

View file

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Start.Server.Models {
/// <summary>A group of <see cref="BookmarkGroup"/>s</summary>
public class BookmarkContainer {
/// <summary>A unique ID for the container</summary>
[Key]
public int BookmarkContainerId { get; set; }
public string Title { get; set; }
/// <summary>The unique ID of the user that this container belongs to</summary>
public string ApplicationUserId { get; set; }
/// <summary>The user that this container belongs to</summary>
public ApplicationUser? ApplicationUser { get; set; }
/// <summary>The <see cref="BookmarkGroup"/>s in this container</summary>
public List<BookmarkGroup>? BookmarkGroups { get; set; }
public BookmarkContainer(string applicationUserId, string title) {
this.ApplicationUserId = applicationUserId;
this.Title = title;
}
public BookmarkContainer(int bookmarkContainerId, string applicationUserId, string title)
: this(applicationUserId, title) {
this.BookmarkContainerId = bookmarkContainerId;
}
}
}

View file

@ -0,0 +1,36 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Start.Server.Models {
/// <summary>A group of <see cref="Bookmark"/>s</summary>
public class BookmarkGroup {
/// <summary>A unique ID for the group</summary>
[Key]
public int BookmarkGroupId { get; set; }
/// <summary>The title of the group</summary>
[MaxLength(300)]
public string Title { get; set; }
/// <summary>A hex color for the group</summary>
[MaxLength(6)]
public string Color { get; set; }
/// <summary>The unique ID of the container this group is in</summary>
public int BookmarkContainerId { get; set; }
/// <summary>The container this group is in</summary>
public BookmarkContainer? BookmarkContainer { get; set; }
/// <summary>The bookmarks in this group</summary>
public List<Bookmark>? Bookmarks { get; set; }
public BookmarkGroup(string title, string color) {
this.Title = title;
this.Color = color;
}
public BookmarkGroup(int bookmarkGroupId, string title, string color) : this(title, color) {
this.BookmarkGroupId = bookmarkGroupId;
}
}
}