Initial commit

This commit is contained in:
Laura Hausmann 2023-12-24 00:45:46 +01:00
commit ea6612de25
Signed by: zotan
GPG key ID: D044E84C5BE01605
186 changed files with 25828 additions and 0 deletions

98
.gitignore vendored Normal file
View file

@ -0,0 +1,98 @@
# Created by https://www.toptal.com/developers/gitignore/api/dotnetcore,rider
# Edit at https://www.toptal.com/developers/gitignore?templates=dotnetcore,rider
### DotnetCore ###
# .NET Core build folders
bin/
obj/
# Common node modules locations
/node_modules
/wwwroot/node_modules
### Rider ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff
.idea/**/workspace.xml
.idea/**/tasks.xml
.idea/**/usage.statistics.xml
.idea/**/dictionaries
.idea/**/shelf
# AWS User-specific
.idea/**/aws.xml
# Generated files
.idea/**/contentModel.xml
# Sensitive or high-churn files
.idea/**/dataSources/
.idea/**/dataSources.ids
.idea/**/dataSources.local.xml
.idea/**/sqlDataSources.xml
.idea/**/dynamic.xml
.idea/**/uiDesigner.xml
.idea/**/dbnavigator.xml
# Gradle
.idea/**/gradle.xml
.idea/**/libraries
# Gradle and Maven with auto-import
# When using Gradle or Maven with auto-import, you should exclude module files,
# since they will be recreated, and may cause churn. Uncomment if using
# auto-import.
# .idea/artifacts
# .idea/compiler.xml
# .idea/jarRepositories.xml
# .idea/modules.xml
# .idea/*.iml
# .idea/modules
# *.iml
# *.ipr
# CMake
cmake-build-*/
# Mongo Explorer plugin
.idea/**/mongoSettings.xml
# File-based project format
*.iws
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Cursive Clojure plugin
.idea/replstate.xml
# SonarLint plugin
.idea/sonarlint/
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
fabric.properties
# Editor-based Rest Client
.idea/httpRequests
# Android studio 3.1+ serialized cache file
.idea/caches/build_file_checksums.ser
# End of https://www.toptal.com/developers/gitignore/api/dotnetcore,rider
Iceshrimp.Backend/wwwroot/frontend
Iceshrimp.Backend/wwwroot/.vite
Iceshrimp.Frontend/.yarn
*.DotSettings.user

View file

@ -0,0 +1,13 @@
# Default ignored files
/shelf/
/workspace.xml
# Rider ignored files
/contentModel.xml
/projectSettingsUpdater.xml
/modules.xml
/.idea.Iceshrimp.NET.iml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View file

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
</project>

View file

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="UserContentModel">
<attachedFolders>
<Path>Iceshrimp.Frontend</Path>
</attachedFolders>
<explicitIncludes />
<explicitExcludes />
</component>
</project>

0
.noai Normal file
View file

View file

@ -0,0 +1,40 @@
using Iceshrimp.Backend.Controllers.Attributes;
using Iceshrimp.Backend.Controllers.Renderers.ActivityPub;
using Iceshrimp.Backend.Controllers.Schemas;
using Iceshrimp.Backend.Core.Database;
using Iceshrimp.Backend.Core.Federation.ActivityStreams;
using Iceshrimp.Backend.Core.Federation.ActivityStreams.Types;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Controllers;
[ApiController]
[MediaTypeRouteFilter("application/activity+json", "application/ld+json")]
[Produces("application/activity+json", "application/ld+json")]
public class ActivityPubController : Controller {
/*
[HttpGet("/notes/{id}")]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(Note))]
[ProducesResponseType(StatusCodes.Status401Unauthorized, Type = typeof(ErrorResponse))]
[ProducesResponseType(StatusCodes.Status404NotFound, Type = typeof(ErrorResponse))]
public async Task<IActionResult> GetNote(string id) {
var db = new DatabaseContext();
var note = await db.Notes.FirstOrDefaultAsync(p => p.Id == id);
if (note == null) return NotFound();
return Ok(note);
}
*/
[HttpGet("/users/{id}")]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(ASActor))]
[ProducesResponseType(StatusCodes.Status404NotFound, Type = typeof(ErrorResponse))]
public async Task<IActionResult> GetUser(string id) {
var db = new DatabaseContext();
var user = await db.Users.FirstOrDefaultAsync(p => p.Id == id);
if (user == null) return NotFound();
var rendered = await ActivityPubUserRenderer.Render(user);
var compacted = LDHelpers.Compact(rendered);
return Ok(compacted);
}
}

View file

@ -0,0 +1,13 @@
using Microsoft.AspNetCore.Mvc.ActionConstraints;
namespace Iceshrimp.Backend.Controllers.Attributes;
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method)]
public class MediaTypeRouteFilterAttribute(params string[] mediaTypes) : Attribute, IActionConstraint {
public bool Accept(ActionConstraintContext context) {
return context.RouteContext.HttpContext.Request.Headers.ContainsKey("Accept") &&
mediaTypes.Contains(context.RouteContext.HttpContext.Request.Headers.Accept.ToString());
}
public int Order => HttpMethodActionConstraint.HttpMethodConstraintOrder + 1;
}

View file

@ -0,0 +1,60 @@
using System.Diagnostics.CodeAnalysis;
using System.Net;
using System.Net.Mime;
using Iceshrimp.Backend.Controllers.Schemas;
using Iceshrimp.Backend.Core.Database;
using Iceshrimp.Backend.Core.Database.Tables;
using Iceshrimp.Backend.Core.Helpers;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Controllers;
[ApiController]
[Produces("application/json")]
[Route("/api/iceshrimp/v1/auth")]
public class AuthController : Controller {
[HttpGet]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(AuthResponse))]
public async Task<IActionResult> GetAuthStatus() {
return new StatusCodeResult((int)HttpStatusCode.NotImplemented);
}
[HttpPost]
[Consumes(MediaTypeNames.Application.Json)]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(TimelineResponse))]
[ProducesResponseType(StatusCodes.Status400BadRequest, Type = typeof(ErrorResponse))]
[ProducesResponseType(StatusCodes.Status401Unauthorized, Type = typeof(ErrorResponse))]
[SuppressMessage("Performance",
"CA1862:Use the \'StringComparison\' method overloads to perform case-insensitive string comparisons")]
public async Task<IActionResult> Login([FromBody] AuthRequest request) {
var db = new DatabaseContext();
var user = await db.Users.FirstOrDefaultAsync(p => p.UsernameLower == request.Username.ToLowerInvariant() &&
p.Host == null);
if (user == null) return Unauthorized();
var profile = await db.UserProfiles.FirstOrDefaultAsync(p => p.UserId == user.Id);
if (profile?.Password == null) return Unauthorized();
if (!AuthHelpers.ComparePassword(request.Password, profile.Password)) return Unauthorized();
var res = await db.AddAsync(new Session {
Id = IdHelpers.GenerateSlowflakeId(),
UserId = user.Id,
Active = !profile.TwoFactorEnabled,
CreatedAt = new DateTime(),
Token = IdHelpers.GenerateRandomString(32)
});
var session = res.Entity;
return Ok(new AuthResponse {
Status = session.Active ? AuthStatusEnum.Authenticated : AuthStatusEnum.TwoFactor,
Token = session.Token,
User = new UserResponse {
Username = session.User.Username,
Id = session.User.Id,
AvatarUrl = session.User.AvatarUrl,
BannerUrl = session.User.BannerUrl
}
});
}
}

View file

@ -0,0 +1,16 @@
using Iceshrimp.Backend.Controllers.Schemas;
using Microsoft.AspNetCore.Mvc;
namespace Iceshrimp.Backend.Controllers;
[Produces("application/json")]
public class FallbackController : Controller {
[ProducesResponseType(StatusCodes.Status501NotImplemented, Type = typeof(ErrorResponse))]
public IActionResult FallbackAction() {
return StatusCode(501, new ErrorResponse {
StatusCode = 501,
Error = "Not implemented",
Message = "This API method has not been implemented"
});
}
}

View file

@ -0,0 +1,19 @@
using Iceshrimp.Backend.Controllers.Renderers.Entity;
using Iceshrimp.Backend.Controllers.Schemas;
using Iceshrimp.Backend.Core.Database.Tables;
namespace Iceshrimp.Backend.Controllers.Renderers.ActivityPub;
public class NoteRenderer {
public static NoteResponse RenderOne(Note note) {
return new NoteResponse {
Id = note.Id,
Text = note.Text,
User = UserRenderer.RenderOne(note.User)
};
}
public static IEnumerable<NoteResponse> RenderMany(IEnumerable<Note> notes) {
return notes.Select(RenderOne);
}
}

View file

@ -0,0 +1,43 @@
using AngleSharp.Text;
using Iceshrimp.Backend.Core.Configuration;
using Iceshrimp.Backend.Core.Database;
using Iceshrimp.Backend.Core.Database.Tables;
using Iceshrimp.Backend.Core.Federation.ActivityStreams.Types;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Controllers.Renderers.ActivityPub;
public static class ActivityPubUserRenderer {
public static async Task<ASActor> Render(User user) {
if (user.Host != null) throw new Exception();
var db = new DatabaseContext();
var profile = await db.UserProfiles.FirstOrDefaultAsync(p => p.UserId == user.Id);
var id = $"{Config.Instance.Url}/users/{user.Id}";
var type = Constants.SystemUsers.Contains(user.UsernameLower)
? "Application"
: user.IsBot
? "Service"
: "Person";
return new ASActor {
Id = id,
Type = [type],
//Inbox = $"{id}/inbox",
//Outbox = $"{id}/outbox",
//Followers = $"{id}/followers",
//Following = $"{id}/following",
//SharedInbox = $"{Config.Instance.Url}/inbox",
//Endpoints = new Dictionary<string, string> { { "SharedInbox", $"{Config.Instance.Url}/inbox" } },
Url = new ASLink($"{Config.Instance.Url}/@{user.Username}"),
Username = user.Username,
DisplayName = user.Name ?? user.Username,
Summary = profile?.Description != null ? "Not implemented" : null, //TODO: convert to html
MkSummary = profile?.Description,
IsCat = user.IsCat,
IsDiscoverable = user.IsExplorable,
IsLocked = user.IsLocked
};
}
}

View file

@ -0,0 +1,18 @@
using Iceshrimp.Backend.Controllers.Schemas;
using Iceshrimp.Backend.Core.Database.Tables;
namespace Iceshrimp.Backend.Controllers.Renderers.Entity;
public class NoteRenderer {
public static NoteResponse RenderOne(Note note) {
return new NoteResponse {
Id = note.Id,
Text = note.Text,
User = UserRenderer.RenderOne(note.User)
};
}
public static IEnumerable<NoteResponse> RenderMany(IEnumerable<Note> notes) {
return notes.Select(RenderOne);
}
}

View file

@ -0,0 +1,13 @@
using Iceshrimp.Backend.Controllers.Schemas;
using Iceshrimp.Backend.Core.Database.Tables;
namespace Iceshrimp.Backend.Controllers.Renderers.Entity;
public class TimelineRenderer {
public static TimelineResponse Render(IEnumerable<Note> notes, int limit) {
return new TimelineResponse {
Notes = NoteRenderer.RenderMany(notes),
Limit = limit
};
}
}

View file

@ -0,0 +1,19 @@
using Iceshrimp.Backend.Controllers.Schemas;
using Iceshrimp.Backend.Core.Database.Tables;
namespace Iceshrimp.Backend.Controllers.Renderers.Entity;
public class UserRenderer {
public static UserResponse RenderOne(User user) {
return new UserResponse {
Id = user.Id,
Username = user.Username,
AvatarUrl = user.AvatarUrl,
BannerUrl = user.BannerUrl
};
}
public static IEnumerable<UserResponse> RenderMany(IEnumerable<User> users) {
return users.Select(RenderOne);
}
}

View file

@ -0,0 +1,8 @@
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
namespace Iceshrimp.Backend.Controllers.Schemas;
public class AuthRequest {
[J("username")] public required string Username { get; set; }
[J("password")] public required string Password { get; set; }
}

View file

@ -0,0 +1,18 @@
using System.Text.Json.Serialization;
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
using JE = System.Runtime.Serialization.EnumMemberAttribute;
namespace Iceshrimp.Backend.Controllers.Schemas;
[JsonConverter(typeof(JsonStringEnumConverter<AuthStatusEnum>))]
public enum AuthStatusEnum {
[JE(Value = "guest")] Guest,
[JE(Value = "authenticated")] Authenticated,
[JE(Value = "2fa")] TwoFactor
}
public class AuthResponse {
[J("status")] public required AuthStatusEnum Status { get; set; }
[J("token")] public required string? Token { get; set; }
[J("user")] public required UserResponse? User { get; set; }
}

View file

@ -0,0 +1,9 @@
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
namespace Iceshrimp.Backend.Controllers.Schemas;
public class ErrorResponse {
[J("statusCode")] public required int StatusCode { get; set; }
[J("error")] public required string Error { get; set; }
[J("message")] public required string Message { get; set; }
}

View file

@ -0,0 +1,19 @@
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
namespace Iceshrimp.Backend.Controllers.Schemas;
public class NoteResponse : NoteBase {
[J("reply")] public NoteBase? Reply { get; set; }
[J("renote")] public NoteRenote? Renote { get; set; }
[J("quote")] public NoteBase? Quote { get; set; }
}
public class NoteRenote : NoteBase {
[J("quote")] public NoteBase? Quote { get; set; }
}
public class NoteBase {
[J("id")] public required string Id { get; set; }
[J("text")] public required string? Text { get; set; }
[J("user")] public required UserResponse User { get; set; }
}

View file

@ -0,0 +1,8 @@
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
namespace Iceshrimp.Backend.Controllers.Schemas;
public class TimelineResponse {
[J("notes")] public required IEnumerable<NoteResponse> Notes { get; set; }
[J("limit")] public required int Limit { get; set; }
}

View file

@ -0,0 +1,10 @@
using J = System.Text.Json.Serialization.JsonPropertyNameAttribute;
namespace Iceshrimp.Backend.Controllers.Schemas;
public class UserResponse {
[J("id")] public required string Id { get; set; }
[J("username")] public required string Username { get; set; }
[J("avatarUrl")] public string? AvatarUrl { get; set; }
[J("bannerUrl")] public string? BannerUrl { get; set; }
}

View file

@ -0,0 +1,41 @@
using Iceshrimp.Backend.Controllers.Renderers.Entity;
using Iceshrimp.Backend.Controllers.Schemas;
using Iceshrimp.Backend.Core.Database;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Controllers;
[ApiController]
[Produces("application/json")]
[Route("/api/iceshrimp/v1/user/{id}")]
public class UserController : Controller {
[HttpGet]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(UserResponse))]
[ProducesResponseType(StatusCodes.Status404NotFound, Type = typeof(ErrorResponse))]
public async Task<IActionResult> GetUser(string id) {
var db = new DatabaseContext();
var user = await db.Users.FirstOrDefaultAsync(p => p.Id == id);
if (user == null) return NotFound();
return Ok(user);
}
[HttpGet("notes")]
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(TimelineResponse))]
[ProducesResponseType(StatusCodes.Status404NotFound, Type = typeof(ErrorResponse))]
public async Task<IActionResult> GetUserNotes(string id) {
var db = new DatabaseContext();
var user = await db.Users.FirstOrDefaultAsync(p => p.Id == id);
if (user == null) return NotFound();
var limit = 10;
var notes = db.Notes
.Include(p => p.User)
.Where(p => p.UserId == id)
.OrderByDescending(p => p.Id)
.Take(limit)
.ToList();
return Ok(TimelineRenderer.Render(notes, limit));
}
}

View file

@ -0,0 +1,10 @@
namespace Iceshrimp.Backend.Core.Configuration;
// TODO: something something IConfiguration
public class Config {
public static Config Instance = new() {
Url = "https://shrimp-next.fedi.solutions"
};
public required string Url { get; set; }
}

View file

@ -0,0 +1,6 @@
namespace Iceshrimp.Backend.Core.Configuration;
public class Constants {
public const string UserAgent = "Iceshrimp/2024.1-experimental (https://shrimp-next.fedi.solutions)";
public static readonly string[] SystemUsers = { "instance.actor", "relay.actor" };
}

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,71 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("abuse_user_report")]
[Index("ReporterId", Name = "IDX_04cc96756f89d0b7f9473e8cdf")]
[Index("Resolved", Name = "IDX_2b15aaf4a0dc5be3499af7ab6a")]
[Index("TargetUserHost", Name = "IDX_4ebbf7f93cdc10e8d1ef2fc6cd")]
[Index("TargetUserId", Name = "IDX_a9021cc2e1feb5f72d3db6e9f5")]
[Index("CreatedAt", Name = "IDX_db2098070b2b5a523c58181f74")]
[Index("ReporterHost", Name = "IDX_f8d8b93740ad12c4ce8213a199")]
public class AbuseUserReport {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the AbuseUserReport.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
[Column("targetUserId")]
[StringLength(32)]
public string TargetUserId { get; set; } = null!;
[Column("reporterId")]
[StringLength(32)]
public string ReporterId { get; set; } = null!;
[Column("assigneeId")]
[StringLength(32)]
public string? AssigneeId { get; set; }
[Column("resolved")] public bool Resolved { get; set; }
[Column("comment")]
[StringLength(2048)]
public string Comment { get; set; } = null!;
/// <summary>
/// [Denormalized]
/// </summary>
[Column("targetUserHost")]
[StringLength(512)]
public string? TargetUserHost { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("reporterHost")]
[StringLength(512)]
public string? ReporterHost { get; set; }
[Column("forwarded")] public bool Forwarded { get; set; }
[ForeignKey("AssigneeId")]
[InverseProperty("AbuseUserReportAssignees")]
public virtual User? Assignee { get; set; }
[ForeignKey("ReporterId")]
[InverseProperty("AbuseUserReportReporters")]
public virtual User Reporter { get; set; } = null!;
[ForeignKey("TargetUserId")]
[InverseProperty("AbuseUserReportTargetUsers")]
public virtual User TargetUser { get; set; } = null!;
}

View file

@ -0,0 +1,63 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("access_token")]
[Index("Hash", Name = "IDX_64c327441248bae40f7d92f34f")]
[Index("Token", Name = "IDX_70ba8f6af34bc924fc9e12adb8")]
[Index("UserId", Name = "IDX_9949557d0e1b2c19e5344c171e")]
[Index("Session", Name = "IDX_bf3a053c07d9fb5d87317c56ee")]
public class AccessToken {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the AccessToken.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
[Column("token")] [StringLength(128)] public string Token { get; set; } = null!;
[Column("hash")] [StringLength(128)] public string Hash { get; set; } = null!;
[Column("userId")] [StringLength(32)] public string UserId { get; set; } = null!;
[Column("appId")] [StringLength(32)] public string? AppId { get; set; }
[Column("lastUsedAt")] public DateTime? LastUsedAt { get; set; }
[Column("session")]
[StringLength(128)]
public string? Session { get; set; }
[Column("name")] [StringLength(128)] public string? Name { get; set; }
[Column("description")]
[StringLength(512)]
public string? Description { get; set; }
[Column("iconUrl")]
[StringLength(512)]
public string? IconUrl { get; set; }
[Column("permission", TypeName = "character varying(64)[]")]
public List<string> Permission { get; set; } = null!;
[Column("fetched")] public bool Fetched { get; set; }
[ForeignKey("AppId")]
[InverseProperty("AccessTokens")]
public virtual App? App { get; set; }
[InverseProperty("AppAccessToken")]
public virtual ICollection<Notification> Notifications { get; set; } = new List<Notification>();
[ForeignKey("UserId")]
[InverseProperty("AccessTokens")]
public virtual User User { get; set; } = null!;
}

View file

@ -0,0 +1,41 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("announcement")]
[Index("CreatedAt", Name = "IDX_118ec703e596086fc4515acb39")]
public class Announcement {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the Announcement.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
[Column("text")] [StringLength(8192)] public string Text { get; set; } = null!;
[Column("title")] [StringLength(256)] public string Title { get; set; } = null!;
[Column("imageUrl")]
[StringLength(1024)]
public string? ImageUrl { get; set; }
/// <summary>
/// The updated date of the Announcement.
/// </summary>
[Column("updatedAt")]
public DateTime? UpdatedAt { get; set; }
[Column("showPopup")] public bool ShowPopup { get; set; }
[Column("isGoodNews")] public bool IsGoodNews { get; set; }
[InverseProperty("Announcement")]
public virtual ICollection<AnnouncementRead> AnnouncementReads { get; set; } = new List<AnnouncementRead>();
}

View file

@ -0,0 +1,36 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("announcement_read")]
[Index("AnnouncementId", Name = "IDX_603a7b1e7aa0533c6c88e9bfaf")]
[Index("UserId", Name = "IDX_8288151386172b8109f7239ab2")]
[Index("UserId", "AnnouncementId", Name = "IDX_924fa71815cfa3941d003702a0", IsUnique = true)]
public class AnnouncementRead {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
[Column("userId")] [StringLength(32)] public string UserId { get; set; } = null!;
[Column("announcementId")]
[StringLength(32)]
public string AnnouncementId { get; set; } = null!;
/// <summary>
/// The created date of the AnnouncementRead.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
[ForeignKey("AnnouncementId")]
[InverseProperty("AnnouncementReads")]
public virtual Announcement Announcement { get; set; } = null!;
[ForeignKey("UserId")]
[InverseProperty("AnnouncementReads")]
public virtual User User { get; set; } = null!;
}

View file

@ -0,0 +1,78 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("antenna")]
[Index("UserId", Name = "IDX_6446c571a0e8d0f05f01c78909")]
public class Antenna {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the Antenna.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// The owner ID.
/// </summary>
[Column("userId")]
[StringLength(32)]
public string UserId { get; set; } = null!;
/// <summary>
/// The name of the Antenna.
/// </summary>
[Column("name")]
[StringLength(128)]
public string Name { get; set; } = null!;
[Column("userListId")]
[StringLength(32)]
public string? UserListId { get; set; }
[Column("keywords", TypeName = "jsonb")]
public string Keywords { get; set; } = null!;
[Column("withFile")] public bool WithFile { get; set; }
[Column("expression")]
[StringLength(2048)]
public string? Expression { get; set; }
[Column("notify")] public bool Notify { get; set; }
[Column("caseSensitive")] public bool CaseSensitive { get; set; }
[Column("withReplies")] public bool WithReplies { get; set; }
[Column("userGroupJoiningId")]
[StringLength(32)]
public string? UserGroupJoiningId { get; set; }
[Column("users", TypeName = "character varying(1024)[]")]
public List<string> Users { get; set; } = null!;
[Column("excludeKeywords", TypeName = "jsonb")]
public string ExcludeKeywords { get; set; } = null!;
[Column("instances", TypeName = "jsonb")]
public string Instances { get; set; } = null!;
[ForeignKey("UserId")]
[InverseProperty("Antennas")]
public virtual User User { get; set; } = null!;
[ForeignKey("UserGroupJoiningId")]
[InverseProperty("Antennas")]
public virtual UserGroupJoining? UserGroupJoining { get; set; }
[ForeignKey("UserListId")]
[InverseProperty("Antennas")]
public virtual UserList? UserList { get; set; }
}

View file

@ -0,0 +1,73 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("app")]
[Index("CreatedAt", Name = "IDX_048a757923ed8b157e9895da53")]
[Index("UserId", Name = "IDX_3f5b0899ef90527a3462d7c2cb")]
[Index("Secret", Name = "IDX_f49922d511d666848f250663c4")]
public class App {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the App.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// The owner ID.
/// </summary>
[Column("userId")]
[StringLength(32)]
public string? UserId { get; set; }
/// <summary>
/// The secret key of the App.
/// </summary>
[Column("secret")]
[StringLength(64)]
public string Secret { get; set; } = null!;
/// <summary>
/// The name of the App.
/// </summary>
[Column("name")]
[StringLength(128)]
public string Name { get; set; } = null!;
/// <summary>
/// The description of the App.
/// </summary>
[Column("description")]
[StringLength(512)]
public string Description { get; set; } = null!;
/// <summary>
/// The permission of the App.
/// </summary>
[Column("permission", TypeName = "character varying(64)[]")]
public List<string> Permission { get; set; } = null!;
/// <summary>
/// The callbackUrl of the App.
/// </summary>
[Column("callbackUrl")]
[StringLength(512)]
public string? CallbackUrl { get; set; }
[InverseProperty("App")]
public virtual ICollection<AccessToken> AccessTokens { get; set; } = new List<AccessToken>();
[InverseProperty("App")]
public virtual ICollection<AuthSession> AuthSessions { get; set; } = new List<AuthSession>();
[ForeignKey("UserId")]
[InverseProperty("Apps")]
public virtual User? User { get; set; }
}

View file

@ -0,0 +1,45 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[PrimaryKey("Id", "UserId")]
[Table("attestation_challenge")]
[Index("Challenge", Name = "IDX_47efb914aed1f72dd39a306c7b")]
[Index("UserId", Name = "IDX_f1a461a618fa1755692d0e0d59")]
public class AttestationChallenge {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
[Key]
[Column("userId")]
[StringLength(32)]
public string UserId { get; set; } = null!;
/// <summary>
/// Hex-encoded sha256 hash of the challenge.
/// </summary>
[Column("challenge")]
[StringLength(64)]
public string Challenge { get; set; } = null!;
/// <summary>
/// The date challenge was created for expiry purposes.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// Indicates that the challenge is only for registration purposes if true to prevent the challenge for being used as
/// authentication.
/// </summary>
[Column("registrationChallenge")]
public bool RegistrationChallenge { get; set; }
[ForeignKey("UserId")]
[InverseProperty("AttestationChallenges")]
public virtual User User { get; set; } = null!;
}

View file

@ -0,0 +1,34 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("auth_session")]
[Index("Token", Name = "IDX_62cb09e1129f6ec024ef66e183")]
public class AuthSession {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the AuthSession.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
[Column("token")] [StringLength(128)] public string Token { get; set; } = null!;
[Column("userId")] [StringLength(32)] public string? UserId { get; set; }
[Column("appId")] [StringLength(32)] public string AppId { get; set; } = null!;
[ForeignKey("AppId")]
[InverseProperty("AuthSessions")]
public virtual App App { get; set; } = null!;
[ForeignKey("UserId")]
[InverseProperty("AuthSessions")]
public virtual User? User { get; set; }
}

View file

@ -0,0 +1,45 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("blocking")]
[Index("BlockerId", Name = "IDX_0627125f1a8a42c9a1929edb55")]
[Index("BlockeeId", Name = "IDX_2cd4a2743a99671308f5417759")]
[Index("BlockerId", "BlockeeId", Name = "IDX_98a1bc5cb30dfd159de056549f", IsUnique = true)]
[Index("CreatedAt", Name = "IDX_b9a354f7941c1e779f3b33aea6")]
public class Blocking {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the Blocking.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// The blockee user ID.
/// </summary>
[Column("blockeeId")]
[StringLength(32)]
public string BlockeeId { get; set; } = null!;
/// <summary>
/// The blocker user ID.
/// </summary>
[Column("blockerId")]
[StringLength(32)]
public string BlockerId { get; set; } = null!;
[ForeignKey("BlockeeId")]
[InverseProperty("BlockingBlockees")]
public virtual User Blockee { get; set; } = null!;
[ForeignKey("BlockerId")]
[InverseProperty("BlockingBlockers")]
public virtual User Blocker { get; set; } = null!;
}

View file

@ -0,0 +1,82 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("channel")]
[Index("UsersCount", Name = "IDX_094b86cd36bb805d1aa1e8cc9a")]
[Index("NotesCount", Name = "IDX_0f58c11241e649d2a638a8de94")]
[Index("LastNotedAt", Name = "IDX_29ef80c6f13bcea998447fce43")]
[Index("CreatedAt", Name = "IDX_71cb7b435b7c0d4843317e7e16")]
[Index("UserId", Name = "IDX_823bae55bd81b3be6e05cff438")]
public class Channel {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the Channel.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
[Column("lastNotedAt")] public DateTime? LastNotedAt { get; set; }
/// <summary>
/// The owner ID.
/// </summary>
[Column("userId")]
[StringLength(32)]
public string? UserId { get; set; }
/// <summary>
/// The name of the Channel.
/// </summary>
[Column("name")]
[StringLength(128)]
public string Name { get; set; } = null!;
/// <summary>
/// The description of the Channel.
/// </summary>
[Column("description")]
[StringLength(2048)]
public string? Description { get; set; }
/// <summary>
/// The ID of banner Channel.
/// </summary>
[Column("bannerId")]
[StringLength(32)]
public string? BannerId { get; set; }
/// <summary>
/// The count of notes.
/// </summary>
[Column("notesCount")]
public int NotesCount { get; set; }
/// <summary>
/// The count of users.
/// </summary>
[Column("usersCount")]
public int UsersCount { get; set; }
[ForeignKey("BannerId")]
[InverseProperty("Channels")]
public virtual DriveFile? Banner { get; set; }
[InverseProperty("Followee")]
public virtual ICollection<ChannelFollowing> ChannelFollowings { get; set; } = new List<ChannelFollowing>();
[InverseProperty("Channel")]
public virtual ICollection<ChannelNotePining> ChannelNotePinings { get; set; } = new List<ChannelNotePining>();
[InverseProperty("Channel")] public virtual ICollection<Note> Notes { get; set; } = new List<Note>();
[ForeignKey("UserId")]
[InverseProperty("Channels")]
public virtual User? User { get; set; }
}

View file

@ -0,0 +1,45 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("channel_following")]
[Index("FolloweeId", Name = "IDX_0e43068c3f92cab197c3d3cd86")]
[Index("CreatedAt", Name = "IDX_11e71f2511589dcc8a4d3214f9")]
[Index("FollowerId", "FolloweeId", Name = "IDX_2e230dd45a10e671d781d99f3e", IsUnique = true)]
[Index("FollowerId", Name = "IDX_6d8084ec9496e7334a4602707e")]
public class ChannelFollowing {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the ChannelFollowing.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// The followee channel ID.
/// </summary>
[Column("followeeId")]
[StringLength(32)]
public string FolloweeId { get; set; } = null!;
/// <summary>
/// The follower user ID.
/// </summary>
[Column("followerId")]
[StringLength(32)]
public string FollowerId { get; set; } = null!;
[ForeignKey("FolloweeId")]
[InverseProperty("ChannelFollowings")]
public virtual Channel Followee { get; set; } = null!;
[ForeignKey("FollowerId")]
[InverseProperty("ChannelFollowings")]
public virtual User Follower { get; set; } = null!;
}

View file

@ -0,0 +1,35 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("channel_note_pining")]
[Index("ChannelId", Name = "IDX_8125f950afd3093acb10d2db8a")]
[Index("ChannelId", "NoteId", Name = "IDX_f36fed37d6d4cdcc68c803cd9c", IsUnique = true)]
public class ChannelNotePining {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the ChannelNotePining.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
[Column("channelId")]
[StringLength(32)]
public string ChannelId { get; set; } = null!;
[Column("noteId")] [StringLength(32)] public string NoteId { get; set; } = null!;
[ForeignKey("ChannelId")]
[InverseProperty("ChannelNotePinings")]
public virtual Channel Channel { get; set; } = null!;
[ForeignKey("NoteId")]
[InverseProperty("ChannelNotePinings")]
public virtual Note Note { get; set; } = null!;
}

View file

@ -0,0 +1,56 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart__active_users")]
[Index("Date", Name = "IDX_0ad37b7ef50f4ddc84363d7ccc", IsUnique = true)]
[Index("Date", Name = "UQ_0ad37b7ef50f4ddc84363d7ccca", IsUnique = true)]
public class ChartActiveUser {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("unique_temp___registeredWithinWeek", TypeName = "character varying[]")]
public List<string> UniqueTempRegisteredWithinWeek { get; set; } = null!;
[Column("___registeredWithinWeek")] public short RegisteredWithinWeek { get; set; }
[Column("unique_temp___registeredWithinMonth", TypeName = "character varying[]")]
public List<string> UniqueTempRegisteredWithinMonth { get; set; } = null!;
[Column("___registeredWithinMonth")] public short RegisteredWithinMonth { get; set; }
[Column("unique_temp___registeredWithinYear", TypeName = "character varying[]")]
public List<string> UniqueTempRegisteredWithinYear { get; set; } = null!;
[Column("___registeredWithinYear")] public short RegisteredWithinYear { get; set; }
[Column("unique_temp___registeredOutsideWeek", TypeName = "character varying[]")]
public List<string> UniqueTempRegisteredOutsideWeek { get; set; } = null!;
[Column("___registeredOutsideWeek")] public short RegisteredOutsideWeek { get; set; }
[Column("unique_temp___registeredOutsideMonth", TypeName = "character varying[]")]
public List<string> UniqueTempRegisteredOutsideMonth { get; set; } = null!;
[Column("___registeredOutsideMonth")] public short RegisteredOutsideMonth { get; set; }
[Column("unique_temp___registeredOutsideYear", TypeName = "character varying[]")]
public List<string> UniqueTempRegisteredOutsideYear { get; set; } = null!;
[Column("___registeredOutsideYear")] public short RegisteredOutsideYear { get; set; }
[Column("___readWrite")] public short ReadWrite { get; set; }
[Column("unique_temp___read", TypeName = "character varying[]")]
public List<string> UniqueTempRead { get; set; } = null!;
[Column("___read")] public short Read { get; set; }
[Column("unique_temp___write", TypeName = "character varying[]")]
public List<string> UniqueTempWrite { get; set; } = null!;
[Column("___write")] public short Write { get; set; }
}

View file

@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart__ap_request")]
[Index("Date", Name = "IDX_e56f4beac5746d44bc3e19c80d", IsUnique = true)]
[Index("Date", Name = "UQ_e56f4beac5746d44bc3e19c80d0", IsUnique = true)]
public class ChartApRequest {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("___deliverFailed")] public int DeliverFailed { get; set; }
[Column("___deliverSucceeded")] public int DeliverSucceeded { get; set; }
[Column("___inboxReceived")] public int InboxReceived { get; set; }
}

View file

@ -0,0 +1,56 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart_day__active_users")]
[Index("Date", Name = "IDX_d5954f3df5e5e3bdfc3c03f390", IsUnique = true)]
[Index("Date", Name = "UQ_d5954f3df5e5e3bdfc3c03f3906", IsUnique = true)]
public class ChartDayActiveUser {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("unique_temp___registeredWithinWeek", TypeName = "character varying[]")]
public List<string> UniqueTempRegisteredWithinWeek { get; set; } = null!;
[Column("___registeredWithinWeek")] public short RegisteredWithinWeek { get; set; }
[Column("unique_temp___registeredWithinMonth", TypeName = "character varying[]")]
public List<string> UniqueTempRegisteredWithinMonth { get; set; } = null!;
[Column("___registeredWithinMonth")] public short RegisteredWithinMonth { get; set; }
[Column("unique_temp___registeredWithinYear", TypeName = "character varying[]")]
public List<string> UniqueTempRegisteredWithinYear { get; set; } = null!;
[Column("___registeredWithinYear")] public short RegisteredWithinYear { get; set; }
[Column("unique_temp___registeredOutsideWeek", TypeName = "character varying[]")]
public List<string> UniqueTempRegisteredOutsideWeek { get; set; } = null!;
[Column("___registeredOutsideWeek")] public short RegisteredOutsideWeek { get; set; }
[Column("unique_temp___registeredOutsideMonth", TypeName = "character varying[]")]
public List<string> UniqueTempRegisteredOutsideMonth { get; set; } = null!;
[Column("___registeredOutsideMonth")] public short RegisteredOutsideMonth { get; set; }
[Column("unique_temp___registeredOutsideYear", TypeName = "character varying[]")]
public List<string> UniqueTempRegisteredOutsideYear { get; set; } = null!;
[Column("___registeredOutsideYear")] public short RegisteredOutsideYear { get; set; }
[Column("___readWrite")] public short ReadWrite { get; set; }
[Column("unique_temp___read", TypeName = "character varying[]")]
public List<string> UniqueTempRead { get; set; } = null!;
[Column("___read")] public short Read { get; set; }
[Column("unique_temp___write", TypeName = "character varying[]")]
public List<string> UniqueTempWrite { get; set; } = null!;
[Column("___write")] public short Write { get; set; }
}

View file

@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart_day__ap_request")]
[Index("Date", Name = "IDX_a848f66d6cec11980a5dd59582", IsUnique = true)]
[Index("Date", Name = "UQ_a848f66d6cec11980a5dd595822", IsUnique = true)]
public class ChartDayApRequest {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("___deliverFailed")] public int DeliverFailed { get; set; }
[Column("___deliverSucceeded")] public int DeliverSucceeded { get; set; }
[Column("___inboxReceived")] public int InboxReceived { get; set; }
}

View file

@ -0,0 +1,30 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart_day__drive")]
[Index("Date", Name = "IDX_0b60ebb3aa0065f10b0616c117", IsUnique = true)]
[Index("Date", Name = "UQ_0b60ebb3aa0065f10b0616c1171", IsUnique = true)]
public class ChartDayDrive {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("___local_incCount")] public int LocalIncCount { get; set; }
[Column("___local_incSize")] public int LocalIncSize { get; set; }
[Column("___local_decCount")] public int LocalDecCount { get; set; }
[Column("___local_decSize")] public int LocalDecSize { get; set; }
[Column("___remote_incCount")] public int RemoteIncCount { get; set; }
[Column("___remote_incSize")] public int RemoteIncSize { get; set; }
[Column("___remote_decCount")] public int RemoteDecCount { get; set; }
[Column("___remote_decSize")] public int RemoteDecSize { get; set; }
}

View file

@ -0,0 +1,39 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart_day__federation")]
[Index("Date", Name = "IDX_617a8fe225a6e701d89e02d2c7", IsUnique = true)]
[Index("Date", Name = "UQ_617a8fe225a6e701d89e02d2c74", IsUnique = true)]
public class ChartDayFederation {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("unique_temp___deliveredInstances", TypeName = "character varying[]")]
public List<string> UniqueTempDeliveredInstances { get; set; } = null!;
[Column("___deliveredInstances")] public short DeliveredInstances { get; set; }
[Column("unique_temp___inboxInstances", TypeName = "character varying[]")]
public List<string> UniqueTempInboxInstances { get; set; } = null!;
[Column("___inboxInstances")] public short InboxInstances { get; set; }
[Column("unique_temp___stalled", TypeName = "character varying[]")]
public List<string> UniqueTempStalled { get; set; } = null!;
[Column("___stalled")] public short Stalled { get; set; }
[Column("___sub")] public short Sub { get; set; }
[Column("___pub")] public short Pub { get; set; }
[Column("___pubsub")] public short Pubsub { get; set; }
[Column("___subActive")] public short SubActive { get; set; }
[Column("___pubActive")] public short PubActive { get; set; }
}

View file

@ -0,0 +1,26 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart_day__hashtag")]
[Index("Date", "Group", Name = "IDX_8f589cf056ff51f09d6096f645", IsUnique = true)]
[Index("Date", "Group", Name = "UQ_8f589cf056ff51f09d6096f6450", IsUnique = true)]
public class ChartDayHashtag {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("group")] [StringLength(128)] public string Group { get; set; } = null!;
[Column("___local_users")] public int LocalUsers { get; set; }
[Column("___remote_users")] public int RemoteUsers { get; set; }
[Column("unique_temp___local_users", TypeName = "character varying[]")]
public List<string> UniqueTempLocalUsers { get; set; } = null!;
[Column("unique_temp___remote_users", TypeName = "character varying[]")]
public List<string> UniqueTempRemoteUsers { get; set; } = null!;
}

View file

@ -0,0 +1,64 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart_day__instance")]
[Index("Date", "Group", Name = "IDX_fea7c0278325a1a2492f2d6acb", IsUnique = true)]
[Index("Date", "Group", Name = "UQ_fea7c0278325a1a2492f2d6acbf", IsUnique = true)]
public class ChartDayInstance {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("group")] [StringLength(128)] public string Group { get; set; } = null!;
[Column("___requests_failed")] public short RequestsFailed { get; set; }
[Column("___requests_succeeded")] public short RequestsSucceeded { get; set; }
[Column("___requests_received")] public short RequestsReceived { get; set; }
[Column("___notes_total")] public int NotesTotal { get; set; }
[Column("___notes_inc")] public int NotesInc { get; set; }
[Column("___notes_dec")] public int NotesDec { get; set; }
[Column("___notes_diffs_normal")] public int NotesDiffsNormal { get; set; }
[Column("___notes_diffs_reply")] public int NotesDiffsReply { get; set; }
[Column("___notes_diffs_renote")] public int NotesDiffsRenote { get; set; }
[Column("___users_total")] public int UsersTotal { get; set; }
[Column("___users_inc")] public short UsersInc { get; set; }
[Column("___users_dec")] public short UsersDec { get; set; }
[Column("___following_total")] public int FollowingTotal { get; set; }
[Column("___following_inc")] public short FollowingInc { get; set; }
[Column("___following_dec")] public short FollowingDec { get; set; }
[Column("___followers_total")] public int FollowersTotal { get; set; }
[Column("___followers_inc")] public short FollowersInc { get; set; }
[Column("___followers_dec")] public short FollowersDec { get; set; }
[Column("___drive_totalFiles")] public int DriveTotalFiles { get; set; }
[Column("___drive_incFiles")] public int DriveIncFiles { get; set; }
[Column("___drive_incUsage")] public int DriveIncUsage { get; set; }
[Column("___drive_decFiles")] public int DriveDecFiles { get; set; }
[Column("___drive_decUsage")] public int DriveDecUsage { get; set; }
[Column("___notes_diffs_withFile")] public int NotesDiffsWithFile { get; set; }
}

View file

@ -0,0 +1,24 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart_day__network")]
[Index("Date", Name = "IDX_8bfa548c2b31f9e07db113773e", IsUnique = true)]
[Index("Date", Name = "UQ_8bfa548c2b31f9e07db113773ee", IsUnique = true)]
public class ChartDayNetwork {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("___incomingRequests")] public int IncomingRequests { get; set; }
[Column("___outgoingRequests")] public int OutgoingRequests { get; set; }
[Column("___totalTime")] public int TotalTime { get; set; }
[Column("___incomingBytes")] public int IncomingBytes { get; set; }
[Column("___outgoingBytes")] public int OutgoingBytes { get; set; }
}

View file

@ -0,0 +1,42 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart_day__notes")]
[Index("Date", Name = "IDX_1a527b423ad0858a1af5a056d4", IsUnique = true)]
[Index("Date", Name = "UQ_1a527b423ad0858a1af5a056d43", IsUnique = true)]
public class ChartDayNote {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("___local_total")] public int LocalTotal { get; set; }
[Column("___local_inc")] public int LocalInc { get; set; }
[Column("___local_dec")] public int LocalDec { get; set; }
[Column("___local_diffs_normal")] public int LocalDiffsNormal { get; set; }
[Column("___local_diffs_reply")] public int LocalDiffsReply { get; set; }
[Column("___local_diffs_renote")] public int LocalDiffsRenote { get; set; }
[Column("___remote_total")] public int RemoteTotal { get; set; }
[Column("___remote_inc")] public int RemoteInc { get; set; }
[Column("___remote_dec")] public int RemoteDec { get; set; }
[Column("___remote_diffs_normal")] public int RemoteDiffsNormal { get; set; }
[Column("___remote_diffs_reply")] public int RemoteDiffsReply { get; set; }
[Column("___remote_diffs_renote")] public int RemoteDiffsRenote { get; set; }
[Column("___local_diffs_withFile")] public int LocalDiffsWithFile { get; set; }
[Column("___remote_diffs_withFile")] public int RemoteDiffsWithFile { get; set; }
}

View file

@ -0,0 +1,28 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart_day__per_user_drive")]
[Index("Date", "Group", Name = "IDX_62aa5047b5aec92524f24c701d", IsUnique = true)]
[Index("Date", "Group", Name = "UQ_62aa5047b5aec92524f24c701d7", IsUnique = true)]
public class ChartDayPerUserDrive {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("group")] [StringLength(128)] public string Group { get; set; } = null!;
[Column("___totalCount")] public int TotalCount { get; set; }
[Column("___totalSize")] public int TotalSize { get; set; }
[Column("___incCount")] public short IncCount { get; set; }
[Column("___incSize")] public int IncSize { get; set; }
[Column("___decCount")] public short DecCount { get; set; }
[Column("___decSize")] public int DecSize { get; set; }
}

View file

@ -0,0 +1,40 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart_day__per_user_following")]
[Index("Date", "Group", Name = "IDX_e4849a3231f38281280ea4c0ee", IsUnique = true)]
[Index("Date", "Group", Name = "UQ_e4849a3231f38281280ea4c0eee", IsUnique = true)]
public class ChartDayPerUserFollowing {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("group")] [StringLength(128)] public string Group { get; set; } = null!;
[Column("___local_followings_total")] public int LocalFollowingsTotal { get; set; }
[Column("___local_followings_inc")] public short LocalFollowingsInc { get; set; }
[Column("___local_followings_dec")] public short LocalFollowingsDec { get; set; }
[Column("___local_followers_total")] public int LocalFollowersTotal { get; set; }
[Column("___local_followers_inc")] public short LocalFollowersInc { get; set; }
[Column("___local_followers_dec")] public short LocalFollowersDec { get; set; }
[Column("___remote_followings_total")] public int RemoteFollowingsTotal { get; set; }
[Column("___remote_followings_inc")] public short RemoteFollowingsInc { get; set; }
[Column("___remote_followings_dec")] public short RemoteFollowingsDec { get; set; }
[Column("___remote_followers_total")] public int RemoteFollowersTotal { get; set; }
[Column("___remote_followers_inc")] public short RemoteFollowersInc { get; set; }
[Column("___remote_followers_dec")] public short RemoteFollowersDec { get; set; }
}

View file

@ -0,0 +1,30 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart_day__per_user_notes")]
[Index("Date", "Group", Name = "IDX_c5545d4b31cdc684034e33b81c", IsUnique = true)]
[Index("Date", "Group", Name = "UQ_c5545d4b31cdc684034e33b81c3", IsUnique = true)]
public class ChartDayPerUserNote {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("group")] [StringLength(128)] public string Group { get; set; } = null!;
[Column("___total")] public int Total { get; set; }
[Column("___inc")] public short Inc { get; set; }
[Column("___dec")] public short Dec { get; set; }
[Column("___diffs_normal")] public short DiffsNormal { get; set; }
[Column("___diffs_reply")] public short DiffsReply { get; set; }
[Column("___diffs_renote")] public short DiffsRenote { get; set; }
[Column("___diffs_withFile")] public short DiffsWithFile { get; set; }
}

View file

@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart_day__per_user_reaction")]
[Index("Date", "Group", Name = "IDX_d54b653660d808b118e36c184c", IsUnique = true)]
[Index("Date", "Group", Name = "UQ_d54b653660d808b118e36c184c0", IsUnique = true)]
public class ChartDayPerUserReaction {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("group")] [StringLength(128)] public string Group { get; set; } = null!;
[Column("___local_count")] public short LocalCount { get; set; }
[Column("___remote_count")] public short RemoteCount { get; set; }
}

View file

@ -0,0 +1,26 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart_day__users")]
[Index("Date", Name = "IDX_cad6e07c20037f31cdba8a350c", IsUnique = true)]
[Index("Date", Name = "UQ_cad6e07c20037f31cdba8a350c3", IsUnique = true)]
public class ChartDayUser {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("___local_total")] public int LocalTotal { get; set; }
[Column("___local_inc")] public short LocalInc { get; set; }
[Column("___local_dec")] public short LocalDec { get; set; }
[Column("___remote_total")] public int RemoteTotal { get; set; }
[Column("___remote_inc")] public short RemoteInc { get; set; }
[Column("___remote_dec")] public short RemoteDec { get; set; }
}

View file

@ -0,0 +1,30 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart__drive")]
[Index("Date", Name = "IDX_13565815f618a1ff53886c5b28", IsUnique = true)]
[Index("Date", Name = "UQ_13565815f618a1ff53886c5b28a", IsUnique = true)]
public class ChartDrive {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("___local_incCount")] public int LocalIncCount { get; set; }
[Column("___local_incSize")] public int LocalIncSize { get; set; }
[Column("___local_decCount")] public int LocalDecCount { get; set; }
[Column("___local_decSize")] public int LocalDecSize { get; set; }
[Column("___remote_incCount")] public int RemoteIncCount { get; set; }
[Column("___remote_incSize")] public int RemoteIncSize { get; set; }
[Column("___remote_decCount")] public int RemoteDecCount { get; set; }
[Column("___remote_decSize")] public int RemoteDecSize { get; set; }
}

View file

@ -0,0 +1,39 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart__federation")]
[Index("Date", Name = "IDX_36cb699c49580d4e6c2e6159f9", IsUnique = true)]
[Index("Date", Name = "UQ_36cb699c49580d4e6c2e6159f97", IsUnique = true)]
public class ChartFederation {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("unique_temp___deliveredInstances", TypeName = "character varying[]")]
public List<string> UniqueTempDeliveredInstances { get; set; } = null!;
[Column("___deliveredInstances")] public short DeliveredInstances { get; set; }
[Column("unique_temp___inboxInstances", TypeName = "character varying[]")]
public List<string> UniqueTempInboxInstances { get; set; } = null!;
[Column("___inboxInstances")] public short InboxInstances { get; set; }
[Column("unique_temp___stalled", TypeName = "character varying[]")]
public List<string> UniqueTempStalled { get; set; } = null!;
[Column("___stalled")] public short Stalled { get; set; }
[Column("___sub")] public short Sub { get; set; }
[Column("___pub")] public short Pub { get; set; }
[Column("___pubsub")] public short Pubsub { get; set; }
[Column("___subActive")] public short SubActive { get; set; }
[Column("___pubActive")] public short PubActive { get; set; }
}

View file

@ -0,0 +1,26 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart__hashtag")]
[Index("Date", "Group", Name = "IDX_25a97c02003338124b2b75fdbc", IsUnique = true)]
[Index("Date", "Group", Name = "UQ_25a97c02003338124b2b75fdbc8", IsUnique = true)]
public class ChartHashtag {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("group")] [StringLength(128)] public string Group { get; set; } = null!;
[Column("___local_users")] public int LocalUsers { get; set; }
[Column("___remote_users")] public int RemoteUsers { get; set; }
[Column("unique_temp___local_users", TypeName = "character varying[]")]
public List<string> UniqueTempLocalUsers { get; set; } = null!;
[Column("unique_temp___remote_users", TypeName = "character varying[]")]
public List<string> UniqueTempRemoteUsers { get; set; } = null!;
}

View file

@ -0,0 +1,64 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart__instance")]
[Index("Date", "Group", Name = "IDX_39ee857ab2f23493037c6b6631", IsUnique = true)]
[Index("Date", "Group", Name = "UQ_39ee857ab2f23493037c6b66311", IsUnique = true)]
public class ChartInstance {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("group")] [StringLength(128)] public string Group { get; set; } = null!;
[Column("___requests_failed")] public short RequestsFailed { get; set; }
[Column("___requests_succeeded")] public short RequestsSucceeded { get; set; }
[Column("___requests_received")] public short RequestsReceived { get; set; }
[Column("___notes_total")] public int NotesTotal { get; set; }
[Column("___notes_inc")] public int NotesInc { get; set; }
[Column("___notes_dec")] public int NotesDec { get; set; }
[Column("___notes_diffs_normal")] public int NotesDiffsNormal { get; set; }
[Column("___notes_diffs_reply")] public int NotesDiffsReply { get; set; }
[Column("___notes_diffs_renote")] public int NotesDiffsRenote { get; set; }
[Column("___users_total")] public int UsersTotal { get; set; }
[Column("___users_inc")] public short UsersInc { get; set; }
[Column("___users_dec")] public short UsersDec { get; set; }
[Column("___following_total")] public int FollowingTotal { get; set; }
[Column("___following_inc")] public short FollowingInc { get; set; }
[Column("___following_dec")] public short FollowingDec { get; set; }
[Column("___followers_total")] public int FollowersTotal { get; set; }
[Column("___followers_inc")] public short FollowersInc { get; set; }
[Column("___followers_dec")] public short FollowersDec { get; set; }
[Column("___drive_totalFiles")] public int DriveTotalFiles { get; set; }
[Column("___drive_incFiles")] public int DriveIncFiles { get; set; }
[Column("___drive_incUsage")] public int DriveIncUsage { get; set; }
[Column("___drive_decFiles")] public int DriveDecFiles { get; set; }
[Column("___drive_decUsage")] public int DriveDecUsage { get; set; }
[Column("___notes_diffs_withFile")] public int NotesDiffsWithFile { get; set; }
}

View file

@ -0,0 +1,24 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart__network")]
[Index("Date", Name = "IDX_a1efd3e0048a5f2793a47360dc", IsUnique = true)]
[Index("Date", Name = "UQ_a1efd3e0048a5f2793a47360dc6", IsUnique = true)]
public class ChartNetwork {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("___incomingRequests")] public int IncomingRequests { get; set; }
[Column("___outgoingRequests")] public int OutgoingRequests { get; set; }
[Column("___totalTime")] public int TotalTime { get; set; }
[Column("___incomingBytes")] public int IncomingBytes { get; set; }
[Column("___outgoingBytes")] public int OutgoingBytes { get; set; }
}

View file

@ -0,0 +1,42 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart__notes")]
[Index("Date", Name = "IDX_42eb716a37d381cdf566192b2b", IsUnique = true)]
[Index("Date", Name = "UQ_42eb716a37d381cdf566192b2be", IsUnique = true)]
public class ChartNote {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("___local_total")] public int LocalTotal { get; set; }
[Column("___local_inc")] public int LocalInc { get; set; }
[Column("___local_dec")] public int LocalDec { get; set; }
[Column("___local_diffs_normal")] public int LocalDiffsNormal { get; set; }
[Column("___local_diffs_reply")] public int LocalDiffsReply { get; set; }
[Column("___local_diffs_renote")] public int LocalDiffsRenote { get; set; }
[Column("___remote_total")] public int RemoteTotal { get; set; }
[Column("___remote_inc")] public int RemoteInc { get; set; }
[Column("___remote_dec")] public int RemoteDec { get; set; }
[Column("___remote_diffs_normal")] public int RemoteDiffsNormal { get; set; }
[Column("___remote_diffs_reply")] public int RemoteDiffsReply { get; set; }
[Column("___remote_diffs_renote")] public int RemoteDiffsRenote { get; set; }
[Column("___local_diffs_withFile")] public int LocalDiffsWithFile { get; set; }
[Column("___remote_diffs_withFile")] public int RemoteDiffsWithFile { get; set; }
}

View file

@ -0,0 +1,28 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart__per_user_drive")]
[Index("Date", "Group", Name = "IDX_30bf67687f483ace115c5ca642", IsUnique = true)]
[Index("Date", "Group", Name = "UQ_30bf67687f483ace115c5ca6429", IsUnique = true)]
public class ChartPerUserDrive {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("group")] [StringLength(128)] public string Group { get; set; } = null!;
[Column("___totalCount")] public int TotalCount { get; set; }
[Column("___totalSize")] public int TotalSize { get; set; }
[Column("___incCount")] public short IncCount { get; set; }
[Column("___incSize")] public int IncSize { get; set; }
[Column("___decCount")] public short DecCount { get; set; }
[Column("___decSize")] public int DecSize { get; set; }
}

View file

@ -0,0 +1,40 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart__per_user_following")]
[Index("Date", "Group", Name = "IDX_b77d4dd9562c3a899d9a286fcd", IsUnique = true)]
[Index("Date", "Group", Name = "UQ_b77d4dd9562c3a899d9a286fcd7", IsUnique = true)]
public class ChartPerUserFollowing {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("group")] [StringLength(128)] public string Group { get; set; } = null!;
[Column("___local_followings_total")] public int LocalFollowingsTotal { get; set; }
[Column("___local_followings_inc")] public short LocalFollowingsInc { get; set; }
[Column("___local_followings_dec")] public short LocalFollowingsDec { get; set; }
[Column("___local_followers_total")] public int LocalFollowersTotal { get; set; }
[Column("___local_followers_inc")] public short LocalFollowersInc { get; set; }
[Column("___local_followers_dec")] public short LocalFollowersDec { get; set; }
[Column("___remote_followings_total")] public int RemoteFollowingsTotal { get; set; }
[Column("___remote_followings_inc")] public short RemoteFollowingsInc { get; set; }
[Column("___remote_followings_dec")] public short RemoteFollowingsDec { get; set; }
[Column("___remote_followers_total")] public int RemoteFollowersTotal { get; set; }
[Column("___remote_followers_inc")] public short RemoteFollowersInc { get; set; }
[Column("___remote_followers_dec")] public short RemoteFollowersDec { get; set; }
}

View file

@ -0,0 +1,30 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart__per_user_notes")]
[Index("Date", "Group", Name = "IDX_5048e9daccbbbc6d567bb142d3", IsUnique = true)]
[Index("Date", "Group", Name = "UQ_5048e9daccbbbc6d567bb142d34", IsUnique = true)]
public class ChartPerUserNote {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("group")] [StringLength(128)] public string Group { get; set; } = null!;
[Column("___total")] public int Total { get; set; }
[Column("___inc")] public short Inc { get; set; }
[Column("___dec")] public short Dec { get; set; }
[Column("___diffs_normal")] public short DiffsNormal { get; set; }
[Column("___diffs_reply")] public short DiffsReply { get; set; }
[Column("___diffs_renote")] public short DiffsRenote { get; set; }
[Column("___diffs_withFile")] public short DiffsWithFile { get; set; }
}

View file

@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart__per_user_reaction")]
[Index("Date", "Group", Name = "IDX_229a41ad465f9205f1f5703291", IsUnique = true)]
[Index("Date", "Group", Name = "UQ_229a41ad465f9205f1f57032910", IsUnique = true)]
public class ChartPerUserReaction {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("group")] [StringLength(128)] public string Group { get; set; } = null!;
[Column("___local_count")] public short LocalCount { get; set; }
[Column("___remote_count")] public short RemoteCount { get; set; }
}

View file

@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart__test")]
[Index("Date", "Group", Name = "IDX_a319e5dbf47e8a17497623beae", IsUnique = true)]
public class ChartTest {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("group")] [StringLength(128)] public string? Group { get; set; }
[Column("___foo_total")] public long FooTotal { get; set; }
[Column("___foo_inc")] public long FooInc { get; set; }
[Column("___foo_dec")] public long FooDec { get; set; }
}

View file

@ -0,0 +1,21 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart__test_grouped")]
[Index("Date", "Group", Name = "IDX_b14489029e4b3aaf4bba5fb524", IsUnique = true)]
public class ChartTestGrouped {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("group")] [StringLength(128)] public string? Group { get; set; }
[Column("___foo_total")] public long FooTotal { get; set; }
[Column("___foo_inc")] public long FooInc { get; set; }
[Column("___foo_dec")] public long FooDec { get; set; }
}

View file

@ -0,0 +1,18 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart__test_unique")]
[Index("Date", "Group", Name = "IDX_a0cd75442dd10d0643a17c4a49", IsUnique = true)]
public class ChartTestUnique {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("group")] [StringLength(128)] public string? Group { get; set; }
[Column("___foo", TypeName = "character varying[]")]
public List<string> Foo { get; set; } = null!;
}

View file

@ -0,0 +1,26 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("__chart__users")]
[Index("Date", Name = "IDX_845254b3eaf708ae8a6cac3026", IsUnique = true)]
[Index("Date", Name = "UQ_845254b3eaf708ae8a6cac30265", IsUnique = true)]
public class ChartUser {
[Key] [Column("id")] public int Id { get; set; }
[Column("date")] public int Date { get; set; }
[Column("___local_total")] public int LocalTotal { get; set; }
[Column("___local_inc")] public short LocalInc { get; set; }
[Column("___local_dec")] public short LocalDec { get; set; }
[Column("___remote_total")] public int RemoteTotal { get; set; }
[Column("___remote_inc")] public short RemoteInc { get; set; }
[Column("___remote_dec")] public short RemoteDec { get; set; }
}

View file

@ -0,0 +1,49 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("clip")]
[Index("UserId", Name = "IDX_2b5ec6c574d6802c94c80313fb")]
public class Clip {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the Clip.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// The owner ID.
/// </summary>
[Column("userId")]
[StringLength(32)]
public string UserId { get; set; } = null!;
/// <summary>
/// The name of the Clip.
/// </summary>
[Column("name")]
[StringLength(128)]
public string Name { get; set; } = null!;
[Column("isPublic")] public bool IsPublic { get; set; }
/// <summary>
/// The description of the Clip.
/// </summary>
[Column("description")]
[StringLength(2048)]
public string? Description { get; set; }
[InverseProperty("Clip")] public virtual ICollection<ClipNote> ClipNotes { get; set; } = new List<ClipNote>();
[ForeignKey("UserId")]
[InverseProperty("Clips")]
public virtual User User { get; set; } = null!;
}

View file

@ -0,0 +1,38 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("clip_note")]
[Index("NoteId", "ClipId", Name = "IDX_6fc0ec357d55a18646262fdfff", IsUnique = true)]
[Index("NoteId", Name = "IDX_a012eaf5c87c65da1deb5fdbfa")]
[Index("ClipId", Name = "IDX_ebe99317bbbe9968a0c6f579ad")]
public class ClipNote {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The note ID.
/// </summary>
[Column("noteId")]
[StringLength(32)]
public string NoteId { get; set; } = null!;
/// <summary>
/// The clip ID.
/// </summary>
[Column("clipId")]
[StringLength(32)]
public string ClipId { get; set; } = null!;
[ForeignKey("ClipId")]
[InverseProperty("ClipNotes")]
public virtual Clip Clip { get; set; } = null!;
[ForeignKey("NoteId")]
[InverseProperty("ClipNotes")]
public virtual Note Note { get; set; } = null!;
}

View file

@ -0,0 +1,186 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("drive_file")]
[Index("IsLink", Name = "IDX_315c779174fe8247ab324f036e")]
[Index("Md5", Name = "IDX_37bb9a1b4585f8a3beb24c62d6")]
[Index("UserId", "FolderId", "Id", Name = "IDX_55720b33a61a7c806a8215b825")]
[Index("UserId", Name = "IDX_860fa6f6c7df5bb887249fba22")]
[Index("UserHost", Name = "IDX_92779627994ac79277f070c91e")]
[Index("Type", Name = "IDX_a40b8df8c989d7db937ea27cf6")]
[Index("IsSensitive", Name = "IDX_a7eba67f8b3fa27271e85d2e26")]
[Index("FolderId", Name = "IDX_bb90d1956dafc4068c28aa7560")]
[Index("WebpublicAccessKey", Name = "IDX_c55b2b7c284d9fef98026fc88e", IsUnique = true)]
[Index("CreatedAt", Name = "IDX_c8dfad3b72196dd1d6b5db168a")]
[Index("AccessKey", Name = "IDX_d85a184c2540d2deba33daf642", IsUnique = true)]
[Index("Uri", Name = "IDX_e5848eac4940934e23dbc17581")]
[Index("ThumbnailAccessKey", Name = "IDX_e74022ce9a074b3866f70e0d27", IsUnique = true)]
public class DriveFile {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the DriveFile.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// The owner ID.
/// </summary>
[Column("userId")]
[StringLength(32)]
public string? UserId { get; set; }
/// <summary>
/// The host of owner. It will be null if the user in local.
/// </summary>
[Column("userHost")]
[StringLength(512)]
public string? UserHost { get; set; }
/// <summary>
/// The MD5 hash of the DriveFile.
/// </summary>
[Column("md5")]
[StringLength(32)]
public string Md5 { get; set; } = null!;
/// <summary>
/// The file name of the DriveFile.
/// </summary>
[Column("name")]
[StringLength(256)]
public string Name { get; set; } = null!;
/// <summary>
/// The content type (MIME) of the DriveFile.
/// </summary>
[Column("type")]
[StringLength(128)]
public string Type { get; set; } = null!;
/// <summary>
/// The file size (bytes) of the DriveFile.
/// </summary>
[Column("size")]
public int Size { get; set; }
/// <summary>
/// The comment of the DriveFile.
/// </summary>
[Column("comment")]
[StringLength(8192)]
public string? Comment { get; set; }
/// <summary>
/// The any properties of the DriveFile. For example, it includes image width/height.
/// </summary>
[Column("properties", TypeName = "jsonb")]
public string Properties { get; set; } = null!;
[Column("storedInternal")] public bool StoredInternal { get; set; }
/// <summary>
/// The URL of the DriveFile.
/// </summary>
[Column("url")]
[StringLength(512)]
public string Url { get; set; } = null!;
/// <summary>
/// The URL of the thumbnail of the DriveFile.
/// </summary>
[Column("thumbnailUrl")]
[StringLength(512)]
public string? ThumbnailUrl { get; set; }
/// <summary>
/// The URL of the webpublic of the DriveFile.
/// </summary>
[Column("webpublicUrl")]
[StringLength(512)]
public string? WebpublicUrl { get; set; }
[Column("accessKey")]
[StringLength(256)]
public string? AccessKey { get; set; }
[Column("thumbnailAccessKey")]
[StringLength(256)]
public string? ThumbnailAccessKey { get; set; }
[Column("webpublicAccessKey")]
[StringLength(256)]
public string? WebpublicAccessKey { get; set; }
/// <summary>
/// The URI of the DriveFile. it will be null when the DriveFile is local.
/// </summary>
[Column("uri")]
[StringLength(512)]
public string? Uri { get; set; }
[Column("src")] [StringLength(512)] public string? Src { get; set; }
/// <summary>
/// The parent folder ID. If null, it means the DriveFile is located in root.
/// </summary>
[Column("folderId")]
[StringLength(32)]
public string? FolderId { get; set; }
/// <summary>
/// Whether the DriveFile is NSFW.
/// </summary>
[Column("isSensitive")]
public bool IsSensitive { get; set; }
/// <summary>
/// Whether the DriveFile is direct link to remote server.
/// </summary>
[Column("isLink")]
public bool IsLink { get; set; }
/// <summary>
/// The BlurHash string.
/// </summary>
[Column("blurhash")]
[StringLength(128)]
public string? Blurhash { get; set; }
[Column("webpublicType")]
[StringLength(128)]
public string? WebpublicType { get; set; }
[Column("requestHeaders", TypeName = "jsonb")]
public string? RequestHeaders { get; set; }
[Column("requestIp")]
[StringLength(128)]
public string? RequestIp { get; set; }
[InverseProperty("Banner")] public virtual ICollection<Channel> Channels { get; set; } = new List<Channel>();
[ForeignKey("FolderId")]
[InverseProperty("DriveFiles")]
public virtual DriveFolder? Folder { get; set; }
[InverseProperty("File")]
public virtual ICollection<MessagingMessage> MessagingMessages { get; set; } = new List<MessagingMessage>();
[InverseProperty("EyeCatchingImage")] public virtual ICollection<Page> Pages { get; set; } = new List<Page>();
[ForeignKey("UserId")]
[InverseProperty("DriveFiles")]
public virtual User? User { get; set; }
[InverseProperty("Avatar")] public virtual User? UserAvatar { get; set; }
[InverseProperty("Banner")] public virtual User? UserBanner { get; set; }
}

View file

@ -0,0 +1,56 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("drive_folder")]
[Index("ParentId", Name = "IDX_00ceffb0cdc238b3233294f08f")]
[Index("CreatedAt", Name = "IDX_02878d441ceae15ce060b73daf")]
[Index("UserId", Name = "IDX_f4fc06e49c0171c85f1c48060d")]
public class DriveFolder {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the DriveFolder.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// The name of the DriveFolder.
/// </summary>
[Column("name")]
[StringLength(128)]
public string Name { get; set; } = null!;
/// <summary>
/// The owner ID.
/// </summary>
[Column("userId")]
[StringLength(32)]
public string? UserId { get; set; }
/// <summary>
/// The parent folder ID. If null, it means the DriveFolder is located in root.
/// </summary>
[Column("parentId")]
[StringLength(32)]
public string? ParentId { get; set; }
[InverseProperty("Folder")] public virtual ICollection<DriveFile> DriveFiles { get; set; } = new List<DriveFile>();
[InverseProperty("Parent")]
public virtual ICollection<DriveFolder> InverseParent { get; set; } = new List<DriveFolder>();
[ForeignKey("ParentId")]
[InverseProperty("InverseParent")]
public virtual DriveFolder? Parent { get; set; }
[ForeignKey("UserId")]
[InverseProperty("DriveFolders")]
public virtual User? User { get; set; }
}

View file

@ -0,0 +1,57 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("emoji")]
[Index("Name", "Host", Name = "IDX_4f4d35e1256c84ae3d1f0eab10", IsUnique = true)]
[Index("Host", Name = "IDX_5900e907bb46516ddf2871327c")]
[Index("Name", Name = "IDX_b37dafc86e9af007e3295c2781")]
public class Emoji {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
[Column("updatedAt")] public DateTime? UpdatedAt { get; set; }
[Column("name")] [StringLength(128)] public string Name { get; set; } = null!;
[Column("host")] [StringLength(512)] public string? Host { get; set; }
[Column("originalUrl")]
[StringLength(512)]
public string OriginalUrl { get; set; } = null!;
[Column("uri")] [StringLength(512)] public string? Uri { get; set; }
[Column("type")] [StringLength(64)] public string? Type { get; set; }
[Column("aliases", TypeName = "character varying(128)[]")]
public List<string> Aliases { get; set; } = null!;
[Column("category")]
[StringLength(128)]
public string? Category { get; set; }
[Column("publicUrl")]
[StringLength(512)]
public string PublicUrl { get; set; } = null!;
[Column("license")]
[StringLength(1024)]
public string? License { get; set; }
/// <summary>
/// Image width
/// </summary>
[Column("width")]
public int? Width { get; set; }
/// <summary>
/// Image height
/// </summary>
[Column("height")]
public int? Height { get; set; }
}

View file

@ -0,0 +1,96 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("follow_request")]
[Index("FolloweeId", Name = "IDX_12c01c0d1a79f77d9f6c15fadd")]
[Index("FollowerId", Name = "IDX_a7fd92dd6dc519e6fb435dd108")]
[Index("FollowerId", "FolloweeId", Name = "IDX_d54a512b822fac7ed52800f6b4", IsUnique = true)]
public class FollowRequest {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the FollowRequest.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// The followee user ID.
/// </summary>
[Column("followeeId")]
[StringLength(32)]
public string FolloweeId { get; set; } = null!;
/// <summary>
/// The follower user ID.
/// </summary>
[Column("followerId")]
[StringLength(32)]
public string FollowerId { get; set; } = null!;
/// <summary>
/// id of Follow Activity.
/// </summary>
[Column("requestId")]
[StringLength(128)]
public string? RequestId { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("followerHost")]
[StringLength(512)]
public string? FollowerHost { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("followerInbox")]
[StringLength(512)]
public string? FollowerInbox { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("followerSharedInbox")]
[StringLength(512)]
public string? FollowerSharedInbox { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("followeeHost")]
[StringLength(512)]
public string? FolloweeHost { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("followeeInbox")]
[StringLength(512)]
public string? FolloweeInbox { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("followeeSharedInbox")]
[StringLength(512)]
public string? FolloweeSharedInbox { get; set; }
[ForeignKey("FolloweeId")]
[InverseProperty("FollowRequestFollowees")]
public virtual User Followee { get; set; } = null!;
[ForeignKey("FollowerId")]
[InverseProperty("FollowRequestFollowers")]
public virtual User Follower { get; set; } = null!;
[InverseProperty("FollowRequest")]
public virtual ICollection<Notification> Notifications { get; set; } = new List<Notification>();
}

View file

@ -0,0 +1,89 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("following")]
[Index("FolloweeId", Name = "IDX_24e0042143a18157b234df186c")]
[Index("FollowerId", "FolloweeId", Name = "IDX_307be5f1d1252e0388662acb96", IsUnique = true)]
[Index("FollowerHost", Name = "IDX_4ccd2239268ebbd1b35e318754")]
[Index("CreatedAt", Name = "IDX_582f8fab771a9040a12961f3e7")]
[Index("FollowerId", Name = "IDX_6516c5a6f3c015b4eed39978be")]
[Index("FolloweeHost", Name = "IDX_fcdafee716dfe9c3b5fde90f30")]
public class Following {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the Following.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// The followee user ID.
/// </summary>
[Column("followeeId")]
[StringLength(32)]
public string FolloweeId { get; set; } = null!;
/// <summary>
/// The follower user ID.
/// </summary>
[Column("followerId")]
[StringLength(32)]
public string FollowerId { get; set; } = null!;
/// <summary>
/// [Denormalized]
/// </summary>
[Column("followerHost")]
[StringLength(512)]
public string? FollowerHost { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("followerInbox")]
[StringLength(512)]
public string? FollowerInbox { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("followerSharedInbox")]
[StringLength(512)]
public string? FollowerSharedInbox { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("followeeHost")]
[StringLength(512)]
public string? FolloweeHost { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("followeeInbox")]
[StringLength(512)]
public string? FolloweeInbox { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("followeeSharedInbox")]
[StringLength(512)]
public string? FolloweeSharedInbox { get; set; }
[ForeignKey("FolloweeId")]
[InverseProperty("FollowingFollowees")]
public virtual User Followee { get; set; } = null!;
[ForeignKey("FollowerId")]
[InverseProperty("FollowingFollowers")]
public virtual User Follower { get; set; } = null!;
}

View file

@ -0,0 +1,29 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("gallery_like")]
[Index("UserId", Name = "IDX_8fd5215095473061855ceb948c")]
[Index("UserId", "PostId", Name = "IDX_df1b5f4099e99fb0bc5eae53b6", IsUnique = true)]
public class GalleryLike {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
[Column("createdAt")] public DateTime CreatedAt { get; set; }
[Column("userId")] [StringLength(32)] public string UserId { get; set; } = null!;
[Column("postId")] [StringLength(32)] public string PostId { get; set; } = null!;
[ForeignKey("PostId")]
[InverseProperty("GalleryLikes")]
public virtual GalleryPost Post { get; set; } = null!;
[ForeignKey("UserId")]
[InverseProperty("GalleryLikes")]
public virtual User User { get; set; } = null!;
}

View file

@ -0,0 +1,66 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("gallery_post")]
[Index("Tags", Name = "IDX_05cca34b985d1b8edc1d1e28df")]
[Index("LikedCount", Name = "IDX_1a165c68a49d08f11caffbd206")]
[Index("FileIds", Name = "IDX_3ca50563facd913c425e7a89ee")]
[Index("CreatedAt", Name = "IDX_8f1a239bd077c8864a20c62c2c")]
[Index("UserId", Name = "IDX_985b836dddd8615e432d7043dd")]
[Index("IsSensitive", Name = "IDX_f2d744d9a14d0dfb8b96cb7fc5")]
[Index("UpdatedAt", Name = "IDX_f631d37835adb04792e361807c")]
public class GalleryPost {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the GalleryPost.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// The updated date of the GalleryPost.
/// </summary>
[Column("updatedAt")]
public DateTime UpdatedAt { get; set; }
[Column("title")] [StringLength(256)] public string Title { get; set; } = null!;
[Column("description")]
[StringLength(2048)]
public string? Description { get; set; }
/// <summary>
/// The ID of author.
/// </summary>
[Column("userId")]
[StringLength(32)]
public string UserId { get; set; } = null!;
[Column("fileIds", TypeName = "character varying(32)[]")]
public List<string> FileIds { get; set; } = null!;
/// <summary>
/// Whether the post is sensitive.
/// </summary>
[Column("isSensitive")]
public bool IsSensitive { get; set; }
[Column("likedCount")] public int LikedCount { get; set; }
[Column("tags", TypeName = "character varying(128)[]")]
public List<string> Tags { get; set; } = null!;
[InverseProperty("Post")]
public virtual ICollection<GalleryLike> GalleryLikes { get; set; } = new List<GalleryLike>();
[ForeignKey("UserId")]
[InverseProperty("GalleryPosts")]
public virtual User User { get; set; } = null!;
}

View file

@ -0,0 +1,52 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("hashtag")]
[Index("AttachedRemoteUsersCount", Name = "IDX_0b03cbcd7e6a7ce068efa8ecc2")]
[Index("AttachedLocalUsersCount", Name = "IDX_0c44bf4f680964145f2a68a341")]
[Index("MentionedLocalUsersCount", Name = "IDX_0e206cec573f1edff4a3062923")]
[Index("MentionedUsersCount", Name = "IDX_2710a55f826ee236ea1a62698f")]
[Index("Name", Name = "IDX_347fec870eafea7b26c8a73bac", IsUnique = true)]
[Index("MentionedRemoteUsersCount", Name = "IDX_4c02d38a976c3ae132228c6fce")]
[Index("AttachedUsersCount", Name = "IDX_d57f9030cd3af7f63ffb1c267c")]
public class Hashtag {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
[Column("name")] [StringLength(128)] public string Name { get; set; } = null!;
[Column("mentionedUserIds", TypeName = "character varying(32)[]")]
public List<string> MentionedUserIds { get; set; } = null!;
[Column("mentionedUsersCount")] public int MentionedUsersCount { get; set; }
[Column("mentionedLocalUserIds", TypeName = "character varying(32)[]")]
public List<string> MentionedLocalUserIds { get; set; } = null!;
[Column("mentionedLocalUsersCount")] public int MentionedLocalUsersCount { get; set; }
[Column("mentionedRemoteUserIds", TypeName = "character varying(32)[]")]
public List<string> MentionedRemoteUserIds { get; set; } = null!;
[Column("mentionedRemoteUsersCount")] public int MentionedRemoteUsersCount { get; set; }
[Column("attachedUserIds", TypeName = "character varying(32)[]")]
public List<string> AttachedUserIds { get; set; } = null!;
[Column("attachedUsersCount")] public int AttachedUsersCount { get; set; }
[Column("attachedLocalUserIds", TypeName = "character varying(32)[]")]
public List<string> AttachedLocalUserIds { get; set; } = null!;
[Column("attachedLocalUsersCount")] public int AttachedLocalUsersCount { get; set; }
[Column("attachedRemoteUserIds", TypeName = "character varying(32)[]")]
public List<string> AttachedRemoteUserIds { get; set; } = null!;
[Column("attachedRemoteUsersCount")] public int AttachedRemoteUsersCount { get; set; }
}

View file

@ -0,0 +1,20 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("html_note_cache_entry")]
public class HtmlNoteCacheEntry {
[Key]
[Column("noteId")]
[StringLength(32)]
public string NoteId { get; set; } = null!;
[Column("updatedAt")] public DateTime? UpdatedAt { get; set; }
[Column("content")] public string? Content { get; set; }
[ForeignKey("NoteId")]
[InverseProperty("HtmlNoteCacheEntry")]
public virtual Note Note { get; set; } = null!;
}

View file

@ -0,0 +1,22 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("html_user_cache_entry")]
public class HtmlUserCacheEntry {
[Key]
[Column("userId")]
[StringLength(32)]
public string UserId { get; set; } = null!;
[Column("updatedAt")] public DateTime? UpdatedAt { get; set; }
[Column("bio")] public string? Bio { get; set; }
[Column("fields", TypeName = "jsonb")] public string Fields { get; set; } = null!;
[ForeignKey("UserId")]
[InverseProperty("HtmlUserCacheEntry")]
public virtual User User { get; set; } = null!;
}

View file

@ -0,0 +1,98 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("instance")]
[Index("CaughtAt", Name = "IDX_2cd3b2a6b4cf0b910b260afe08")]
[Index("IsSuspended", Name = "IDX_34500da2e38ac393f7bb6b299c")]
[Index("Host", Name = "IDX_8d5afc98982185799b160e10eb", IsUnique = true)]
public class Instance {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The caught date of the Instance.
/// </summary>
[Column("caughtAt")]
public DateTime CaughtAt { get; set; }
/// <summary>
/// The host of the Instance.
/// </summary>
[Column("host")]
[StringLength(512)]
public string Host { get; set; } = null!;
/// <summary>
/// The count of the users of the Instance.
/// </summary>
[Column("usersCount")]
public int UsersCount { get; set; }
/// <summary>
/// The count of the notes of the Instance.
/// </summary>
[Column("notesCount")]
public int NotesCount { get; set; }
[Column("followingCount")] public int FollowingCount { get; set; }
[Column("followersCount")] public int FollowersCount { get; set; }
[Column("latestRequestSentAt")] public DateTime? LatestRequestSentAt { get; set; }
[Column("latestStatus")] public int? LatestStatus { get; set; }
[Column("latestRequestReceivedAt")] public DateTime? LatestRequestReceivedAt { get; set; }
[Column("lastCommunicatedAt")] public DateTime LastCommunicatedAt { get; set; }
[Column("isNotResponding")] public bool IsNotResponding { get; set; }
/// <summary>
/// The software of the Instance.
/// </summary>
[Column("softwareName")]
[StringLength(64)]
public string? SoftwareName { get; set; }
[Column("softwareVersion")]
[StringLength(64)]
public string? SoftwareVersion { get; set; }
[Column("openRegistrations")] public bool? OpenRegistrations { get; set; }
[Column("name")] [StringLength(256)] public string? Name { get; set; }
[Column("description")]
[StringLength(4096)]
public string? Description { get; set; }
[Column("maintainerName")]
[StringLength(128)]
public string? MaintainerName { get; set; }
[Column("maintainerEmail")]
[StringLength(256)]
public string? MaintainerEmail { get; set; }
[Column("infoUpdatedAt")] public DateTime? InfoUpdatedAt { get; set; }
[Column("isSuspended")] public bool IsSuspended { get; set; }
[Column("iconUrl")]
[StringLength(4096)]
public string? IconUrl { get; set; }
[Column("themeColor")]
[StringLength(64)]
public string? ThemeColor { get; set; }
[Column("faviconUrl")]
[StringLength(4096)]
public string? FaviconUrl { get; set; }
}

View file

@ -0,0 +1,71 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("messaging_message")]
[Index("GroupId", Name = "IDX_2c4be03b446884f9e9c502135b")]
[Index("UserId", Name = "IDX_5377c307783fce2b6d352e1203")]
[Index("RecipientId", Name = "IDX_cac14a4e3944454a5ce7daa514")]
[Index("CreatedAt", Name = "IDX_e21cd3646e52ef9c94aaf17c2e")]
public class MessagingMessage {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the MessagingMessage.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// The sender user ID.
/// </summary>
[Column("userId")]
[StringLength(32)]
public string UserId { get; set; } = null!;
/// <summary>
/// The recipient user ID.
/// </summary>
[Column("recipientId")]
[StringLength(32)]
public string? RecipientId { get; set; }
[Column("text")] [StringLength(4096)] public string? Text { get; set; }
[Column("isRead")] public bool IsRead { get; set; }
[Column("fileId")] [StringLength(32)] public string? FileId { get; set; }
/// <summary>
/// The recipient group ID.
/// </summary>
[Column("groupId")]
[StringLength(32)]
public string? GroupId { get; set; }
[Column("reads", TypeName = "character varying(32)[]")]
public List<string> Reads { get; set; } = null!;
[Column("uri")] [StringLength(512)] public string? Uri { get; set; }
[ForeignKey("FileId")]
[InverseProperty("MessagingMessages")]
public virtual DriveFile? File { get; set; }
[ForeignKey("GroupId")]
[InverseProperty("MessagingMessages")]
public virtual UserGroup? Group { get; set; }
[ForeignKey("RecipientId")]
[InverseProperty("MessagingMessageRecipients")]
public virtual User? Recipient { get; set; }
[ForeignKey("UserId")]
[InverseProperty("MessagingMessageUsers")]
public virtual User User { get; set; } = null!;
}

View file

@ -0,0 +1,285 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("meta")]
public class Metum {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
[Column("name")] [StringLength(128)] public string? Name { get; set; }
[Column("description")]
[StringLength(1024)]
public string? Description { get; set; }
[Column("maintainerName")]
[StringLength(128)]
public string? MaintainerName { get; set; }
[Column("maintainerEmail")]
[StringLength(128)]
public string? MaintainerEmail { get; set; }
[Column("disableRegistration")] public bool DisableRegistration { get; set; }
[Column("disableLocalTimeline")] public bool DisableLocalTimeline { get; set; }
[Column("disableGlobalTimeline")] public bool DisableGlobalTimeline { get; set; }
[Column("langs", TypeName = "character varying(64)[]")]
public List<string> Langs { get; set; } = null!;
[Column("hiddenTags", TypeName = "character varying(256)[]")]
public List<string> HiddenTags { get; set; } = null!;
[Column("blockedHosts", TypeName = "character varying(256)[]")]
public List<string> BlockedHosts { get; set; } = null!;
[Column("mascotImageUrl")]
[StringLength(512)]
public string? MascotImageUrl { get; set; }
[Column("bannerUrl")]
[StringLength(512)]
public string? BannerUrl { get; set; }
[Column("errorImageUrl")]
[StringLength(512)]
public string? ErrorImageUrl { get; set; }
[Column("iconUrl")]
[StringLength(512)]
public string? IconUrl { get; set; }
[Column("cacheRemoteFiles")] public bool CacheRemoteFiles { get; set; }
[Column("enableRecaptcha")] public bool EnableRecaptcha { get; set; }
[Column("recaptchaSiteKey")]
[StringLength(64)]
public string? RecaptchaSiteKey { get; set; }
[Column("recaptchaSecretKey")]
[StringLength(64)]
public string? RecaptchaSecretKey { get; set; }
/// <summary>
/// Drive capacity of a local user (MB)
/// </summary>
[Column("localDriveCapacityMb")]
public int LocalDriveCapacityMb { get; set; }
/// <summary>
/// Drive capacity of a remote user (MB)
/// </summary>
[Column("remoteDriveCapacityMb")]
public int RemoteDriveCapacityMb { get; set; }
[Column("summalyProxy")]
[StringLength(128)]
public string? SummalyProxy { get; set; }
[Column("enableEmail")] public bool EnableEmail { get; set; }
[Column("email")] [StringLength(128)] public string? Email { get; set; }
[Column("smtpSecure")] public bool SmtpSecure { get; set; }
[Column("smtpHost")]
[StringLength(128)]
public string? SmtpHost { get; set; }
[Column("smtpPort")] public int? SmtpPort { get; set; }
[Column("smtpUser")]
[StringLength(1024)]
public string? SmtpUser { get; set; }
[Column("smtpPass")]
[StringLength(1024)]
public string? SmtpPass { get; set; }
[Column("swPublicKey")]
[StringLength(128)]
public string SwPublicKey { get; set; } = null!;
[Column("swPrivateKey")]
[StringLength(128)]
public string SwPrivateKey { get; set; } = null!;
[Column("enableGithubIntegration")] public bool EnableGithubIntegration { get; set; }
[Column("githubClientId")]
[StringLength(128)]
public string? GithubClientId { get; set; }
[Column("githubClientSecret")]
[StringLength(128)]
public string? GithubClientSecret { get; set; }
[Column("enableDiscordIntegration")] public bool EnableDiscordIntegration { get; set; }
[Column("discordClientId")]
[StringLength(128)]
public string? DiscordClientId { get; set; }
[Column("discordClientSecret")]
[StringLength(128)]
public string? DiscordClientSecret { get; set; }
[Column("pinnedUsers", TypeName = "character varying(256)[]")]
public List<string> PinnedUsers { get; set; } = null!;
[Column("ToSUrl")] [StringLength(512)] public string? ToSurl { get; set; }
[Column("repositoryUrl")]
[StringLength(512)]
public string RepositoryUrl { get; set; } = null!;
[Column("feedbackUrl")]
[StringLength(512)]
public string? FeedbackUrl { get; set; }
[Column("useObjectStorage")] public bool UseObjectStorage { get; set; }
[Column("objectStorageBucket")]
[StringLength(512)]
public string? ObjectStorageBucket { get; set; }
[Column("objectStoragePrefix")]
[StringLength(512)]
public string? ObjectStoragePrefix { get; set; }
[Column("objectStorageBaseUrl")]
[StringLength(512)]
public string? ObjectStorageBaseUrl { get; set; }
[Column("objectStorageEndpoint")]
[StringLength(512)]
public string? ObjectStorageEndpoint { get; set; }
[Column("objectStorageRegion")]
[StringLength(512)]
public string? ObjectStorageRegion { get; set; }
[Column("objectStorageAccessKey")]
[StringLength(512)]
public string? ObjectStorageAccessKey { get; set; }
[Column("objectStorageSecretKey")]
[StringLength(512)]
public string? ObjectStorageSecretKey { get; set; }
[Column("objectStoragePort")] public int? ObjectStoragePort { get; set; }
[Column("objectStorageUseSSL")] public bool ObjectStorageUseSsl { get; set; }
[Column("objectStorageUseProxy")] public bool ObjectStorageUseProxy { get; set; }
[Column("enableHcaptcha")] public bool EnableHcaptcha { get; set; }
[Column("hcaptchaSiteKey")]
[StringLength(64)]
public string? HcaptchaSiteKey { get; set; }
[Column("hcaptchaSecretKey")]
[StringLength(64)]
public string? HcaptchaSecretKey { get; set; }
[Column("objectStorageSetPublicRead")] public bool ObjectStorageSetPublicRead { get; set; }
[Column("pinnedPages", TypeName = "character varying(512)[]")]
public List<string> PinnedPages { get; set; } = null!;
[Column("backgroundImageUrl")]
[StringLength(512)]
public string? BackgroundImageUrl { get; set; }
[Column("logoImageUrl")]
[StringLength(512)]
public string? LogoImageUrl { get; set; }
[Column("pinnedClipId")]
[StringLength(32)]
public string? PinnedClipId { get; set; }
[Column("objectStorageS3ForcePathStyle")]
public bool ObjectStorageS3forcePathStyle { get; set; }
[Column("allowedHosts", TypeName = "character varying(256)[]")]
public List<string> AllowedHosts { get; set; } = null!;
[Column("secureMode")] public bool SecureMode { get; set; }
[Column("privateMode")] public bool PrivateMode { get; set; }
[Column("deeplAuthKey")]
[StringLength(128)]
public string? DeeplAuthKey { get; set; }
[Column("deeplIsPro")] public bool DeeplIsPro { get; set; }
[Column("emailRequiredForSignup")] public bool EmailRequiredForSignup { get; set; }
[Column("themeColor")]
[StringLength(512)]
public string? ThemeColor { get; set; }
[Column("defaultLightTheme")]
[StringLength(8192)]
public string? DefaultLightTheme { get; set; }
[Column("defaultDarkTheme")]
[StringLength(8192)]
public string? DefaultDarkTheme { get; set; }
[Column("enableIpLogging")] public bool EnableIpLogging { get; set; }
[Column("enableActiveEmailValidation")]
public bool EnableActiveEmailValidation { get; set; }
[Column("customMOTD", TypeName = "character varying(256)[]")]
public List<string> CustomMotd { get; set; } = null!;
[Column("customSplashIcons", TypeName = "character varying(256)[]")]
public List<string> CustomSplashIcons { get; set; } = null!;
[Column("disableRecommendedTimeline")] public bool DisableRecommendedTimeline { get; set; }
[Column("recommendedInstances", TypeName = "character varying(256)[]")]
public List<string> RecommendedInstances { get; set; } = null!;
[Column("defaultReaction")]
[StringLength(256)]
public string DefaultReaction { get; set; } = null!;
[Column("libreTranslateApiUrl")]
[StringLength(512)]
public string? LibreTranslateApiUrl { get; set; }
[Column("libreTranslateApiKey")]
[StringLength(128)]
public string? LibreTranslateApiKey { get; set; }
[Column("silencedHosts", TypeName = "character varying(256)[]")]
public List<string> SilencedHosts { get; set; } = null!;
[Column("experimentalFeatures", TypeName = "jsonb")]
public string ExperimentalFeatures { get; set; } = null!;
[Column("enableServerMachineStats")] public bool EnableServerMachineStats { get; set; }
[Column("enableIdenticonGeneration")] public bool EnableIdenticonGeneration { get; set; }
[Column("donationLink")]
[StringLength(256)]
public string? DonationLink { get; set; }
[Column("autofollowedAccount")]
[StringLength(128)]
public string? AutofollowedAccount { get; set; }
}

View file

@ -0,0 +1,14 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("migrations")]
public class Migration {
[Key] [Column("id")] public int Id { get; set; }
[Column("timestamp")] public long Timestamp { get; set; }
[Column("name", TypeName = "character varying")]
public string Name { get; set; } = null!;
}

View file

@ -0,0 +1,30 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("moderation_log")]
[Index("UserId", Name = "IDX_a08ad074601d204e0f69da9a95")]
public class ModerationLog {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the ModerationLog.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
[Column("userId")] [StringLength(32)] public string UserId { get; set; } = null!;
[Column("type")] [StringLength(128)] public string Type { get; set; } = null!;
[Column("info", TypeName = "jsonb")] public string Info { get; set; } = null!;
[ForeignKey("UserId")]
[InverseProperty("ModerationLogs")]
public virtual User User { get; set; } = null!;
}

View file

@ -0,0 +1,48 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("muting")]
[Index("MuterId", "MuteeId", Name = "IDX_1eb9d9824a630321a29fd3b290", IsUnique = true)]
[Index("MuterId", Name = "IDX_93060675b4a79a577f31d260c6")]
[Index("ExpiresAt", Name = "IDX_c1fd1c3dfb0627aa36c253fd14")]
[Index("MuteeId", Name = "IDX_ec96b4fed9dae517e0dbbe0675")]
[Index("CreatedAt", Name = "IDX_f86d57fbca33c7a4e6897490cc")]
public class Muting {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the Muting.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// The mutee user ID.
/// </summary>
[Column("muteeId")]
[StringLength(32)]
public string MuteeId { get; set; } = null!;
/// <summary>
/// The muter user ID.
/// </summary>
[Column("muterId")]
[StringLength(32)]
public string MuterId { get; set; } = null!;
[Column("expiresAt")] public DateTime? ExpiresAt { get; set; }
[ForeignKey("MuteeId")]
[InverseProperty("MutingMutees")]
public virtual User Mutee { get; set; } = null!;
[ForeignKey("MuterId")]
[InverseProperty("MutingMuters")]
public virtual User Muter { get; set; } = null!;
}

View file

@ -0,0 +1,216 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("note")]
[Index("Uri", Name = "IDX_153536c67d05e9adb24e99fc2b", IsUnique = true)]
[Index("ReplyId", Name = "IDX_17cb3553c700a4985dff5a30ff")]
[Index("AttachedFileTypes", Name = "IDX_25dfc71b0369b003a4cd434d0b")]
[Index("FileIds", Name = "IDX_51c063b6a133a9cb87145450f5")]
[Index("RenoteId", Name = "IDX_52ccc804d7c69037d558bac4c9")]
[Index("Mentions", Name = "IDX_54ebcb6d27222913b908d56fd8")]
[Index("UserId", Name = "IDX_5b87d9d19127bd5d92026017a7")]
[Index("UserHost", Name = "IDX_7125a826ab192eb27e11d358a5")]
[Index("VisibleUserIds", Name = "IDX_796a8c03959361f97dc2be1d5c")]
[Index("Tags", Name = "IDX_88937d94d7443d9a99a76fa5c0")]
[Index("ThreadId", Name = "IDX_d4ebdef929896d6dc4a3c5bb48")]
[Index("CreatedAt", Name = "IDX_e7c0567f5261063592f022e9b5")]
[Index("ChannelId", Name = "IDX_f22169eb10657bded6d875ac8f")]
[Index("CreatedAt", "UserId", Name = "IDX_note_createdAt_userId")]
[Index("Id", "UserHost", Name = "IDX_note_id_userHost")]
[Index("Url", Name = "IDX_note_url")]
[Index("UserId", "Id", Name = "IDX_note_userId_id")]
public class Note {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the Note.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// The ID of reply target.
/// </summary>
[Column("replyId")]
[StringLength(32)]
public string? ReplyId { get; set; }
/// <summary>
/// The ID of renote target.
/// </summary>
[Column("renoteId")]
[StringLength(32)]
public string? RenoteId { get; set; }
[Column("text")] public string? Text { get; set; }
[Column("name")] [StringLength(256)] public string? Name { get; set; }
[Column("cw")] [StringLength(512)] public string? Cw { get; set; }
/// <summary>
/// The ID of author.
/// </summary>
[Column("userId")]
[StringLength(32)]
public string UserId { get; set; } = null!;
[Column("localOnly")] public bool LocalOnly { get; set; }
[Column("renoteCount")] public short RenoteCount { get; set; }
[Column("repliesCount")] public short RepliesCount { get; set; }
[Column("reactions", TypeName = "jsonb")]
public string Reactions { get; set; } = null!;
/// <summary>
/// The URI of a note. it will be null when the note is local.
/// </summary>
[Column("uri")]
[StringLength(512)]
public string? Uri { get; set; }
[Column("score")] public int Score { get; set; }
[Column("fileIds", TypeName = "character varying(32)[]")]
public List<string> FileIds { get; set; } = null!;
[Column("attachedFileTypes", TypeName = "character varying(256)[]")]
public List<string> AttachedFileTypes { get; set; } = null!;
[Column("visibleUserIds", TypeName = "character varying(32)[]")]
public List<string> VisibleUserIds { get; set; } = null!;
[Column("mentions", TypeName = "character varying(32)[]")]
public List<string> Mentions { get; set; } = null!;
[Column("mentionedRemoteUsers")] public string MentionedRemoteUsers { get; set; } = null!;
[Column("emojis", TypeName = "character varying(128)[]")]
public List<string> Emojis { get; set; } = null!;
[Column("tags", TypeName = "character varying(128)[]")]
public List<string> Tags { get; set; } = null!;
[Column("hasPoll")] public bool HasPoll { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("userHost")]
[StringLength(512)]
public string? UserHost { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("replyUserId")]
[StringLength(32)]
public string? ReplyUserId { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("replyUserHost")]
[StringLength(512)]
public string? ReplyUserHost { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("renoteUserId")]
[StringLength(32)]
public string? RenoteUserId { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("renoteUserHost")]
[StringLength(512)]
public string? RenoteUserHost { get; set; }
/// <summary>
/// The human readable url of a note. it will be null when the note is local.
/// </summary>
[Column("url")]
[StringLength(512)]
public string? Url { get; set; }
/// <summary>
/// The ID of source channel.
/// </summary>
[Column("channelId")]
[StringLength(32)]
public string? ChannelId { get; set; }
[Column("threadId")]
[StringLength(256)]
public string? ThreadId { get; set; }
/// <summary>
/// The updated date of the Note.
/// </summary>
[Column("updatedAt")]
public DateTime? UpdatedAt { get; set; }
[ForeignKey("ChannelId")]
[InverseProperty("Notes")]
public virtual Channel? Channel { get; set; }
[InverseProperty("Note")]
public virtual ICollection<ChannelNotePining> ChannelNotePinings { get; set; } = new List<ChannelNotePining>();
[InverseProperty("Note")] public virtual ICollection<ClipNote> ClipNotes { get; set; } = new List<ClipNote>();
[InverseProperty("Note")] public virtual HtmlNoteCacheEntry? HtmlNoteCacheEntry { get; set; }
[InverseProperty("Renote")] public virtual ICollection<Note> InverseRenote { get; set; } = new List<Note>();
[InverseProperty("Reply")] public virtual ICollection<Note> InverseReply { get; set; } = new List<Note>();
[InverseProperty("Note")] public virtual ICollection<NoteEdit> NoteEdits { get; set; } = new List<NoteEdit>();
[InverseProperty("Note")]
public virtual ICollection<NoteFavorite> NoteFavorites { get; set; } = new List<NoteFavorite>();
[InverseProperty("Note")]
public virtual ICollection<NoteReaction> NoteReactions { get; set; } = new List<NoteReaction>();
[InverseProperty("Note")] public virtual ICollection<NoteUnread> NoteUnreads { get; set; } = new List<NoteUnread>();
[InverseProperty("Note")]
public virtual ICollection<NoteWatching> NoteWatchings { get; set; } = new List<NoteWatching>();
[InverseProperty("Note")]
public virtual ICollection<Notification> Notifications { get; set; } = new List<Notification>();
[InverseProperty("Note")] public virtual Poll? Poll { get; set; }
[InverseProperty("Note")] public virtual ICollection<PollVote> PollVotes { get; set; } = new List<PollVote>();
[InverseProperty("Note")] public virtual PromoNote? PromoNote { get; set; }
[InverseProperty("Note")] public virtual ICollection<PromoRead> PromoReads { get; set; } = new List<PromoRead>();
[ForeignKey("RenoteId")]
[InverseProperty("InverseRenote")]
public virtual Note? Renote { get; set; }
[ForeignKey("ReplyId")]
[InverseProperty("InverseReply")]
public virtual Note? Reply { get; set; }
[ForeignKey("UserId")]
[InverseProperty("Notes")]
public virtual User User { get; set; } = null!;
[InverseProperty("Note")]
public virtual ICollection<UserNotePining> UserNotePinings { get; set; } = new List<UserNotePining>();
}

View file

@ -0,0 +1,38 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("note_edit")]
[Index("NoteId", Name = "IDX_702ad5ae993a672e4fbffbcd38")]
public class NoteEdit {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The ID of note.
/// </summary>
[Column("noteId")]
[StringLength(32)]
public string NoteId { get; set; } = null!;
[Column("text")] public string? Text { get; set; }
[Column("cw")] [StringLength(512)] public string? Cw { get; set; }
[Column("fileIds", TypeName = "character varying(32)[]")]
public List<string> FileIds { get; set; } = null!;
/// <summary>
/// The updated date of the Note.
/// </summary>
[Column("updatedAt")]
public DateTime UpdatedAt { get; set; }
[ForeignKey("NoteId")]
[InverseProperty("NoteEdits")]
public virtual Note Note { get; set; } = null!;
}

View file

@ -0,0 +1,33 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("note_favorite")]
[Index("UserId", "NoteId", Name = "IDX_0f4fb9ad355f3effff221ef245", IsUnique = true)]
[Index("UserId", Name = "IDX_47f4b1892f5d6ba8efb3057d81")]
public class NoteFavorite {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the NoteFavorite.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
[Column("userId")] [StringLength(32)] public string UserId { get; set; } = null!;
[Column("noteId")] [StringLength(32)] public string NoteId { get; set; } = null!;
[ForeignKey("NoteId")]
[InverseProperty("NoteFavorites")]
public virtual Note Note { get; set; } = null!;
[ForeignKey("UserId")]
[InverseProperty("NoteFavorites")]
public virtual User User { get; set; } = null!;
}

View file

@ -0,0 +1,39 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("note_reaction")]
[Index("CreatedAt", Name = "IDX_01f4581f114e0ebd2bbb876f0b")]
[Index("UserId", Name = "IDX_13761f64257f40c5636d0ff95e")]
[Index("NoteId", Name = "IDX_45145e4953780f3cd5656f0ea6")]
[Index("UserId", "NoteId", Name = "IDX_ad0c221b25672daf2df320a817", IsUnique = true)]
public class NoteReaction {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the NoteReaction.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
[Column("userId")] [StringLength(32)] public string UserId { get; set; } = null!;
[Column("noteId")] [StringLength(32)] public string NoteId { get; set; } = null!;
[Column("reaction")]
[StringLength(260)]
public string Reaction { get; set; } = null!;
[ForeignKey("NoteId")]
[InverseProperty("NoteReactions")]
public virtual Note Note { get; set; } = null!;
[ForeignKey("UserId")]
[InverseProperty("NoteReactions")]
public virtual User User { get; set; } = null!;
}

View file

@ -0,0 +1,28 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("note_thread_muting")]
[Index("UserId", Name = "IDX_29c11c7deb06615076f8c95b80")]
[Index("UserId", "ThreadId", Name = "IDX_ae7aab18a2641d3e5f25e0c4ea", IsUnique = true)]
[Index("ThreadId", Name = "IDX_c426394644267453e76f036926")]
public class NoteThreadMuting {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
[Column("createdAt")] public DateTime CreatedAt { get; set; }
[Column("userId")] [StringLength(32)] public string UserId { get; set; } = null!;
[Column("threadId")]
[StringLength(256)]
public string ThreadId { get; set; } = null!;
[ForeignKey("UserId")]
[InverseProperty("NoteThreadMutings")]
public virtual User User { get; set; } = null!;
}

View file

@ -0,0 +1,50 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("note_unread")]
[Index("IsMentioned", Name = "IDX_25b1dd384bec391b07b74b861c")]
[Index("NoteUserId", Name = "IDX_29e8c1d579af54d4232939f994")]
[Index("UserId", Name = "IDX_56b0166d34ddae49d8ef7610bb")]
[Index("NoteChannelId", Name = "IDX_6a57f051d82c6d4036c141e107")]
[Index("IsSpecified", Name = "IDX_89a29c9237b8c3b6b3cbb4cb30")]
[Index("UserId", "NoteId", Name = "IDX_d908433a4953cc13216cd9c274", IsUnique = true)]
[Index("NoteId", Name = "IDX_e637cba4dc4410218c4251260e")]
public class NoteUnread {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
[Column("userId")] [StringLength(32)] public string UserId { get; set; } = null!;
[Column("noteId")] [StringLength(32)] public string NoteId { get; set; } = null!;
/// <summary>
/// [Denormalized]
/// </summary>
[Column("noteUserId")]
[StringLength(32)]
public string NoteUserId { get; set; } = null!;
[Column("isSpecified")] public bool IsSpecified { get; set; }
[Column("isMentioned")] public bool IsMentioned { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("noteChannelId")]
[StringLength(32)]
public string? NoteChannelId { get; set; }
[ForeignKey("NoteId")]
[InverseProperty("NoteUnreads")]
public virtual Note Note { get; set; } = null!;
[ForeignKey("UserId")]
[InverseProperty("NoteUnreads")]
public virtual User User { get; set; } = null!;
}

View file

@ -0,0 +1,53 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("note_watching")]
[Index("NoteId", Name = "IDX_03e7028ab8388a3f5e3ce2a861")]
[Index("CreatedAt", Name = "IDX_318cdf42a9cfc11f479bd802bb")]
[Index("NoteUserId", Name = "IDX_44499765eec6b5489d72c4253b")]
[Index("UserId", "NoteId", Name = "IDX_a42c93c69989ce1d09959df4cf", IsUnique = true)]
[Index("UserId", Name = "IDX_b0134ec406e8d09a540f818288")]
public class NoteWatching {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the NoteWatching.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// The watcher ID.
/// </summary>
[Column("userId")]
[StringLength(32)]
public string UserId { get; set; } = null!;
/// <summary>
/// The target Note ID.
/// </summary>
[Column("noteId")]
[StringLength(32)]
public string NoteId { get; set; } = null!;
/// <summary>
/// [Denormalized]
/// </summary>
[Column("noteUserId")]
[StringLength(32)]
public string NoteUserId { get; set; } = null!;
[ForeignKey("NoteId")]
[InverseProperty("NoteWatchings")]
public virtual Note Note { get; set; } = null!;
[ForeignKey("UserId")]
[InverseProperty("NoteWatchings")]
public virtual User User { get; set; } = null!;
}

View file

@ -0,0 +1,100 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("notification")]
[Index("IsRead", Name = "IDX_080ab397c379af09b9d2169e5b")]
[Index("NotifierId", Name = "IDX_3b4e96eec8d36a8bbb9d02aa71")]
[Index("NotifieeId", Name = "IDX_3c601b70a1066d2c8b517094cb")]
[Index("CreatedAt", Name = "IDX_b11a5e627c41d4dc3170f1d370")]
[Index("AppAccessTokenId", Name = "IDX_e22bf6bda77b6adc1fd9e75c8c")]
public class Notification {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the Notification.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// The ID of recipient user of the Notification.
/// </summary>
[Column("notifieeId")]
[StringLength(32)]
public string NotifieeId { get; set; } = null!;
/// <summary>
/// The ID of sender user of the Notification.
/// </summary>
[Column("notifierId")]
[StringLength(32)]
public string? NotifierId { get; set; }
/// <summary>
/// Whether the notification was read.
/// </summary>
[Column("isRead")]
public bool IsRead { get; set; }
[Column("noteId")] [StringLength(32)] public string? NoteId { get; set; }
[Column("reaction")]
[StringLength(128)]
public string? Reaction { get; set; }
[Column("choice")] public int? Choice { get; set; }
[Column("followRequestId")]
[StringLength(32)]
public string? FollowRequestId { get; set; }
[Column("userGroupInvitationId")]
[StringLength(32)]
public string? UserGroupInvitationId { get; set; }
[Column("customBody")]
[StringLength(2048)]
public string? CustomBody { get; set; }
[Column("customHeader")]
[StringLength(256)]
public string? CustomHeader { get; set; }
[Column("customIcon")]
[StringLength(1024)]
public string? CustomIcon { get; set; }
[Column("appAccessTokenId")]
[StringLength(32)]
public string? AppAccessTokenId { get; set; }
[ForeignKey("AppAccessTokenId")]
[InverseProperty("Notifications")]
public virtual AccessToken? AppAccessToken { get; set; }
[ForeignKey("FollowRequestId")]
[InverseProperty("Notifications")]
public virtual FollowRequest? FollowRequest { get; set; }
[ForeignKey("NoteId")]
[InverseProperty("Notifications")]
public virtual Note? Note { get; set; }
[ForeignKey("NotifieeId")]
[InverseProperty("NotificationNotifiees")]
public virtual User Notifiee { get; set; } = null!;
[ForeignKey("NotifierId")]
[InverseProperty("NotificationNotifiers")]
public virtual User? Notifier { get; set; }
[ForeignKey("UserGroupInvitationId")]
[InverseProperty("Notifications")]
public virtual UserGroupInvitation? UserGroupInvitation { get; set; }
}

View file

@ -0,0 +1,62 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("oauth_app")]
[Index("ClientId", Name = "IDX_65b61f406c811241e1315a2f82", IsUnique = true)]
public class OauthApp {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the OAuth application
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// The client id of the OAuth application
/// </summary>
[Column("clientId")]
[StringLength(64)]
public string ClientId { get; set; } = null!;
/// <summary>
/// The client secret of the OAuth application
/// </summary>
[Column("clientSecret")]
[StringLength(64)]
public string ClientSecret { get; set; } = null!;
/// <summary>
/// The name of the OAuth application
/// </summary>
[Column("name")]
[StringLength(128)]
public string Name { get; set; } = null!;
/// <summary>
/// The website of the OAuth application
/// </summary>
[Column("website")]
[StringLength(256)]
public string? Website { get; set; }
/// <summary>
/// The scopes requested by the OAuth application
/// </summary>
[Column("scopes", TypeName = "character varying(64)[]")]
public List<string> Scopes { get; set; } = null!;
/// <summary>
/// The redirect URIs of the OAuth application
/// </summary>
[Column("redirectUris", TypeName = "character varying(512)[]")]
public List<string> RedirectUris { get; set; } = null!;
[InverseProperty("App")] public virtual ICollection<OauthToken> OauthTokens { get; set; } = new List<OauthToken>();
}

View file

@ -0,0 +1,66 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("oauth_token")]
[Index("Token", Name = "IDX_2cbeb4b389444bcf4379ef4273")]
[Index("Code", Name = "IDX_dc5fe174a8b59025055f0ec136")]
public class OauthToken {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the OAuth token
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
[Column("appId")] [StringLength(32)] public string AppId { get; set; } = null!;
[Column("userId")] [StringLength(32)] public string UserId { get; set; } = null!;
/// <summary>
/// The auth code for the OAuth token
/// </summary>
[Column("code")]
[StringLength(64)]
public string Code { get; set; } = null!;
/// <summary>
/// The OAuth token
/// </summary>
[Column("token")]
[StringLength(64)]
public string Token { get; set; } = null!;
/// <summary>
/// Whether or not the token has been activated
/// </summary>
[Column("active")]
public bool Active { get; set; }
/// <summary>
/// The scopes requested by the OAuth token
/// </summary>
[Column("scopes", TypeName = "character varying(64)[]")]
public List<string> Scopes { get; set; } = null!;
/// <summary>
/// The redirect URI of the OAuth token
/// </summary>
[Column("redirectUri")]
[StringLength(512)]
public string RedirectUri { get; set; } = null!;
[ForeignKey("AppId")]
[InverseProperty("OauthTokens")]
public virtual OauthApp App { get; set; } = null!;
[ForeignKey("UserId")]
[InverseProperty("OauthTokens")]
public virtual User User { get; set; } = null!;
}

View file

@ -0,0 +1,85 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("page")]
[Index("UserId", "Name", Name = "IDX_2133ef8317e4bdb839c0dcbf13", IsUnique = true)]
[Index("VisibleUserIds", Name = "IDX_90148bbc2bf0854428786bfc15")]
[Index("UserId", Name = "IDX_ae1d917992dd0c9d9bbdad06c4")]
[Index("UpdatedAt", Name = "IDX_af639b066dfbca78b01a920f8a")]
[Index("Name", Name = "IDX_b82c19c08afb292de4600d99e4")]
[Index("CreatedAt", Name = "IDX_fbb4297c927a9b85e9cefa2eb1")]
public class Page {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the Page.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
/// <summary>
/// The updated date of the Page.
/// </summary>
[Column("updatedAt")]
public DateTime UpdatedAt { get; set; }
[Column("title")] [StringLength(256)] public string Title { get; set; } = null!;
[Column("name")] [StringLength(256)] public string Name { get; set; } = null!;
[Column("summary")]
[StringLength(256)]
public string? Summary { get; set; }
[Column("alignCenter")] public bool AlignCenter { get; set; }
[Column("font")] [StringLength(32)] public string Font { get; set; } = null!;
/// <summary>
/// The ID of author.
/// </summary>
[Column("userId")]
[StringLength(32)]
public string UserId { get; set; } = null!;
[Column("eyeCatchingImageId")]
[StringLength(32)]
public string? EyeCatchingImageId { get; set; }
[Column("content", TypeName = "jsonb")]
public string Content { get; set; } = null!;
[Column("variables", TypeName = "jsonb")]
public string Variables { get; set; } = null!;
[Column("visibleUserIds", TypeName = "character varying(32)[]")]
public List<string> VisibleUserIds { get; set; } = null!;
[Column("likedCount")] public int LikedCount { get; set; }
[Column("hideTitleWhenPinned")] public bool HideTitleWhenPinned { get; set; }
[Column("script")]
[StringLength(16384)]
public string Script { get; set; } = null!;
[Column("isPublic")] public bool IsPublic { get; set; }
[ForeignKey("EyeCatchingImageId")]
[InverseProperty("Pages")]
public virtual DriveFile? EyeCatchingImage { get; set; }
[InverseProperty("Page")] public virtual ICollection<PageLike> PageLikes { get; set; } = new List<PageLike>();
[ForeignKey("UserId")]
[InverseProperty("Pages")]
public virtual User User { get; set; } = null!;
[InverseProperty("PinnedPage")] public virtual UserProfile? UserProfile { get; set; }
}

View file

@ -0,0 +1,29 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("page_like")]
[Index("UserId", Name = "IDX_0e61efab7f88dbb79c9166dbb4")]
[Index("UserId", "PageId", Name = "IDX_4ce6fb9c70529b4c8ac46c9bfa", IsUnique = true)]
public class PageLike {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
[Column("createdAt")] public DateTime CreatedAt { get; set; }
[Column("userId")] [StringLength(32)] public string UserId { get; set; } = null!;
[Column("pageId")] [StringLength(32)] public string PageId { get; set; } = null!;
[ForeignKey("PageId")]
[InverseProperty("PageLikes")]
public virtual Page Page { get; set; } = null!;
[ForeignKey("UserId")]
[InverseProperty("PageLikes")]
public virtual User User { get; set; } = null!;
}

View file

@ -0,0 +1,25 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("password_reset_request")]
[Index("Token", Name = "IDX_0b575fa9a4cfe638a925949285", IsUnique = true)]
[Index("UserId", Name = "IDX_4bb7fd4a34492ae0e6cc8d30ac")]
public class PasswordResetRequest {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
[Column("createdAt")] public DateTime CreatedAt { get; set; }
[Column("token")] [StringLength(256)] public string Token { get; set; } = null!;
[Column("userId")] [StringLength(32)] public string UserId { get; set; } = null!;
[ForeignKey("UserId")]
[InverseProperty("PasswordResetRequests")]
public virtual User User { get; set; } = null!;
}

View file

@ -0,0 +1,42 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("poll")]
[Index("UserId", Name = "IDX_0610ebcfcfb4a18441a9bcdab2")]
[Index("UserHost", Name = "IDX_7fa20a12319c7f6dc3aed98c0a")]
public class Poll {
[Key]
[Column("noteId")]
[StringLength(32)]
public string NoteId { get; set; } = null!;
[Column("expiresAt")] public DateTime? ExpiresAt { get; set; }
[Column("multiple")] public bool Multiple { get; set; }
[Column("choices", TypeName = "character varying(256)[]")]
public List<string> Choices { get; set; } = null!;
[Column("votes")] public List<int> Votes { get; set; } = null!;
/// <summary>
/// [Denormalized]
/// </summary>
[Column("userId")]
[StringLength(32)]
public string UserId { get; set; } = null!;
/// <summary>
/// [Denormalized]
/// </summary>
[Column("userHost")]
[StringLength(512)]
public string? UserHost { get; set; }
[ForeignKey("NoteId")]
[InverseProperty("Poll")]
public virtual Note Note { get; set; } = null!;
}

View file

@ -0,0 +1,37 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("poll_vote")]
[Index("CreatedAt", Name = "IDX_0fb627e1c2f753262a74f0562d")]
[Index("UserId", "NoteId", "Choice", Name = "IDX_50bd7164c5b78f1f4a42c4d21f", IsUnique = true)]
[Index("UserId", Name = "IDX_66d2bd2ee31d14bcc23069a89f")]
[Index("NoteId", Name = "IDX_aecfbd5ef60374918e63ee95fa")]
public class PollVote {
[Key]
[Column("id")]
[StringLength(32)]
public string Id { get; set; } = null!;
/// <summary>
/// The created date of the PollVote.
/// </summary>
[Column("createdAt")]
public DateTime CreatedAt { get; set; }
[Column("userId")] [StringLength(32)] public string UserId { get; set; } = null!;
[Column("noteId")] [StringLength(32)] public string NoteId { get; set; } = null!;
[Column("choice")] public int Choice { get; set; }
[ForeignKey("NoteId")]
[InverseProperty("PollVotes")]
public virtual Note Note { get; set; } = null!;
[ForeignKey("UserId")]
[InverseProperty("PollVotes")]
public virtual User User { get; set; } = null!;
}

View file

@ -0,0 +1,27 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;
namespace Iceshrimp.Backend.Core.Database.Tables;
[Table("promo_note")]
[Index("UserId", Name = "IDX_83f0862e9bae44af52ced7099e")]
public class PromoNote {
[Key]
[Column("noteId")]
[StringLength(32)]
public string NoteId { get; set; } = null!;
[Column("expiresAt")] public DateTime ExpiresAt { get; set; }
/// <summary>
/// [Denormalized]
/// </summary>
[Column("userId")]
[StringLength(32)]
public string UserId { get; set; } = null!;
[ForeignKey("NoteId")]
[InverseProperty("PromoNote")]
public virtual Note Note { get; set; } = null!;
}

Some files were not shown because too many files have changed in this diff Show more