Removed the Rust dependency and basically anything that isn't necessary to build the backend
ci/woodpecker/tag/ociImageTag Pipeline was successful Details

This commit is contained in:
Natty 2023-07-09 02:49:20 +02:00
parent 30cacef984
commit 9e78188cc5
Signed by: natty
GPG Key ID: BF6CB659ADEE60EC
194 changed files with 344 additions and 33398 deletions

View File

@ -1,82 +0,0 @@
replicaCount: 1
resources:
requests:
cpu: 0.5
memory: 512Mi
limits:
cpu: 1
memory: 1Gi
calckey:
domain: example.tld
smtp:
from_address: noreply@example.tld
port: 587
server: smtp.gmail.com
useImplicitSslTls: false
login: me@example.tld
password: CHANGEME
objectStorage:
baseUrl: https://example-bucket.nyc3.cdn.digitaloceanspaces.com
access_key: CHANGEME
access_secret: CHANGEME
bucket: example-bucket
endpoint: nyc3.digitaloceanspaces.com:443
region: nyc3
allowedPrivateNetworks: []
ingress:
enabled: true
annotations:
cert-manager.io/cluster-issuer: letsencrypt
hosts:
- host: example.tld
paths:
- path: /
pathType: ImplementationSpecific
tls:
- secretName: example-tld-certificate
hosts:
- example.tld
elasticsearch:
enabled: false
postgresql:
auth:
password: CHANGEME
postgresPassword: CHANGEME
primary:
persistence:
enabled: true
storageClass: vultr-block-storage
size: 25Gi
resources:
requests:
cpu: 0.25
memory: 256Mi
limits:
cpu: 0.5
memory: 512Mi
metrics:
enabled: true
redis:
auth:
password: CHANGEME
master:
resources:
requests:
cpu: 0.25
memory: 256Mi
limits:
cpu: 0.5
memory: 256Mi
persistence:
storageclass: vultr-block-storage
size: 10Gi
replica:
replicaCount: 0
metrics:
enabled: true

13913
CHANGELOG.md

File diff suppressed because it is too large Load Diff

View File

@ -3,41 +3,19 @@ FROM alpine:3.18 as build
WORKDIR /calckey WORKDIR /calckey
# Install compilation dependencies # Install compilation dependencies
RUN apk add --no-cache --no-progress git alpine-sdk python3 nodejs-current npm rust cargo vips RUN apk add --no-cache --no-progress git alpine-sdk python3 nodejs-current npm vips
# Copy only the cargo dependency-related files first, to cache efficiently
COPY packages/backend/native-utils/Cargo.toml packages/backend/native-utils/Cargo.toml
COPY packages/backend/native-utils/Cargo.lock packages/backend/native-utils/Cargo.lock
COPY packages/backend/native-utils/src/lib.rs packages/backend/native-utils/src/
COPY packages/backend/native-utils/migration/Cargo.toml packages/backend/native-utils/migration/Cargo.toml
COPY packages/backend/native-utils/migration/src/lib.rs packages/backend/native-utils/migration/src/
# Install cargo dependencies
RUN cargo fetch --locked --manifest-path /calckey/packages/backend/native-utils/Cargo.toml
# Copy only the dependency-related files first, to cache efficiently # Copy only the dependency-related files first, to cache efficiently
COPY package.json pnpm*.yaml ./ COPY package.json pnpm*.yaml ./
COPY packages/backend/package.json packages/backend/package.json COPY packages/backend/package.json packages/backend/package.json
COPY packages/calckey-js/package.json packages/calckey-js/package.json COPY packages/calckey-js/package.json packages/calckey-js/package.json
COPY packages/backend/native-utils/package.json packages/backend/native-utils/package.json
COPY packages/backend/native-utils/npm/linux-x64-musl/package.json packages/backend/native-utils/npm/linux-x64-musl/package.json
COPY packages/backend/native-utils/npm/linux-arm64-musl/package.json packages/backend/native-utils/npm/linux-arm64-musl/package.json
# Configure corepack and pnpm, and install dev mode dependencies for compilation # Configure corepack and pnpm, and install dev mode dependencies for compilation
RUN corepack enable && corepack prepare pnpm@latest --activate && pnpm i --frozen-lockfile RUN corepack enable && corepack prepare pnpm@latest --activate && pnpm i --frozen-lockfile
# Copy in the rest of the native-utils rust files
COPY packages/backend/native-utils/.cargo packages/backend/native-utils/.cargo
COPY packages/backend/native-utils/build.rs packages/backend/native-utils/
COPY packages/backend/native-utils/src packages/backend/native-utils/src/
COPY packages/backend/native-utils/migration/src packages/backend/native-utils/migration/src/
# Compile native-utils
RUN pnpm run --filter native-utils build
# Copy in the rest of the files to compile # Copy in the rest of the files to compile
COPY . ./ COPY . ./
RUN env NODE_ENV=production sh -c "pnpm run --filter '!native-utils' build" RUN env NODE_ENV=production sh -c "pnpm run build"
# Trim down the dependencies to only those for production # Trim down the dependencies to only those for production
RUN pnpm i --prod --frozen-lockfile RUN pnpm i --prod --frozen-lockfile
@ -58,7 +36,6 @@ COPY --from=build /calckey/packages/calckey-js/node_modules /calckey/packages/ca
# Copy the finished compiled files # Copy the finished compiled files
COPY --from=build /calckey/packages/backend/built /calckey/packages/backend/built COPY --from=build /calckey/packages/backend/built /calckey/packages/backend/built
COPY --from=build /calckey/packages/backend/native-utils/built /calckey/packages/backend/native-utils/built
RUN corepack enable && corepack prepare pnpm@latest --activate RUN corepack enable && corepack prepare pnpm@latest --activate
ENV NODE_ENV=production ENV NODE_ENV=production

View File

@ -3,7 +3,7 @@
<img src="./title_float.svg" alt="Calckey logo" style="border-radius:50%" width="400"/> <img src="./title_float.svg" alt="Calckey logo" style="border-radius:50%" width="400"/>
</a> </a>
**🌎 **[Calckey](https://calckey.org/)** is an open source, decentralized social media platform that's free forever! 🚀** <b>This is a horribly broken fork of Calckey not intended to be run on its own.</b>
[![no github badge](https://nogithub.codeberg.page/badge.svg)](https://nogithub.codeberg.page/) [![no github badge](https://nogithub.codeberg.page/badge.svg)](https://nogithub.codeberg.page/)
[![status badge](https://ci.codeberg.org/api/badges/calckey/calckey/status.svg)](https://ci.codeberg.org/calckey/calckey) [![status badge](https://ci.codeberg.org/api/badges/calckey/calckey/status.svg)](https://ci.codeberg.org/calckey/calckey)

View File

@ -1,12 +0,0 @@
import { defineConfig } from "cypress";
export default defineConfig({
e2e: {
// We've imported your old cypress plugins here.
// You may want to clean this up later by importing these.
setupNodeEvents(on, config) {
return require("./cypress/plugins/index.js")(on, config);
},
baseUrl: "http://localhost:61812",
},
});

View File

@ -1,151 +0,0 @@
describe("Before setup instance", () => {
beforeEach(() => {
cy.resetState();
});
afterEach(() => {
// テスト終了直前にページ遷移するようなテストケース(例えばアカウント作成)だと、たぶんCypressのバグでブラウザの内容が次のテストケースに引き継がれてしまう(例えばアカウントが作成し終わった段階からテストが始まる)。
// waitを入れることでそれを防止できる
cy.wait(1000);
});
it("successfully loads", () => {
cy.visit("/");
});
it("setup instance", () => {
cy.visit("/");
cy.intercept("POST", "/api/admin/accounts/create").as("signup");
cy.get("[data-cy-admin-username] input").type("admin");
cy.get("[data-cy-admin-password] input").type("admin1234");
cy.get("[data-cy-admin-ok]").click();
// なぜか動かない
//cy.wait('@signup').should('have.property', 'response.statusCode');
cy.wait("@signup");
});
});
describe("After setup instance", () => {
beforeEach(() => {
cy.resetState();
// インスタンス初期セットアップ
cy.registerUser("admin", "pass", true);
});
afterEach(() => {
// テスト終了直前にページ遷移するようなテストケース(例えばアカウント作成)だと、たぶんCypressのバグでブラウザの内容が次のテストケースに引き継がれてしまう(例えばアカウントが作成し終わった段階からテストが始まる)。
// waitを入れることでそれを防止できる
cy.wait(1000);
});
it("successfully loads", () => {
cy.visit("/");
});
it("signup", () => {
cy.visit("/");
cy.intercept("POST", "/api/signup").as("signup");
cy.get("[data-cy-signup]").click();
cy.get("[data-cy-signup-username] input").type("alice");
cy.get("[data-cy-signup-password] input").type("alice1234");
cy.get("[data-cy-signup-password-retype] input").type("alice1234");
cy.get("[data-cy-signup-submit]").click();
cy.wait("@signup");
});
});
describe("After user signup", () => {
beforeEach(() => {
cy.resetState();
// インスタンス初期セットアップ
cy.registerUser("admin", "pass", true);
// ユーザー作成
cy.registerUser("alice", "alice1234");
});
afterEach(() => {
// テスト終了直前にページ遷移するようなテストケース(例えばアカウント作成)だと、たぶんCypressのバグでブラウザの内容が次のテストケースに引き継がれてしまう(例えばアカウントが作成し終わった段階からテストが始まる)。
// waitを入れることでそれを防止できる
cy.wait(1000);
});
it("successfully loads", () => {
cy.visit("/");
});
it("signin", () => {
cy.visit("/");
cy.intercept("POST", "/api/signin").as("signin");
cy.get("[data-cy-signin]").click();
cy.get("[data-cy-signin-username] input").type("alice");
// Enterキーでサインインできるかの確認も兼ねる
cy.get("[data-cy-signin-password] input").type("alice1234{enter}");
cy.wait("@signin");
});
it("suspend", function () {
cy.request("POST", "/api/admin/suspend-user", {
i: this.admin.token,
userId: this.alice.id,
});
cy.visit("/");
cy.get("[data-cy-signin]").click();
cy.get("[data-cy-signin-username] input").type("alice");
cy.get("[data-cy-signin-password] input").type("alice1234{enter}");
// TODO: cypressにブラウザの言語指定できる機能が実装され次第英語のみテストするようにする
cy.contains(
/アカウントが凍結されています|This account has been suspended due to/gi,
);
});
});
describe("After user singed in", () => {
beforeEach(() => {
cy.resetState();
// インスタンス初期セットアップ
cy.registerUser("admin", "pass", true);
// ユーザー作成
cy.registerUser("alice", "alice1234");
cy.login("alice", "alice1234");
});
afterEach(() => {
// テスト終了直前にページ遷移するようなテストケース(例えばアカウント作成)だと、たぶんCypressのバグでブラウザの内容が次のテストケースに引き継がれてしまう(例えばアカウントが作成し終わった段階からテストが始まる)。
// waitを入れることでそれを防止できる
cy.wait(1000);
});
it("successfully loads", () => {
cy.get("[data-cy-open-post-form]").should("be.visible");
});
it("note", () => {
cy.get("[data-cy-open-post-form]").click();
cy.get("[data-cy-post-form-text]").type("Hello, Misskey!");
cy.get("[data-cy-open-post-form-submit]").click();
cy.contains("Hello, Misskey!");
});
});
// TODO: 投稿フォームの公開範囲指定のテスト
// TODO: 投稿フォームのファイル添付のテスト
// TODO: 投稿フォームのハッシュタグ保持フィールドのテスト

View File

@ -1,63 +0,0 @@
describe("After user signed in", () => {
beforeEach(() => {
cy.resetState();
cy.viewport("macbook-16");
// インスタンス初期セットアップ
cy.registerUser("admin", "pass", true);
// ユーザー作成
cy.registerUser("alice", "alice1234");
cy.login("alice", "alice1234");
});
afterEach(() => {
// テスト終了直前にページ遷移するようなテストケース(例えばアカウント作成)だと、たぶんCypressのバグでブラウザの内容が次のテストケースに引き継がれてしまう(例えばアカウントが作成し終わった段階からテストが始まる)。
// waitを入れることでそれを防止できる
cy.wait(1000);
});
it("widget edit toggle is visible", () => {
cy.get(".mk-widget-edit").should("be.visible");
});
it("widget select should be visible in edit mode", () => {
cy.get(".mk-widget-edit").click();
cy.get(".mk-widget-select").should("be.visible");
});
it("first widget should be removed", () => {
cy.get(".mk-widget-edit").click();
cy.get(".customize-container:first-child .remove._button").click();
cy.get(".customize-container").should("have.length", 2);
});
function buildWidgetTest(widgetName) {
it(`${widgetName} widget should get added`, () => {
cy.get(".mk-widget-edit").click();
cy.get(".mk-widget-select select").select(widgetName, { force: true });
cy.get(".bg._modalBg.transparent").click({ multiple: true, force: true });
cy.get(".mk-widget-add").click({ force: true });
cy.get(`.mkw-${widgetName}`).should("exist");
});
}
buildWidgetTest("memo");
buildWidgetTest("notifications");
buildWidgetTest("timeline");
buildWidgetTest("calendar");
buildWidgetTest("rss");
buildWidgetTest("trends");
buildWidgetTest("clock");
buildWidgetTest("activity");
buildWidgetTest("photos");
buildWidgetTest("digitalClock");
buildWidgetTest("federation");
buildWidgetTest("postForm");
buildWidgetTest("slideshow");
buildWidgetTest("serverMetric");
buildWidgetTest("onlineUsers");
buildWidgetTest("jobQueue");
buildWidgetTest("button");
buildWidgetTest("aiscript");
});

View File

@ -1,5 +0,0 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}

View File

@ -1,21 +0,0 @@
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
/**
* @type {Cypress.PluginConfig}
*/
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
};

View File

@ -1,57 +0,0 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
Cypress.Commands.add("resetState", () => {
cy.window((win) => {
win.indexedDB.deleteDatabase("keyval-store");
});
cy.request("POST", "/api/reset-db").as("reset");
cy.get("@reset").its("status").should("equal", 204);
cy.reload(true);
});
Cypress.Commands.add("registerUser", (username, password, isAdmin = false) => {
const route = isAdmin ? "/api/admin/accounts/create" : "/api/signup";
cy.request("POST", route, {
username: username,
password: password,
})
.its("body")
.as(username);
});
Cypress.Commands.add("login", (username, password) => {
cy.visit("/");
cy.intercept("POST", "/api/signin").as("signin");
cy.get("[data-cy-signin]").click();
cy.get("[data-cy-signin-username] input").type(username);
cy.get("[data-cy-signin-password] input").type(`${password}{enter}`);
cy.wait("@signin").as("signedIn");
});

View File

@ -1,34 +0,0 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import "./commands";
// Alternatively you can use CommonJS syntax:
// require('./commands')
Cypress.on("uncaught:exception", (err, runnable) => {
if (
[
// Chrome
"ResizeObserver loop limit exceeded",
// Firefox
"ResizeObserver loop completed with undelivered notifications",
].some((msg) => err.message.includes(msg))
) {
return false;
}
});

View File

@ -21,11 +21,6 @@
"dev": "pnpm node ./scripts/dev.js", "dev": "pnpm node ./scripts/dev.js",
"dev:staging": "NODE_OPTIONS=--max_old_space_size=3072 NODE_ENV=development pnpm run build && pnpm run start", "dev:staging": "NODE_OPTIONS=--max_old_space_size=3072 NODE_ENV=development pnpm run build && pnpm run start",
"lint": "pnpm -r run lint", "lint": "pnpm -r run lint",
"cy:open": "cypress open --browser --e2e --config-file=cypress.config.ts",
"cy:run": "cypress run",
"e2e": "start-server-and-test start:test http://localhost:61812 cy:run",
"mocha": "pnpm --filter backend run mocha",
"test": "pnpm run mocha",
"format": "pnpm -r run format", "format": "pnpm -r run format",
"clean": "pnpm node ./scripts/clean.js", "clean": "pnpm node ./scripts/clean.js",
"clean-all": "pnpm node ./scripts/clean-all.js", "clean-all": "pnpm node ./scripts/clean-all.js",
@ -38,13 +33,11 @@
"@bull-board/api": "5.2.0", "@bull-board/api": "5.2.0",
"@bull-board/ui": "5.2.0", "@bull-board/ui": "5.2.0",
"@napi-rs/cli": "^2.16.1", "@napi-rs/cli": "^2.16.1",
"js-yaml": "4.1.0", "js-yaml": "4.1.0"
"seedrandom": "^3.0.5"
}, },
"devDependencies": { "devDependencies": {
"chalk": "4.1.2", "chalk": "4.1.2",
"cross-env": "7.0.3", "cross-env": "7.0.3",
"cypress": "10.11.0",
"execa": "5.1.1", "execa": "5.1.1",
"install-peers": "^1.0.4", "install-peers": "^1.0.4",
"rome": "^12.1.3", "rome": "^12.1.3",

View File

@ -1,10 +0,0 @@
{
"extension": ["ts","js","cjs","mjs"],
"node-option": [
"experimental-specifier-resolution=node",
"loader=./test/loader.js"
],
"slow": 1000,
"timeout": 30000,
"exit": true
}

View File

@ -1,3 +0,0 @@
[target.aarch64-unknown-linux-musl]
linker = "aarch64-linux-musl-gcc"
rustflags = ["-C", "target-feature=-crt-static"]

View File

@ -1,3 +0,0 @@
[*.rs]
indent_style = space
indent_size = 4

View File

@ -1,199 +0,0 @@
# Created by https://www.toptal.com/developers/gitignore/api/node
# Edit at https://www.toptal.com/developers/gitignore?templates=node
### Node ###
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
# Runtime data
pids
*.pid
*.seed
*.pid.lock
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
*.lcov
# nyc test coverage
.nyc_output
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Bower dependency directory (https://bower.io/)
bower_components
# node-waf configuration
.lock-wscript
# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release
# Dependency directories
node_modules/
jspm_packages/
# TypeScript v1 declaration files
typings/
# TypeScript cache
*.tsbuildinfo
# Optional npm cache directory
.npm
# Optional eslint cache
.eslintcache
# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/
# Optional REPL history
.node_repl_history
# Output of 'npm pack'
*.tgz
# Yarn Integrity file
.yarn-integrity
# dotenv environment variables file
.env
.env.test
# parcel-bundler cache (https://parceljs.org/)
.cache
# Next.js build output
.next
# Nuxt.js build / generate output
.nuxt
dist
# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public
# vuepress build output
.vuepress/dist
# Serverless directories
.serverless/
# FuseBox cache
.fusebox/
# DynamoDB Local files
.dynamodb/
# TernJS port file
.tern-port
# Stores VSCode versions used for testing VSCode extensions
.vscode-test
# End of https://www.toptal.com/developers/gitignore/api/node
# Created by https://www.toptal.com/developers/gitignore/api/macos
# Edit at https://www.toptal.com/developers/gitignore?templates=macos
### macOS ###
# General
.DS_Store
.AppleDouble
.LSOverride
# Icon must end with two
Icon
# Thumbnails
._*
# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent
# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
### macOS Patch ###
# iCloud generated files
*.icloud
# End of https://www.toptal.com/developers/gitignore/api/macos
# Created by https://www.toptal.com/developers/gitignore/api/windows
# Edit at https://www.toptal.com/developers/gitignore?templates=windows
### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
# Windows shortcuts
*.lnk
# End of https://www.toptal.com/developers/gitignore/api/windows
# napi-rs generated files
built/
#Added by cargo
/target
.pnp.*
.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
*.node

View File

@ -1,13 +0,0 @@
target
Cargo.lock
.cargo
.github
npm
.eslintrc
.prettierignore
rustfmt.toml
yarn.lock
*.node
.yarn
__test__
renovate.json

File diff suppressed because it is too large Load Diff

View File

@ -1,47 +0,0 @@
[package]
edition = "2021"
name = "native-utils"
version = "0.0.0"
[workspace]
members = ["migration"]
[features]
default = []
noarray = []
napi = ["dep:napi", "dep:napi-derive", "dep:radix_fmt"]
[lib]
crate-type = ["cdylib", "lib"]
[dependencies]
async-trait = "0.1.68"
cfg-if = "1.0.0"
chrono = "0.4.24"
cuid2 = "0.1.0"
derive_more = "0.99.17"
jsonschema = "0.17.0"
once_cell = "1.17.1"
parse-display = "0.8.0"
rand = "0.8.5"
schemars = { version = "0.8.12", features = ["chrono"] }
sea-orm = { version = "0.11.3", features = ["sqlx-postgres", "postgres-array", "sqlx-sqlite", "runtime-tokio-rustls"] }
serde = { version = "1.0.163", features = ["derive"] }
serde_json = "1.0.96"
thiserror = "1.0.40"
tokio = { version = "1.28.1", features = ["full"] }
utoipa = "3.3.0"
# Default enable napi4 feature, see https://nodejs.org/api/n-api.html#node-api-version-matrix
napi = { version = "2.13.1", default-features = false, features = ["napi6", "tokio_rt"], optional = true }
napi-derive = { version = "2.12.0", optional = true }
radix_fmt = { version = "1.0.0", optional = true }
[dev-dependencies]
pretty_assertions = "1.3.0"
[build-dependencies]
napi-build = "2.0.1"
[profile.release]
lto = true

View File

@ -1,32 +0,0 @@
import test from "ava";
import {
convertId,
IdConvertType,
nativeInitIdGenerator,
nativeCreateId,
nativeRandomStr,
} from "../built/index.js";
test("convert to mastodon id", (t) => {
t.is(convertId("9gf61ehcxv", IdConvertType.MastodonId), "960365976481219");
t.is(
convertId("9fbr9z0wbrjqyd3u", IdConvertType.MastodonId),
"3954607381600562394",
);
t.is(
convertId("9fbs680oyviiqrol9md73p8g", IdConvertType.MastodonId),
"3494513243013053824",
);
});
test("create cuid2 with timestamp prefix", (t) => {
nativeInitIdGenerator(16, "");
t.not(nativeCreateId(BigInt(Date.now())), nativeCreateId(BigInt(Date.now())));
t.is(nativeCreateId(BigInt(Date.now())).length, 16);
});
test("create random string", (t) => {
t.not(nativeRandomStr(16), nativeRandomStr(16));
t.is(nativeRandomStr(24).length, 24);
});

View File

@ -1,5 +0,0 @@
extern crate napi_build;
fn main() {
napi_build::setup();
}

View File

@ -1,34 +0,0 @@
[package]
name = "migration"
version = "0.1.0"
edition = "2021"
publish = false
[lib]
name = "migration"
path = "src/lib.rs"
[features]
default = []
convert = ["dep:native-utils", "dep:indicatif", "dep:futures"]
[dependencies]
serde_json = "1.0.96"
native-utils = { path = "../", optional = true }
indicatif = { version = "0.17.4", features = ["tokio"], optional = true }
tokio = { version = "1.28.2", features = ["full"] }
futures = { version = "0.3.28", optional = true }
serde_yaml = "0.9.21"
serde = { version = "1.0.163", features = ["derive"] }
urlencoding = "2.1.2"
[dependencies.sea-orm-migration]
version = "0.11.0"
features = [
# Enable at least one `ASYNC_RUNTIME` and `DATABASE_DRIVER` feature if you want to run migration via CLI.
# View the list of supported features at https://www.sea-ql.org/SeaORM/docs/install-and-config/database-and-async-runtime.
# e.g.
"runtime-tokio-rustls", # `ASYNC_RUNTIME` feature
"sqlx-postgres", # `DATABASE_DRIVER` feature
"sqlx-sqlite",
]

View File

@ -1,55 +0,0 @@
# Making migrations
For more information, please read https://www.sea-ql.org/SeaORM/docs/migration/setting-up-migration/
- Install `sea-orm-cli`
```sh
cargo install sea-orm-cli
```
- Generate
```sh
sea-orm-cli migrate generate ****
```
# Running Migrator CLI
- Generate a new migration file
```sh
cargo run -- migrate generate MIGRATION_NAME
```
- Apply all pending migrations
```sh
cargo run
```
```sh
cargo run -- up
```
- Apply first 10 pending migrations
```sh
cargo run -- up -n 10
```
- Rollback last applied migrations
```sh
cargo run -- down
```
- Rollback last 10 applied migrations
```sh
cargo run -- down -n 10
```
- Drop all tables from the database, then reapply all migrations
```sh
cargo run -- fresh
```
- Rollback all applied migrations, then reapply all migrations
```sh
cargo run -- refresh
```
- Rollback all applied migrations
```sh
cargo run -- reset
```
- Check the status of all migrations
```sh
cargo run -- status
```

View File

@ -1,12 +0,0 @@
pub use sea_orm_migration::prelude::*;
mod m20230531_180824_drop_reversi;
pub struct Migrator;
#[async_trait::async_trait]
impl MigratorTrait for Migrator {
fn migrations() -> Vec<Box<dyn MigrationTrait>> {
vec![Box::new(m20230531_180824_drop_reversi::Migration)]
}
}

View File

@ -1,51 +0,0 @@
use sea_orm_migration::{
prelude::*,
sea_orm::{DbBackend, Statement},
};
#[derive(DeriveMigrationName)]
pub struct Migration;
#[async_trait::async_trait]
impl MigrationTrait for Migration {
async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> {
if manager.get_database_backend() == DbBackend::Sqlite {
return Ok(());
}
let db = manager.get_connection();
db.query_one(Statement::from_string(
DbBackend::Postgres,
Table::drop()
.table(ReversiGame::Table)
.if_exists()
.to_string(PostgresQueryBuilder),
))
.await?;
db.query_one(Statement::from_string(
DbBackend::Postgres,
Table::drop()
.table(ReversiMatching::Table)
.if_exists()
.to_string(PostgresQueryBuilder),
))
.await?;
Ok(())
}
async fn down(&self, _manager: &SchemaManager) -> Result<(), DbErr> {
// Replace the sample below with your own migration scripts
Ok(())
}
}
/// Learn more at https://docs.rs/sea-query#iden
#[derive(Iden)]
enum ReversiGame {
Table,
}
#[derive(Iden)]
enum ReversiMatching {
Table,
}

View File

@ -1,50 +0,0 @@
use serde::Deserialize;
use std::env;
use std::fs;
use urlencoding::encode;
use sea_orm_migration::prelude::*;
#[cfg(feature = "convert")]
mod vec_to_json;
#[tokio::main]
async fn main() {
let cwd = env::current_dir().unwrap();
let yml = fs::File::open(cwd.join("../../.config/default.yml"))
.expect("Failed to open '.config/default.yml'");
let config: Config = serde_yaml::from_reader(yml).expect("Failed to parse yaml");
env::set_var(
"DATABASE_URL",
format!(
"postgres://{}:{}@{}:{}/{}",
config.db.user,
encode(&config.db.pass),
config.db.host,
config.db.port,
config.db.db,
),
);
cli::run_cli(migration::Migrator).await;
#[cfg(feature = "convert")]
vec_to_json::convert().await;
}
#[derive(Debug, PartialEq, Deserialize)]
#[serde(rename = "camelCase")]
pub struct Config {
pub db: DbConfig,
}
#[derive(Debug, PartialEq, Deserialize)]
#[serde(rename = "camelCase")]
pub struct DbConfig {
pub host: String,
pub port: u32,
pub db: String,
pub user: String,
pub pass: String,
}

View File

@ -1,498 +0,0 @@
use indicatif::{MultiProgress, ProgressBar, ProgressStyle};
use native_utils::model::entity::newtype::{I32Vec, StringVec};
use sea_orm_migration::{
prelude::*,
sea_orm::{Database, DbBackend, DbConn, Statement, TryGetable},
};
use serde_json::json;
use std::env;
use std::time::Duration;
pub async fn convert() {
let uri = env::var("DATABASE_URL").expect("Environment variable 'DATABASE_URL' not set");
let db = Database::connect(uri).await.expect("Unable to connect");
let mp = MultiProgress::new();
let handlers = vec![
tokio::spawn(to_json::<AccessToken, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
AccessToken::Table,
AccessToken::Id,
AccessToken::Permission,
)),
tokio::spawn(to_json::<Antenna, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Antenna::Table,
Antenna::Id,
Antenna::Users,
)),
tokio::spawn(to_json::<App, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
App::Table,
App::Id,
App::Permission,
)),
tokio::spawn(to_json::<Emoji, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Emoji::Table,
Emoji::Id,
Emoji::Aliases,
)),
tokio::spawn(to_json::<GalleryPost, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
GalleryPost::Table,
GalleryPost::Id,
GalleryPost::FileIds,
)),
tokio::spawn(to_json::<GalleryPost, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
GalleryPost::Table,
GalleryPost::Id,
GalleryPost::Tags,
)),
tokio::spawn(to_json::<Hashtag, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Hashtag::Table,
Hashtag::Id,
Hashtag::MentionedUserIds,
)),
tokio::spawn(to_json::<Hashtag, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Hashtag::Table,
Hashtag::Id,
Hashtag::MentionedLocalUserIds,
)),
tokio::spawn(to_json::<Hashtag, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Hashtag::Table,
Hashtag::Id,
Hashtag::MentionedRemoteUserIds,
)),
tokio::spawn(to_json::<Hashtag, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Hashtag::Table,
Hashtag::Id,
Hashtag::AttachedUserIds,
)),
tokio::spawn(to_json::<Hashtag, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Hashtag::Table,
Hashtag::Id,
Hashtag::AttachedLocalUserIds,
)),
tokio::spawn(to_json::<Hashtag, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Hashtag::Table,
Hashtag::Id,
Hashtag::AttachedRemoteUserIds,
)),
tokio::spawn(to_json::<MessagingMessage, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
MessagingMessage::Table,
MessagingMessage::Id,
MessagingMessage::Reads,
)),
tokio::spawn(to_json::<Meta, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Meta::Table,
Meta::Id,
Meta::Langs,
)),
tokio::spawn(to_json::<Meta, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Meta::Table,
Meta::Id,
Meta::BlockedHosts,
)),
tokio::spawn(to_json::<Meta, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Meta::Table,
Meta::Id,
Meta::HiddenTags,
)),
tokio::spawn(to_json::<Meta, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Meta::Table,
Meta::Id,
Meta::PinnedUsers,
)),
tokio::spawn(to_json::<Meta, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Meta::Table,
Meta::Id,
Meta::PinnedPages,
)),
tokio::spawn(to_json::<Meta, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Meta::Table,
Meta::Id,
Meta::RecommendedInstances,
)),
tokio::spawn(to_json::<Meta, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Meta::Table,
Meta::Id,
Meta::SilencedHosts,
)),
tokio::spawn(to_json::<Note, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Note::Table,
Note::Id,
Note::FileIds,
)),
tokio::spawn(to_json::<Note, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Note::Table,
Note::Id,
Note::AttachedFileTypes,
)),
tokio::spawn(to_json::<Note, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Note::Table,
Note::Id,
Note::VisibleUserIds,
)),
tokio::spawn(to_json::<Note, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Note::Table,
Note::Id,
Note::Mentions,
)),
tokio::spawn(to_json::<Note, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Note::Table,
Note::Id,
Note::Emojis,
)),
tokio::spawn(to_json::<Note, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Note::Table,
Note::Id,
Note::Tags,
)),
tokio::spawn(to_json::<NoteEdit, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
NoteEdit::Table,
NoteEdit::Id,
NoteEdit::FileIds,
)),
tokio::spawn(to_json::<Page, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Page::Table,
Page::Id,
Page::VisibleUserIds,
)),
tokio::spawn(to_json::<RegistryItem, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
RegistryItem::Table,
RegistryItem::Id,
RegistryItem::Scope,
)),
tokio::spawn(to_json::<User, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
User::Table,
User::Id,
User::Tags,
)),
tokio::spawn(to_json::<User, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
User::Table,
User::Id,
User::Emojis,
)),
tokio::spawn(to_json::<Webhook, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Webhook::Table,
Webhook::Id,
Webhook::On,
)),
tokio::spawn(to_json::<Poll, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
Poll::Table,
Poll::NoteId,
Poll::Choices,
)),
tokio::spawn(to_json::<Poll, Vec<i32>, I32Vec>(
db.clone(),
mp.clone(),
Poll::Table,
Poll::NoteId,
Poll::Votes,
)),
tokio::spawn(to_json::<UserProfile, Vec<String>, StringVec>(
db.clone(),
mp.clone(),
UserProfile::Table,
UserProfile::UserId,
UserProfile::MutingNotificationTypes,
)),
];
futures::future::join_all(handlers).await;
}
fn select_query<T: Iden + 'static>(table: T, id: T, col: T) -> String {
Query::select()
.column(id)
.column(col)
.from(table)
.to_string(PostgresQueryBuilder)
}
async fn get_vec<T: TryGetable>(db: &DbConn, query: String) -> Result<Vec<(String, T)>, DbErr> {
let res: Vec<(String, T)> = db
.query_all(Statement::from_string(DbBackend::Postgres, query))
.await?
.iter()
.filter_map(|r| r.try_get_many_by_index().ok())
.collect();
Ok(res)
}
async fn convert_col<T: Iden + Clone + 'static>(
db: &DbConn,
table: T,
col: T,
) -> Result<(), DbErr> {
let stmt = Table::alter()
.table(table)
.drop_column(col.to_owned())
.add_column(
ColumnDef::new(col.to_owned())
.json_binary()
.not_null()
.default(json!([])),
)
.to_string(PostgresQueryBuilder);
db.query_one(Statement::from_string(DbBackend::Postgres, stmt))
.await?;
Ok(())
}
async fn to_json<T, U, V>(
db: DbConn,
mp: MultiProgress,
table: T,
id: T,
col: T,
) -> Result<(), DbErr>
where
T: Iden + Clone + 'static,
U: TryGetable + IntoIterator + Clone,
V: From<U> + Into<SimpleExpr>,
{
let query = select_query(table.clone(), id.clone(), col.clone());
let loading = ProgressBar::new_spinner()
.with_style(ProgressStyle::with_template("{prefix} {msg} {spinner}").unwrap())
.with_prefix("[-]")
.with_message(format!(
"Loading data from {}.{}",
table.to_string(),
col.to_string()
));
let loading = mp.add(loading);
loading.enable_steady_tick(Duration::from_millis(100));
let res = get_vec::<U>(&db, query).await?;
let models: Vec<(String, V)> = res
.iter()
.filter(|(_, r)| r.clone().into_iter().count() > 0)
.map(|(id, r)| (id.clone(), <V>::from(r.clone())))
.collect();
loading.finish_and_clear();
convert_col(&db, table.clone(), col.clone()).await?;
let progress = ProgressBar::new(models.len() as u64)
.with_style(
ProgressStyle::with_template("{prefix} {msg} {wide_bar} {pos}/{len}")
.unwrap()
.progress_chars("##-"),
)
.with_prefix("[*]")
.with_message(format!("Copying {}.{}", table.to_string(), col.to_string()));
let progress = mp.add(progress);
for model in models {
progress.inc(1);
let q = Query::update()
.table(table.clone())
.values([(col.clone(), model.1.into())])
.and_where(Expr::col(id.clone()).eq(model.0))
.to_string(PostgresQueryBuilder);
db.query_one(Statement::from_string(DbBackend::Postgres, q))
.await?;
}
progress.finish_with_message(format!("Done {}.{}", table.to_string(), col.to_string()));
Ok(())
}
#[derive(Iden, Clone)]
enum AccessToken {
Table,
Id,
Permission,
}
#[derive(Iden, Clone)]
enum Antenna {
Table,
Id,
Users,
}
#[derive(Iden, Clone)]
enum App {
Table,
Id,
Permission,
}
#[derive(Iden, Clone)]
enum Emoji {
Table,
Id,
Aliases,
}
#[derive(Iden, Clone)]
enum GalleryPost {
Table,
Id,
#[iden = "fileIds"]
FileIds,
Tags,
}
#[derive(Iden, Clone)]
enum Hashtag {
Table,
Id,
#[iden = "mentionedUserIds"]
MentionedUserIds,
#[iden = "mentionedLocalUserIds"]
MentionedLocalUserIds,
#[iden = "mentionedRemoteUserIds"]
MentionedRemoteUserIds,
#[iden = "attachedUserIds"]
AttachedUserIds,
#[iden = "attachedLocalUserIds"]
AttachedLocalUserIds,
#[iden = "attachedRemoteUserIds"]
AttachedRemoteUserIds,
}
#[derive(Iden, Clone)]
enum MessagingMessage {
Table,
Id,
Reads,
}
#[derive(Iden, Clone)]
enum Meta {
Table,
Id,
Langs,
#[iden = "hiddenTags"]
HiddenTags,
#[iden = "blockedHosts"]
BlockedHosts,
#[iden = "pinnedUsers"]
PinnedUsers,
#[iden = "pinnedPages"]
PinnedPages,
#[iden = "recommendedInstances"]
RecommendedInstances,
#[iden = "silencedHosts"]
SilencedHosts,
}
#[derive(Iden, Clone)]
enum Note {
Table,
Id,
#[iden = "fileIds"]
FileIds,
#[iden = "attachedFileTypes"]
AttachedFileTypes,
#[iden = "visibleUserIds"]
VisibleUserIds,
Mentions,
Emojis,
Tags,
}
#[derive(Iden, Clone)]
enum NoteEdit {
Table,
Id,
#[iden = "fileIds"]
FileIds,
}
#[derive(Iden, Clone)]
enum Page {
Table,
Id,
#[iden = "visibleUserIds"]
VisibleUserIds,
}
#[derive(Iden, Clone)]
enum Poll {
Table,
#[iden = "noteId"]
NoteId,
Choices,
Votes, // I32Vec
}
#[derive(Iden, Clone)]
enum RegistryItem {
Table,
Id,
Scope,
}
#[derive(Iden, Clone)]
enum User {
Table,
Id,
Tags,
Emojis,
}
#[derive(Iden, Clone)]
enum UserProfile {
Table,
#[iden = "userId"]
UserId,
#[iden = "mutingNotificationTypes"]
MutingNotificationTypes,
}
#[derive(Iden, Clone)]
enum Webhook {
Table,
Id,
On,
}

View File

@ -1,3 +0,0 @@
# `native-utils-android-arm-eabi`
This is the **armv7-linux-androideabi** binary for `native-utils`

View File

@ -1,18 +0,0 @@
{
"name": "native-utils-android-arm-eabi",
"version": "0.0.0",
"os": [
"android"
],
"cpu": [
"arm"
],
"main": "native-utils.android-arm-eabi.node",
"files": [
"native-utils.android-arm-eabi.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}

View File

@ -1,3 +0,0 @@
# `native-utils-android-arm64`
This is the **aarch64-linux-android** binary for `native-utils`

View File

@ -1,18 +0,0 @@
{
"name": "native-utils-android-arm64",
"version": "0.0.0",
"os": [
"android"
],
"cpu": [
"arm64"
],
"main": "native-utils.android-arm64.node",
"files": [
"native-utils.android-arm64.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}

View File

@ -1,3 +0,0 @@
# `native-utils-darwin-arm64`
This is the **aarch64-apple-darwin** binary for `native-utils`

View File

@ -1,18 +0,0 @@
{
"name": "native-utils-darwin-arm64",
"version": "0.0.0",
"os": [
"darwin"
],
"cpu": [
"arm64"
],
"main": "native-utils.darwin-arm64.node",
"files": [
"native-utils.darwin-arm64.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}

View File

@ -1,3 +0,0 @@
# `native-utils-darwin-universal`
This is the **universal-apple-darwin** binary for `native-utils`

View File

@ -1,15 +0,0 @@
{
"name": "native-utils-darwin-universal",
"version": "0.0.0",
"os": [
"darwin"
],
"main": "native-utils.darwin-universal.node",
"files": [
"native-utils.darwin-universal.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}

View File

@ -1,3 +0,0 @@
# `native-utils-darwin-x64`
This is the **x86_64-apple-darwin** binary for `native-utils`

View File

@ -1,18 +0,0 @@
{
"name": "native-utils-darwin-x64",
"version": "0.0.0",
"os": [
"darwin"
],
"cpu": [
"x64"
],
"main": "native-utils.darwin-x64.node",
"files": [
"native-utils.darwin-x64.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}

View File

@ -1,3 +0,0 @@
# `native-utils-freebsd-x64`
This is the **x86_64-unknown-freebsd** binary for `native-utils`

View File

@ -1,18 +0,0 @@
{
"name": "native-utils-freebsd-x64",
"version": "0.0.0",
"os": [
"freebsd"
],
"cpu": [
"x64"
],
"main": "native-utils.freebsd-x64.node",
"files": [
"native-utils.freebsd-x64.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}

View File

@ -1,3 +0,0 @@
# `native-utils-linux-arm-gnueabihf`
This is the **armv7-unknown-linux-gnueabihf** binary for `native-utils`

View File

@ -1,18 +0,0 @@
{
"name": "native-utils-linux-arm-gnueabihf",
"version": "0.0.0",
"os": [
"linux"
],
"cpu": [
"arm"
],
"main": "native-utils.linux-arm-gnueabihf.node",
"files": [
"native-utils.linux-arm-gnueabihf.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}

View File

@ -1,3 +0,0 @@
# `native-utils-linux-arm64-gnu`
This is the **aarch64-unknown-linux-gnu** binary for `native-utils`

View File

@ -1,21 +0,0 @@
{
"name": "native-utils-linux-arm64-gnu",
"version": "0.0.0",
"os": [
"linux"
],
"cpu": [
"arm64"
],
"main": "native-utils.linux-arm64-gnu.node",
"files": [
"native-utils.linux-arm64-gnu.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
},
"libc": [
"glibc"
]
}

View File

@ -1,3 +0,0 @@
# `native-utils-linux-arm64-musl`
This is the **aarch64-unknown-linux-musl** binary for `native-utils`

View File

@ -1,21 +0,0 @@
{
"name": "native-utils-linux-arm64-musl",
"version": "0.0.0",
"os": [
"linux"
],
"cpu": [
"arm64"
],
"main": "native-utils.linux-arm64-musl.node",
"files": [
"native-utils.linux-arm64-musl.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
},
"libc": [
"musl"
]
}

View File

@ -1,3 +0,0 @@
# `native-utils-linux-x64-gnu`
This is the **x86_64-unknown-linux-gnu** binary for `native-utils`

View File

@ -1,21 +0,0 @@
{
"name": "native-utils-linux-x64-gnu",
"version": "0.0.0",
"os": [
"linux"
],
"cpu": [
"x64"
],
"main": "native-utils.linux-x64-gnu.node",
"files": [
"native-utils.linux-x64-gnu.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
},
"libc": [
"glibc"
]
}

View File

@ -1,3 +0,0 @@
# `native-utils-linux-x64-musl`
This is the **x86_64-unknown-linux-musl** binary for `native-utils`

View File

@ -1,21 +0,0 @@
{
"name": "native-utils-linux-x64-musl",
"version": "0.0.0",
"os": [
"linux"
],
"cpu": [
"x64"
],
"main": "native-utils.linux-x64-musl.node",
"files": [
"native-utils.linux-x64-musl.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
},
"libc": [
"musl"
]
}

View File

@ -1,3 +0,0 @@
# `native-utils-win32-arm64-msvc`
This is the **aarch64-pc-windows-msvc** binary for `native-utils`

View File

@ -1,18 +0,0 @@
{
"name": "native-utils-win32-arm64-msvc",
"version": "0.0.0",
"os": [
"win32"
],
"cpu": [
"arm64"
],
"main": "native-utils.win32-arm64-msvc.node",
"files": [
"native-utils.win32-arm64-msvc.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}

View File

@ -1,3 +0,0 @@
# `native-utils-win32-ia32-msvc`
This is the **i686-pc-windows-msvc** binary for `native-utils`

View File

@ -1,18 +0,0 @@
{
"name": "native-utils-win32-ia32-msvc",
"version": "0.0.0",
"os": [
"win32"
],
"cpu": [
"ia32"
],
"main": "native-utils.win32-ia32-msvc.node",
"files": [
"native-utils.win32-ia32-msvc.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}

View File

@ -1,3 +0,0 @@
# `native-utils-win32-x64-msvc`
This is the **x86_64-pc-windows-msvc** binary for `native-utils`

View File

@ -1,18 +0,0 @@
{
"name": "native-utils-win32-x64-msvc",
"version": "0.0.0",
"os": [
"win32"
],
"cpu": [
"x64"
],
"main": "native-utils.win32-x64-msvc.node",
"files": [
"native-utils.win32-x64-msvc.node"
],
"license": "MIT",
"engines": {
"node": ">= 10"
}
}

View File

@ -1,50 +0,0 @@
{
"name": "native-utils",
"version": "0.0.0",
"main": "built/index.js",
"types": "built/index.d.ts",
"napi": {
"name": "native-utils",
"triples": {
"additional": [
"aarch64-apple-darwin",
"aarch64-linux-android",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"aarch64-pc-windows-msvc",
"armv7-unknown-linux-gnueabihf",
"x86_64-unknown-linux-musl",
"x86_64-unknown-freebsd",
"i686-pc-windows-msvc",
"armv7-linux-androideabi",
"universal-apple-darwin"
]
}
},
"license": "MIT",
"devDependencies": {
"@napi-rs/cli": "2.16.1",
"ava": "5.1.1"
},
"ava": {
"timeout": "3m"
},
"engines": {
"node": ">= 10"
},
"scripts": {
"artifacts": "napi artifacts",
"build": "pnpm run build:napi && pnpm run build:migration",
"build:napi": "napi build --features napi --platform --release ./built/",
"build:migration": "cargo build --locked --release --manifest-path ./migration/Cargo.toml && cp ./target/release/migration ./built/migration",
"build:debug": "napi build --platform ./built/ && cargo build --manifest-path ./migration/Cargo.toml",
"prepublishOnly": "napi prepublish -t npm",
"test": "pnpm run cargo:test && pnpm run build:napi && ava",
"universal": "napi universal",
"version": "napi version",
"format": "cargo fmt --all",
"cargo:test": "pnpm run cargo:unit && pnpm run cargo:integration",
"cargo:unit": "cargo test unit_test && cargo test -F napi unit_test",
"cargo:integration": "cargo test -F noarray int_test -- --test-threads=1"
}
}

View File

@ -1,13 +0,0 @@
use sea_orm::error::DbErr;
use crate::impl_into_napi_error;
#[derive(thiserror::Error, Debug, PartialEq, Eq)]
pub enum Error {
#[error("The database connections have not been initialized yet")]
Uninitialized,
#[error("ORM error: {0}")]
OrmError(#[from] DbErr),
}
impl_into_napi_error!(Error);

View File

@ -1,38 +0,0 @@
pub mod error;
use cfg_if::cfg_if;
use error::Error;
use sea_orm::{Database, DbConn};
static DB_CONN: once_cell::sync::OnceCell<DbConn> = once_cell::sync::OnceCell::new();
pub async fn init_database(conn_uri: impl Into<String>) -> Result<(), Error> {
let conn = Database::connect(conn_uri.into()).await?;
DB_CONN.get_or_init(move || conn);
Ok(())
}
pub fn get_database() -> Result<&'static DbConn, Error> {
DB_CONN.get().ok_or(Error::Uninitialized)
}
cfg_if! {
if #[cfg(feature = "napi")] {
use napi_derive::napi;
#[napi]
pub async fn native_init_database(conn_uri: String) -> napi::Result<()> {
init_database(conn_uri).await.map_err(Into::into)
}
}
}
#[cfg(test)]
mod unit_test {
use super::{error::Error, get_database};
#[test]
fn error_uninitialized() {
assert_eq!(get_database().unwrap_err(), Error::Uninitialized);
}
}

View File

@ -1,7 +0,0 @@
pub mod database;
pub mod macros;
pub mod model;
pub mod util;
#[cfg(feature = "napi")]
pub mod mastodon_api;

View File

@ -1,11 +0,0 @@
#[macro_export]
macro_rules! impl_into_napi_error {
($a:ty) => {
#[cfg(feature = "napi")]
impl Into<napi::Error> for $a {
fn into(self) -> napi::Error {
napi::Error::from_reason(self.to_string())
}
}
};
}

View File

@ -1,70 +0,0 @@
use napi::{bindgen_prelude::*, Error, Status};
use napi_derive::napi;
static CHAR_COLLECTION: &str = "0123456789abcdefghijklmnopqrstuvwxyz";
// -- NAPI exports --
#[napi]
pub enum IdConvertType {
MastodonId,
CalckeyId,
}
#[napi]
pub fn convert_id(in_id: String, id_convert_type: IdConvertType) -> napi::Result<String> {
use IdConvertType::*;
match id_convert_type {
MastodonId => {
let mut out: i64 = 0;
for (i, c) in in_id.to_lowercase().chars().rev().enumerate() {
out += num_from_char(c)? as i64 * 36_i64.pow(i as u32);
}
Ok(out.to_string())
}
CalckeyId => {
let mut input: i64 = match in_id.parse() {
Ok(s) => s,
Err(_) => {
return Err(Error::new(
Status::InvalidArg,
"Unable to parse ID as MastodonId",
))
}
};
let mut out = String::new();
while input != 0 {
out.insert(0, char_from_num((input % 36) as u8)?);
input /= 36;
}
Ok(out)
}
}
}
// -- end --
#[inline(always)]
fn num_from_char(character: char) -> napi::Result<u8> {
for (i, c) in CHAR_COLLECTION.chars().enumerate() {
if c == character {
return Ok(i as u8);
}
}
Err(Error::new(
Status::InvalidArg,
"Invalid character in parsed base36 id",
))
}
#[inline(always)]
fn char_from_num(number: u8) -> napi::Result<char> {
CHAR_COLLECTION
.chars()
.nth(number as usize)
.ok_or(Error::from_status(Status::Unknown))
}

View File

@ -1,74 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
pub mod prelude;
pub mod abuse_user_report;
pub mod access_token;
pub mod ad;
pub mod announcement;
pub mod announcement_read;
pub mod antenna;
pub mod antenna_note;
pub mod app;
pub mod attestation_challenge;
pub mod auth_session;
pub mod blocking;
pub mod channel;
pub mod channel_following;
pub mod channel_note_pining;
pub mod clip;
pub mod clip_note;
pub mod drive_file;
pub mod drive_folder;
pub mod emoji;
pub mod follow_request;
pub mod following;
pub mod gallery_like;
pub mod gallery_post;
pub mod hashtag;
pub mod instance;
pub mod messaging_message;
pub mod meta;
pub mod migrations;
pub mod moderation_log;
pub mod muted_note;
pub mod muting;
pub mod newtype;
pub mod note;
pub mod note_edit;
pub mod note_favorite;
pub mod note_reaction;
pub mod note_thread_muting;
pub mod note_unread;
pub mod note_watching;
pub mod notification;
pub mod page;
pub mod page_like;
pub mod password_reset_request;
pub mod poll;
pub mod poll_vote;
pub mod promo_note;
pub mod promo_read;
pub mod registration_ticket;
pub mod registry_item;
pub mod relay;
pub mod renote_muting;
pub mod sea_orm_active_enums;
pub mod signin;
pub mod sw_subscription;
pub mod used_username;
pub mod user;
pub mod user_group;
pub mod user_group_invitation;
pub mod user_group_invite;
pub mod user_group_joining;
pub mod user_ip;
pub mod user_keypair;
pub mod user_list;
pub mod user_list_joining;
pub mod user_note_pining;
pub mod user_pending;
pub mod user_profile;
pub mod user_publickey;
pub mod user_security_key;
pub mod webhook;

View File

@ -1,55 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "abuse_user_report")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "targetUserId")]
pub target_user_id: String,
#[sea_orm(column_name = "reporterId")]
pub reporter_id: String,
#[sea_orm(column_name = "assigneeId")]
pub assignee_id: Option<String>,
pub resolved: bool,
pub comment: String,
#[sea_orm(column_name = "targetUserHost")]
pub target_user_host: Option<String>,
#[sea_orm(column_name = "reporterHost")]
pub reporter_host: Option<String>,
pub forwarded: bool,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::ReporterId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User3,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::AssigneeId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "SetNull"
)]
User2,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::TargetUserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User1,
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,71 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use super::newtype::StringVec;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "access_token")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
pub token: String,
pub hash: String,
#[sea_orm(column_name = "userId")]
pub user_id: String,
#[sea_orm(column_name = "appId")]
pub app_id: Option<String>,
#[sea_orm(column_name = "lastUsedAt")]
pub last_used_at: Option<DateTimeWithTimeZone>,
pub session: Option<String>,
pub name: Option<String>,
pub description: Option<String>,
#[sea_orm(column_name = "iconUrl")]
pub icon_url: Option<String>,
pub permission: StringVec,
pub fetched: bool,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::app::Entity",
from = "Column::AppId",
to = "super::app::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
App,
#[sea_orm(has_many = "super::notification::Entity")]
Notification,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User,
}
impl Related<super::app::Entity> for Entity {
fn to() -> RelationDef {
Relation::App.def()
}
}
impl Related<super::notification::Entity> for Entity {
fn to() -> RelationDef {
Relation::Notification.def()
}
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,26 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "ad")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "expiresAt")]
pub expires_at: DateTimeWithTimeZone,
pub place: String,
pub priority: String,
pub url: String,
#[sea_orm(column_name = "imageUrl")]
pub image_url: String,
pub memo: String,
pub ratio: i32,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,32 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "announcement")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
pub text: String,
pub title: String,
#[sea_orm(column_name = "imageUrl")]
pub image_url: Option<String>,
#[sea_orm(column_name = "updatedAt")]
pub updated_at: Option<DateTimeWithTimeZone>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::announcement_read::Entity")]
AnnouncementRead,
}
impl Related<super::announcement_read::Entity> for Entity {
fn to() -> RelationDef {
Relation::AnnouncementRead.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,50 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "announcement_read")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "userId")]
pub user_id: String,
#[sea_orm(column_name = "announcementId")]
pub announcement_id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::announcement::Entity",
from = "Column::AnnouncementId",
to = "super::announcement::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
Announcement,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User,
}
impl Related<super::announcement::Entity> for Entity {
fn to() -> RelationDef {
Relation::Announcement.def()
}
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,92 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use super::{newtype, sea_orm_active_enums::AntennaSrcEnum};
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "antenna")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "userId")]
pub user_id: String,
pub name: String,
pub src: AntennaSrcEnum,
#[sea_orm(column_name = "userListId")]
pub user_list_id: Option<String>,
#[sea_orm(column_type = "JsonBinary")]
pub keywords: newtype::JsonKeyword,
#[sea_orm(column_name = "withFile")]
pub with_file: bool,
pub expression: Option<String>,
pub notify: bool,
#[sea_orm(column_name = "caseSensitive")]
pub case_sensitive: bool,
#[sea_orm(column_name = "withReplies")]
pub with_replies: bool,
#[sea_orm(column_name = "userGroupJoiningId")]
pub user_group_joining_id: Option<String>,
pub users: newtype::StringVec,
#[sea_orm(column_name = "excludeKeywords", column_type = "JsonBinary")]
pub exclude_keywords: newtype::JsonKeyword,
#[sea_orm(column_type = "JsonBinary")]
pub instances: newtype::JsonStringVec,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::antenna_note::Entity")]
AntennaNote,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User,
#[sea_orm(
belongs_to = "super::user_group_joining::Entity",
from = "Column::UserGroupJoiningId",
to = "super::user_group_joining::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
UserGroupJoining,
#[sea_orm(
belongs_to = "super::user_list::Entity",
from = "Column::UserListId",
to = "super::user_list::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
UserList,
}
impl Related<super::antenna_note::Entity> for Entity {
fn to() -> RelationDef {
Relation::AntennaNote.def()
}
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl Related<super::user_group_joining::Entity> for Entity {
fn to() -> RelationDef {
Relation::UserGroupJoining.def()
}
}
impl Related<super::user_list::Entity> for Entity {
fn to() -> RelationDef {
Relation::UserList.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,49 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "antenna_note")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "noteId")]
pub note_id: String,
#[sea_orm(column_name = "antennaId")]
pub antenna_id: String,
pub read: bool,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::antenna::Entity",
from = "Column::AntennaId",
to = "super::antenna::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
Antenna,
#[sea_orm(
belongs_to = "super::note::Entity",
from = "Column::NoteId",
to = "super::note::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
Note,
}
impl Related<super::antenna::Entity> for Entity {
fn to() -> RelationDef {
Relation::Antenna.def()
}
}
impl Related<super::note::Entity> for Entity {
fn to() -> RelationDef {
Relation::Note.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,58 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use super::newtype::StringVec;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "app")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "userId")]
pub user_id: Option<String>,
pub secret: String,
pub name: String,
pub description: String,
pub permission: StringVec,
#[sea_orm(column_name = "callbackUrl")]
pub callback_url: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::access_token::Entity")]
AccessToken,
#[sea_orm(has_many = "super::auth_session::Entity")]
AuthSession,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "SetNull"
)]
User,
}
impl Related<super::access_token::Entity> for Entity {
fn to() -> RelationDef {
Relation::AccessToken.def()
}
}
impl Related<super::auth_session::Entity> for Entity {
fn to() -> RelationDef {
Relation::AuthSession.def()
}
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,37 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "attestation_challenge")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "userId", primary_key, auto_increment = false)]
pub user_id: String,
pub challenge: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "registrationChallenge")]
pub registration_challenge: bool,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User,
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,51 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "auth_session")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
pub token: String,
#[sea_orm(column_name = "userId")]
pub user_id: Option<String>,
#[sea_orm(column_name = "appId")]
pub app_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::app::Entity",
from = "Column::AppId",
to = "super::app::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
App,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User,
}
impl Related<super::app::Entity> for Entity {
fn to() -> RelationDef {
Relation::App.def()
}
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,38 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "blocking")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "blockeeId")]
pub blockee_id: String,
#[sea_orm(column_name = "blockerId")]
pub blocker_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::BlockerId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User2,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::BlockeeId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User1,
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,82 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "channel")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "lastNotedAt")]
pub last_noted_at: Option<DateTimeWithTimeZone>,
#[sea_orm(column_name = "userId")]
pub user_id: Option<String>,
pub name: String,
pub description: Option<String>,
#[sea_orm(column_name = "bannerId")]
pub banner_id: Option<String>,
#[sea_orm(column_name = "notesCount")]
pub notes_count: i32,
#[sea_orm(column_name = "usersCount")]
pub users_count: i32,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::channel_following::Entity")]
ChannelFollowing,
#[sea_orm(has_many = "super::channel_note_pining::Entity")]
ChannelNotePining,
#[sea_orm(
belongs_to = "super::drive_file::Entity",
from = "Column::BannerId",
to = "super::drive_file::Column::Id",
on_update = "NoAction",
on_delete = "SetNull"
)]
DriveFile,
#[sea_orm(has_many = "super::note::Entity")]
Note,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "SetNull"
)]
User,
}
impl Related<super::channel_following::Entity> for Entity {
fn to() -> RelationDef {
Relation::ChannelFollowing.def()
}
}
impl Related<super::channel_note_pining::Entity> for Entity {
fn to() -> RelationDef {
Relation::ChannelNotePining.def()
}
}
impl Related<super::drive_file::Entity> for Entity {
fn to() -> RelationDef {
Relation::DriveFile.def()
}
}
impl Related<super::note::Entity> for Entity {
fn to() -> RelationDef {
Relation::Note.def()
}
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,50 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "channel_following")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "followeeId")]
pub followee_id: String,
#[sea_orm(column_name = "followerId")]
pub follower_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::channel::Entity",
from = "Column::FolloweeId",
to = "super::channel::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
Channel,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::FollowerId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User,
}
impl Related<super::channel::Entity> for Entity {
fn to() -> RelationDef {
Relation::Channel.def()
}
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,50 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "channel_note_pining")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "channelId")]
pub channel_id: String,
#[sea_orm(column_name = "noteId")]
pub note_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::channel::Entity",
from = "Column::ChannelId",
to = "super::channel::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
Channel,
#[sea_orm(
belongs_to = "super::note::Entity",
from = "Column::NoteId",
to = "super::note::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
Note,
}
impl Related<super::channel::Entity> for Entity {
fn to() -> RelationDef {
Relation::Channel.def()
}
}
impl Related<super::note::Entity> for Entity {
fn to() -> RelationDef {
Relation::Note.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,46 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "clip")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "userId")]
pub user_id: String,
pub name: String,
#[sea_orm(column_name = "isPublic")]
pub is_public: bool,
pub description: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::clip_note::Entity")]
ClipNote,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User,
}
impl Related<super::clip_note::Entity> for Entity {
fn to() -> RelationDef {
Relation::ClipNote.def()
}
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,48 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "clip_note")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "noteId")]
pub note_id: String,
#[sea_orm(column_name = "clipId")]
pub clip_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::clip::Entity",
from = "Column::ClipId",
to = "super::clip::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
Clip,
#[sea_orm(
belongs_to = "super::note::Entity",
from = "Column::NoteId",
to = "super::note::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
Note,
}
impl Related<super::clip::Entity> for Entity {
fn to() -> RelationDef {
Relation::Clip.def()
}
}
impl Related<super::note::Entity> for Entity {
fn to() -> RelationDef {
Relation::Note.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,113 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "drive_file")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "userId")]
pub user_id: Option<String>,
#[sea_orm(column_name = "userHost")]
pub user_host: Option<String>,
pub md5: String,
pub name: String,
pub r#type: String,
pub size: i32,
pub comment: Option<String>,
#[sea_orm(column_type = "JsonBinary")]
pub properties: Json,
#[sea_orm(column_name = "storedInternal")]
pub stored_internal: bool,
pub url: String,
#[sea_orm(column_name = "thumbnailUrl")]
pub thumbnail_url: Option<String>,
#[sea_orm(column_name = "webpublicUrl")]
pub webpublic_url: Option<String>,
#[sea_orm(column_name = "accessKey")]
pub access_key: Option<String>,
#[sea_orm(column_name = "thumbnailAccessKey")]
pub thumbnail_access_key: Option<String>,
#[sea_orm(column_name = "webpublicAccessKey")]
pub webpublic_access_key: Option<String>,
pub uri: Option<String>,
pub src: Option<String>,
#[sea_orm(column_name = "folderId")]
pub folder_id: Option<String>,
#[sea_orm(column_name = "isSensitive")]
pub is_sensitive: bool,
#[sea_orm(column_name = "isLink")]
pub is_link: bool,
pub blurhash: Option<String>,
#[sea_orm(column_name = "webpublicType")]
pub webpublic_type: Option<String>,
#[sea_orm(column_name = "requestHeaders", column_type = "JsonBinary", nullable)]
pub request_headers: Option<Json>,
#[sea_orm(column_name = "requestIp")]
pub request_ip: Option<String>,
#[sea_orm(column_name = "maybeSensitive")]
pub maybe_sensitive: bool,
#[sea_orm(column_name = "maybePorn")]
pub maybe_porn: bool,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::channel::Entity")]
Channel,
#[sea_orm(
belongs_to = "super::drive_folder::Entity",
from = "Column::FolderId",
to = "super::drive_folder::Column::Id",
on_update = "NoAction",
on_delete = "SetNull"
)]
DriveFolder,
#[sea_orm(has_many = "super::messaging_message::Entity")]
MessagingMessage,
#[sea_orm(has_many = "super::page::Entity")]
Page,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "SetNull"
)]
User,
}
impl Related<super::channel::Entity> for Entity {
fn to() -> RelationDef {
Relation::Channel.def()
}
}
impl Related<super::drive_folder::Entity> for Entity {
fn to() -> RelationDef {
Relation::DriveFolder.def()
}
}
impl Related<super::messaging_message::Entity> for Entity {
fn to() -> RelationDef {
Relation::MessagingMessage.def()
}
}
impl Related<super::page::Entity> for Entity {
fn to() -> RelationDef {
Relation::Page.def()
}
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,53 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "drive_folder")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
pub name: String,
#[sea_orm(column_name = "userId")]
pub user_id: Option<String>,
#[sea_orm(column_name = "parentId")]
pub parent_id: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::drive_file::Entity")]
DriveFile,
#[sea_orm(
belongs_to = "Entity",
from = "Column::ParentId",
to = "Column::Id",
on_update = "NoAction",
on_delete = "SetNull"
)]
SelfRef,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User,
}
impl Related<super::drive_file::Entity> for Entity {
fn to() -> RelationDef {
Relation::DriveFile.def()
}
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,32 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use super::newtype::StringVec;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "emoji")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "updatedAt")]
pub updated_at: Option<DateTimeWithTimeZone>,
pub name: String,
pub host: Option<String>,
#[sea_orm(column_name = "originalUrl")]
pub original_url: String,
pub uri: Option<String>,
pub r#type: Option<String>,
pub aliases: StringVec,
pub category: Option<String>,
#[sea_orm(column_name = "publicUrl")]
pub public_url: String,
pub license: Option<String>,
pub width: Option<i32>,
pub height: Option<i32>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,60 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "follow_request")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "followeeId")]
pub followee_id: String,
#[sea_orm(column_name = "followerId")]
pub follower_id: String,
#[sea_orm(column_name = "requestId")]
pub request_id: Option<String>,
#[sea_orm(column_name = "followerHost")]
pub follower_host: Option<String>,
#[sea_orm(column_name = "followerInbox")]
pub follower_inbox: Option<String>,
#[sea_orm(column_name = "followerSharedInbox")]
pub follower_shared_inbox: Option<String>,
#[sea_orm(column_name = "followeeHost")]
pub followee_host: Option<String>,
#[sea_orm(column_name = "followeeInbox")]
pub followee_inbox: Option<String>,
#[sea_orm(column_name = "followeeSharedInbox")]
pub followee_shared_inbox: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::notification::Entity")]
Notification,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::FolloweeId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User2,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::FollowerId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User1,
}
impl Related<super::notification::Entity> for Entity {
fn to() -> RelationDef {
Relation::Notification.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,50 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "following")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "followeeId")]
pub followee_id: String,
#[sea_orm(column_name = "followerId")]
pub follower_id: String,
#[sea_orm(column_name = "followerHost")]
pub follower_host: Option<String>,
#[sea_orm(column_name = "followerInbox")]
pub follower_inbox: Option<String>,
#[sea_orm(column_name = "followerSharedInbox")]
pub follower_shared_inbox: Option<String>,
#[sea_orm(column_name = "followeeHost")]
pub followee_host: Option<String>,
#[sea_orm(column_name = "followeeInbox")]
pub followee_inbox: Option<String>,
#[sea_orm(column_name = "followeeSharedInbox")]
pub followee_shared_inbox: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::FolloweeId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User2,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::FollowerId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User1,
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,50 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "gallery_like")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "userId")]
pub user_id: String,
#[sea_orm(column_name = "postId")]
pub post_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::gallery_post::Entity",
from = "Column::PostId",
to = "super::gallery_post::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
GalleryPost,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User,
}
impl Related<super::gallery_post::Entity> for Entity {
fn to() -> RelationDef {
Relation::GalleryPost.def()
}
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,55 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use super::newtype::StringVec;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "gallery_post")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "updatedAt")]
pub updated_at: DateTimeWithTimeZone,
pub title: String,
pub description: Option<String>,
#[sea_orm(column_name = "userId")]
pub user_id: String,
#[sea_orm(column_name = "fileIds")]
pub file_ids: StringVec,
#[sea_orm(column_name = "isSensitive")]
pub is_sensitive: bool,
#[sea_orm(column_name = "likedCount")]
pub liked_count: i32,
pub tags: StringVec,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::gallery_like::Entity")]
GalleryLike,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User,
}
impl Related<super::gallery_like::Entity> for Entity {
fn to() -> RelationDef {
Relation::GalleryLike.def()
}
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,42 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use super::newtype::StringVec;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "hashtag")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
pub name: String,
#[sea_orm(column_name = "mentionedUserIds")]
pub mentioned_user_ids: StringVec,
#[sea_orm(column_name = "mentionedUsersCount")]
pub mentioned_users_count: i32,
#[sea_orm(column_name = "mentionedLocalUserIds")]
pub mentioned_local_user_ids: StringVec,
#[sea_orm(column_name = "mentionedLocalUsersCount")]
pub mentioned_local_users_count: i32,
#[sea_orm(column_name = "mentionedRemoteUserIds")]
pub mentioned_remote_user_ids: StringVec,
#[sea_orm(column_name = "mentionedRemoteUsersCount")]
pub mentioned_remote_users_count: i32,
#[sea_orm(column_name = "attachedUserIds")]
pub attached_user_ids: StringVec,
#[sea_orm(column_name = "attachedUsersCount")]
pub attached_users_count: i32,
#[sea_orm(column_name = "attachedLocalUserIds")]
pub attached_local_user_ids: StringVec,
#[sea_orm(column_name = "attachedLocalUsersCount")]
pub attached_local_users_count: i32,
#[sea_orm(column_name = "attachedRemoteUserIds")]
pub attached_remote_user_ids: StringVec,
#[sea_orm(column_name = "attachedRemoteUsersCount")]
pub attached_remote_users_count: i32,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,58 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "instance")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "caughtAt")]
pub caught_at: DateTimeWithTimeZone,
pub host: String,
#[sea_orm(column_name = "usersCount")]
pub users_count: i32,
#[sea_orm(column_name = "notesCount")]
pub notes_count: i32,
#[sea_orm(column_name = "followingCount")]
pub following_count: i32,
#[sea_orm(column_name = "followersCount")]
pub followers_count: i32,
#[sea_orm(column_name = "latestRequestSentAt")]
pub latest_request_sent_at: Option<DateTimeWithTimeZone>,
#[sea_orm(column_name = "latestStatus")]
pub latest_status: Option<i32>,
#[sea_orm(column_name = "latestRequestReceivedAt")]
pub latest_request_received_at: Option<DateTimeWithTimeZone>,
#[sea_orm(column_name = "lastCommunicatedAt")]
pub last_communicated_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "isNotResponding")]
pub is_not_responding: bool,
#[sea_orm(column_name = "softwareName")]
pub software_name: Option<String>,
#[sea_orm(column_name = "softwareVersion")]
pub software_version: Option<String>,
#[sea_orm(column_name = "openRegistrations")]
pub open_registrations: Option<bool>,
pub name: Option<String>,
pub description: Option<String>,
#[sea_orm(column_name = "maintainerName")]
pub maintainer_name: Option<String>,
#[sea_orm(column_name = "maintainerEmail")]
pub maintainer_email: Option<String>,
#[sea_orm(column_name = "infoUpdatedAt")]
pub info_updated_at: Option<DateTimeWithTimeZone>,
#[sea_orm(column_name = "isSuspended")]
pub is_suspended: bool,
#[sea_orm(column_name = "iconUrl")]
pub icon_url: Option<String>,
#[sea_orm(column_name = "themeColor")]
pub theme_color: Option<String>,
#[sea_orm(column_name = "faviconUrl")]
pub favicon_url: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,77 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use super::newtype::StringVec;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "messaging_message")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "userId")]
pub user_id: String,
#[sea_orm(column_name = "recipientId")]
pub recipient_id: Option<String>,
pub text: Option<String>,
#[sea_orm(column_name = "isRead")]
pub is_read: bool,
#[sea_orm(column_name = "fileId")]
pub file_id: Option<String>,
#[sea_orm(column_name = "groupId")]
pub group_id: Option<String>,
pub reads: StringVec,
pub uri: Option<String>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::drive_file::Entity",
from = "Column::FileId",
to = "super::drive_file::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
DriveFile,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User2,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::RecipientId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User1,
#[sea_orm(
belongs_to = "super::user_group::Entity",
from = "Column::GroupId",
to = "super::user_group::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
UserGroup,
}
impl Related<super::drive_file::Entity> for Entity {
fn to() -> RelationDef {
Relation::DriveFile.def()
}
}
impl Related<super::user_group::Entity> for Entity {
fn to() -> RelationDef {
Relation::UserGroup.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,212 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use super::sea_orm_active_enums::MetaSensitivemediadetectionEnum;
use super::sea_orm_active_enums::MetaSensitivemediadetectionsensitivityEnum;
use sea_orm::entity::prelude::*;
use super::newtype::StringVec;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "meta")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
pub name: Option<String>,
pub description: Option<String>,
#[sea_orm(column_name = "maintainerName")]
pub maintainer_name: Option<String>,
#[sea_orm(column_name = "maintainerEmail")]
pub maintainer_email: Option<String>,
#[sea_orm(column_name = "disableRegistration")]
pub disable_registration: bool,
#[sea_orm(column_name = "disableLocalTimeline")]
pub disable_local_timeline: bool,
#[sea_orm(column_name = "disableGlobalTimeline")]
pub disable_global_timeline: bool,
#[sea_orm(column_name = "useStarForReactionFallback")]
pub use_star_for_reaction_fallback: bool,
pub langs: StringVec,
#[sea_orm(column_name = "hiddenTags")]
pub hidden_tags: StringVec,
#[sea_orm(column_name = "blockedHosts")]
pub blocked_hosts: StringVec,
#[sea_orm(column_name = "mascotImageUrl")]
pub mascot_image_url: Option<String>,
#[sea_orm(column_name = "bannerUrl")]
pub banner_url: Option<String>,
#[sea_orm(column_name = "errorImageUrl")]
pub error_image_url: Option<String>,
#[sea_orm(column_name = "iconUrl")]
pub icon_url: Option<String>,
#[sea_orm(column_name = "cacheRemoteFiles")]
pub cache_remote_files: bool,
#[sea_orm(column_name = "enableRecaptcha")]
pub enable_recaptcha: bool,
#[sea_orm(column_name = "recaptchaSiteKey")]
pub recaptcha_site_key: Option<String>,
#[sea_orm(column_name = "recaptchaSecretKey")]
pub recaptcha_secret_key: Option<String>,
#[sea_orm(column_name = "localDriveCapacityMb")]
pub local_drive_capacity_mb: i32,
#[sea_orm(column_name = "remoteDriveCapacityMb")]
pub remote_drive_capacity_mb: i32,
#[sea_orm(column_name = "summalyProxy")]
pub summaly_proxy: Option<String>,
#[sea_orm(column_name = "enableEmail")]
pub enable_email: bool,
pub email: Option<String>,
#[sea_orm(column_name = "smtpSecure")]
pub smtp_secure: bool,
#[sea_orm(column_name = "smtpHost")]
pub smtp_host: Option<String>,
#[sea_orm(column_name = "smtpPort")]
pub smtp_port: Option<i32>,
#[sea_orm(column_name = "smtpUser")]
pub smtp_user: Option<String>,
#[sea_orm(column_name = "smtpPass")]
pub smtp_pass: Option<String>,
#[sea_orm(column_name = "enableServiceWorker")]
pub enable_service_worker: bool,
#[sea_orm(column_name = "swPublicKey")]
pub sw_public_key: Option<String>,
#[sea_orm(column_name = "swPrivateKey")]
pub sw_private_key: Option<String>,
#[sea_orm(column_name = "enableTwitterIntegration")]
pub enable_twitter_integration: bool,
#[sea_orm(column_name = "twitterConsumerKey")]
pub twitter_consumer_key: Option<String>,
#[sea_orm(column_name = "twitterConsumerSecret")]
pub twitter_consumer_secret: Option<String>,
#[sea_orm(column_name = "enableGithubIntegration")]
pub enable_github_integration: bool,
#[sea_orm(column_name = "githubClientId")]
pub github_client_id: Option<String>,
#[sea_orm(column_name = "githubClientSecret")]
pub github_client_secret: Option<String>,
#[sea_orm(column_name = "enableDiscordIntegration")]
pub enable_discord_integration: bool,
#[sea_orm(column_name = "discordClientId")]
pub discord_client_id: Option<String>,
#[sea_orm(column_name = "discordClientSecret")]
pub discord_client_secret: Option<String>,
#[sea_orm(column_name = "pinnedUsers")]
pub pinned_users: StringVec,
#[sea_orm(column_name = "ToSUrl")]
pub to_s_url: Option<String>,
#[sea_orm(column_name = "repositoryUrl")]
pub repository_url: String,
#[sea_orm(column_name = "feedbackUrl")]
pub feedback_url: Option<String>,
#[sea_orm(column_name = "useObjectStorage")]
pub use_object_storage: bool,
#[sea_orm(column_name = "objectStorageBucket")]
pub object_storage_bucket: Option<String>,
#[sea_orm(column_name = "objectStoragePrefix")]
pub object_storage_prefix: Option<String>,
#[sea_orm(column_name = "objectStorageBaseUrl")]
pub object_storage_base_url: Option<String>,
#[sea_orm(column_name = "objectStorageEndpoint")]
pub object_storage_endpoint: Option<String>,
#[sea_orm(column_name = "objectStorageRegion")]
pub object_storage_region: Option<String>,
#[sea_orm(column_name = "objectStorageAccessKey")]
pub object_storage_access_key: Option<String>,
#[sea_orm(column_name = "objectStorageSecretKey")]
pub object_storage_secret_key: Option<String>,
#[sea_orm(column_name = "objectStoragePort")]
pub object_storage_port: Option<i32>,
#[sea_orm(column_name = "objectStorageUseSSL")]
pub object_storage_use_ssl: bool,
#[sea_orm(column_name = "proxyAccountId")]
pub proxy_account_id: Option<String>,
#[sea_orm(column_name = "objectStorageUseProxy")]
pub object_storage_use_proxy: bool,
#[sea_orm(column_name = "enableHcaptcha")]
pub enable_hcaptcha: bool,
#[sea_orm(column_name = "hcaptchaSiteKey")]
pub hcaptcha_site_key: Option<String>,
#[sea_orm(column_name = "hcaptchaSecretKey")]
pub hcaptcha_secret_key: Option<String>,
#[sea_orm(column_name = "objectStorageSetPublicRead")]
pub object_storage_set_public_read: bool,
#[sea_orm(column_name = "pinnedPages")]
pub pinned_pages: StringVec,
#[sea_orm(column_name = "backgroundImageUrl")]
pub background_image_url: Option<String>,
#[sea_orm(column_name = "logoImageUrl")]
pub logo_image_url: Option<String>,
#[sea_orm(column_name = "pinnedClipId")]
pub pinned_clip_id: Option<String>,
#[sea_orm(column_name = "objectStorageS3ForcePathStyle")]
pub object_storage_s3_force_path_style: bool,
#[sea_orm(column_name = "allowedHosts")]
pub allowed_hosts: Option<StringVec>,
#[sea_orm(column_name = "secureMode")]
pub secure_mode: Option<bool>,
#[sea_orm(column_name = "privateMode")]
pub private_mode: Option<bool>,
#[sea_orm(column_name = "deeplAuthKey")]
pub deepl_auth_key: Option<String>,
#[sea_orm(column_name = "deeplIsPro")]
pub deepl_is_pro: bool,
#[sea_orm(column_name = "emailRequiredForSignup")]
pub email_required_for_signup: bool,
#[sea_orm(column_name = "themeColor")]
pub theme_color: Option<String>,
#[sea_orm(column_name = "defaultLightTheme")]
pub default_light_theme: Option<String>,
#[sea_orm(column_name = "defaultDarkTheme")]
pub default_dark_theme: Option<String>,
#[sea_orm(column_name = "sensitiveMediaDetection")]
pub sensitive_media_detection: MetaSensitivemediadetectionEnum,
#[sea_orm(column_name = "sensitiveMediaDetectionSensitivity")]
pub sensitive_media_detection_sensitivity: MetaSensitivemediadetectionsensitivityEnum,
#[sea_orm(column_name = "setSensitiveFlagAutomatically")]
pub set_sensitive_flag_automatically: bool,
#[sea_orm(column_name = "enableIpLogging")]
pub enable_ip_logging: bool,
#[sea_orm(column_name = "enableSensitiveMediaDetectionForVideos")]
pub enable_sensitive_media_detection_for_videos: bool,
#[sea_orm(column_name = "enableActiveEmailValidation")]
pub enable_active_email_validation: bool,
#[sea_orm(column_name = "customMOTD")]
pub custom_motd: StringVec,
#[sea_orm(column_name = "customSplashIcons")]
pub custom_splash_icons: StringVec,
#[sea_orm(column_name = "disableRecommendedTimeline")]
pub disable_recommended_timeline: bool,
#[sea_orm(column_name = "recommendedInstances")]
pub recommended_instances: StringVec,
#[sea_orm(column_name = "enableGuestTimeline")]
pub enable_guest_timeline: bool,
#[sea_orm(column_name = "defaultReaction")]
pub default_reaction: String,
#[sea_orm(column_name = "libreTranslateApiUrl")]
pub libre_translate_api_url: Option<String>,
#[sea_orm(column_name = "libreTranslateApiKey")]
pub libre_translate_api_key: Option<String>,
#[sea_orm(column_name = "silencedHosts")]
pub silenced_hosts: StringVec,
#[sea_orm(column_name = "experimentalFeatures", column_type = "JsonBinary")]
pub experimental_features: Json,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::ProxyAccountId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "SetNull"
)]
User,
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,17 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "migrations")]
pub struct Model {
#[sea_orm(primary_key)]
pub id: i32,
pub timestamp: i64,
pub name: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,37 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "moderation_log")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "userId")]
pub user_id: String,
pub r#type: String,
#[sea_orm(column_type = "JsonBinary")]
pub info: Json,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User,
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,50 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use super::sea_orm_active_enums::MutedNoteReasonEnum;
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "muted_note")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "noteId")]
pub note_id: String,
#[sea_orm(column_name = "userId")]
pub user_id: String,
pub reason: MutedNoteReasonEnum,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::note::Entity",
from = "Column::NoteId",
to = "super::note::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
Note,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User,
}
impl Related<super::note::Entity> for Entity {
fn to() -> RelationDef {
Relation::Note.def()
}
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,40 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "muting")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "muteeId")]
pub mutee_id: String,
#[sea_orm(column_name = "muterId")]
pub muter_id: String,
#[sea_orm(column_name = "expiresAt")]
pub expires_at: Option<DateTimeWithTimeZone>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::MuterId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User2,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::MuteeId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User1,
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,51 +0,0 @@
#[macro_export]
macro_rules! impl_json_newtype {
($a:tt) => {
impl From<$a> for Value {
fn from(source: $a) -> Self {
Value::Json(serde_json::to_value(source).ok().map(Box::new))
}
}
impl TryGetable for $a {
fn try_get_by<I: sea_orm::ColIdx>(
res: &QueryResult,
idx: I,
) -> Result<Self, TryGetError> {
let json_value: serde_json::Value =
res.try_get_by(idx).map_err(TryGetError::DbErr)?;
serde_json::from_value(json_value)
.map_err(|e| TryGetError::DbErr(DbErr::Json(e.to_string())))
}
}
impl sea_query::ValueType for $a {
fn try_from(v: Value) -> Result<Self, sea_query::ValueTypeErr> {
match v {
Value::Json(Some(x)) => Ok($a(
serde_json::from_value(*x).map_err(|_| sea_query::ValueTypeErr)?
)),
_ => Err(sea_query::ValueTypeErr),
}
}
fn type_name() -> String {
stringify!($a).to_owned()
}
fn array_type() -> sea_query::ArrayType {
sea_query::ArrayType::Json
}
fn column_type() -> sea_query::ColumnType {
sea_query::ColumnType::JsonBinary
}
}
impl sea_query::Nullable for $a {
fn null() -> Value {
Value::Json(None)
}
}
};
}

View File

@ -1,30 +0,0 @@
mod macros;
use cfg_if::cfg_if;
use derive_more::{From, Into};
use sea_orm::{sea_query, DbErr, QueryResult, TryGetError, TryGetable, Value};
use serde::{Deserialize, Serialize};
use crate::impl_json_newtype;
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, From, Into, Default)]
pub struct JsonKeyword(pub Vec<Vec<String>>);
impl_json_newtype!(JsonKeyword);
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, From, Into, Default)]
pub struct JsonStringVec(pub Vec<String>);
impl_json_newtype!(JsonStringVec);
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, From, Into, Default)]
pub struct JsonI32Vec(pub Vec<i32>);
impl_json_newtype!(JsonI32Vec);
cfg_if! {
if #[cfg(feature = "noarray")] {
pub type StringVec = JsonStringVec;
pub type I32Vec = JsonI32Vec;
} else {
pub type StringVec = Vec<String>;
pub type I32Vec = Vec<i32>;
}
}

View File

@ -1,236 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use super::sea_orm_active_enums::NoteVisibilityEnum;
use sea_orm::entity::prelude::*;
use super::newtype::StringVec;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "note")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "replyId")]
pub reply_id: Option<String>,
#[sea_orm(column_name = "renoteId")]
pub renote_id: Option<String>,
#[sea_orm(column_type = "Text", nullable)]
pub text: Option<String>,
pub name: Option<String>,
pub cw: Option<String>,
#[sea_orm(column_name = "userId")]
pub user_id: String,
#[sea_orm(column_name = "localOnly")]
pub local_only: bool,
#[sea_orm(column_name = "renoteCount")]
pub renote_count: i16,
#[sea_orm(column_name = "repliesCount")]
pub replies_count: i16,
#[sea_orm(column_type = "JsonBinary")]
pub reactions: Json,
pub visibility: NoteVisibilityEnum,
pub uri: Option<String>,
pub score: i32,
#[sea_orm(column_name = "fileIds")]
pub file_ids: StringVec,
#[sea_orm(column_name = "attachedFileTypes")]
pub attached_file_types: StringVec,
#[sea_orm(column_name = "visibleUserIds")]
pub visible_user_ids: StringVec,
pub mentions: StringVec,
#[sea_orm(column_name = "mentionedRemoteUsers", column_type = "Text")]
pub mentioned_remote_users: String,
pub emojis: StringVec,
pub tags: StringVec,
#[sea_orm(column_name = "hasPoll")]
pub has_poll: bool,
#[sea_orm(column_name = "userHost")]
pub user_host: Option<String>,
#[sea_orm(column_name = "replyUserId")]
pub reply_user_id: Option<String>,
#[sea_orm(column_name = "replyUserHost")]
pub reply_user_host: Option<String>,
#[sea_orm(column_name = "renoteUserId")]
pub renote_user_id: Option<String>,
#[sea_orm(column_name = "renoteUserHost")]
pub renote_user_host: Option<String>,
pub url: Option<String>,
#[sea_orm(column_name = "channelId")]
pub channel_id: Option<String>,
#[sea_orm(column_name = "threadId")]
pub thread_id: Option<String>,
#[sea_orm(column_name = "updatedAt")]
pub updated_at: Option<DateTimeWithTimeZone>,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(has_many = "super::antenna_note::Entity")]
AntennaNote,
#[sea_orm(
belongs_to = "super::channel::Entity",
from = "Column::ChannelId",
to = "super::channel::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
Channel,
#[sea_orm(has_many = "super::channel_note_pining::Entity")]
ChannelNotePining,
#[sea_orm(has_many = "super::clip_note::Entity")]
ClipNote,
#[sea_orm(has_many = "super::muted_note::Entity")]
MutedNote,
#[sea_orm(
belongs_to = "Entity",
from = "Column::ReplyId",
to = "Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
SelfRef2,
#[sea_orm(
belongs_to = "Entity",
from = "Column::RenoteId",
to = "Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
SelfRef1,
#[sea_orm(has_many = "super::note_edit::Entity")]
NoteEdit,
#[sea_orm(has_many = "super::note_favorite::Entity")]
NoteFavorite,
#[sea_orm(has_many = "super::note_reaction::Entity")]
NoteReaction,
#[sea_orm(has_many = "super::note_unread::Entity")]
NoteUnread,
#[sea_orm(has_many = "super::note_watching::Entity")]
NoteWatching,
#[sea_orm(has_many = "super::notification::Entity")]
Notification,
#[sea_orm(has_one = "super::poll::Entity")]
Poll,
#[sea_orm(has_many = "super::poll_vote::Entity")]
PollVote,
#[sea_orm(has_one = "super::promo_note::Entity")]
PromoNote,
#[sea_orm(has_many = "super::promo_read::Entity")]
PromoRead,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User,
#[sea_orm(has_many = "super::user_note_pining::Entity")]
UserNotePining,
}
impl Related<super::antenna_note::Entity> for Entity {
fn to() -> RelationDef {
Relation::AntennaNote.def()
}
}
impl Related<super::channel::Entity> for Entity {
fn to() -> RelationDef {
Relation::Channel.def()
}
}
impl Related<super::channel_note_pining::Entity> for Entity {
fn to() -> RelationDef {
Relation::ChannelNotePining.def()
}
}
impl Related<super::clip_note::Entity> for Entity {
fn to() -> RelationDef {
Relation::ClipNote.def()
}
}
impl Related<super::muted_note::Entity> for Entity {
fn to() -> RelationDef {
Relation::MutedNote.def()
}
}
impl Related<super::note_edit::Entity> for Entity {
fn to() -> RelationDef {
Relation::NoteEdit.def()
}
}
impl Related<super::note_favorite::Entity> for Entity {
fn to() -> RelationDef {
Relation::NoteFavorite.def()
}
}
impl Related<super::note_reaction::Entity> for Entity {
fn to() -> RelationDef {
Relation::NoteReaction.def()
}
}
impl Related<super::note_unread::Entity> for Entity {
fn to() -> RelationDef {
Relation::NoteUnread.def()
}
}
impl Related<super::note_watching::Entity> for Entity {
fn to() -> RelationDef {
Relation::NoteWatching.def()
}
}
impl Related<super::notification::Entity> for Entity {
fn to() -> RelationDef {
Relation::Notification.def()
}
}
impl Related<super::poll::Entity> for Entity {
fn to() -> RelationDef {
Relation::Poll.def()
}
}
impl Related<super::poll_vote::Entity> for Entity {
fn to() -> RelationDef {
Relation::PollVote.def()
}
}
impl Related<super::promo_note::Entity> for Entity {
fn to() -> RelationDef {
Relation::PromoNote.def()
}
}
impl Related<super::promo_read::Entity> for Entity {
fn to() -> RelationDef {
Relation::PromoRead.def()
}
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl Related<super::user_note_pining::Entity> for Entity {
fn to() -> RelationDef {
Relation::UserNotePining.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,41 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
use super::newtype::StringVec;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "note_edit")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "noteId")]
pub note_id: String,
#[sea_orm(column_type = "Text", nullable)]
pub text: Option<String>,
pub cw: Option<String>,
#[sea_orm(column_name = "fileIds")]
pub file_ids: StringVec,
#[sea_orm(column_name = "updatedAt")]
pub updated_at: DateTimeWithTimeZone,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::note::Entity",
from = "Column::NoteId",
to = "super::note::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
Note,
}
impl Related<super::note::Entity> for Entity {
fn to() -> RelationDef {
Relation::Note.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,50 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "note_favorite")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "userId")]
pub user_id: String,
#[sea_orm(column_name = "noteId")]
pub note_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::note::Entity",
from = "Column::NoteId",
to = "super::note::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
Note,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User,
}
impl Related<super::note::Entity> for Entity {
fn to() -> RelationDef {
Relation::Note.def()
}
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,51 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "note_reaction")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "userId")]
pub user_id: String,
#[sea_orm(column_name = "noteId")]
pub note_id: String,
pub reaction: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::note::Entity",
from = "Column::NoteId",
to = "super::note::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
Note,
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User,
}
impl Related<super::note::Entity> for Entity {
fn to() -> RelationDef {
Relation::Note.def()
}
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

View File

@ -1,36 +0,0 @@
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3
use sea_orm::entity::prelude::*;
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Default)]
#[sea_orm(table_name = "note_thread_muting")]
pub struct Model {
#[sea_orm(primary_key, auto_increment = false)]
pub id: String,
#[sea_orm(column_name = "createdAt")]
pub created_at: DateTimeWithTimeZone,
#[sea_orm(column_name = "userId")]
pub user_id: String,
#[sea_orm(column_name = "threadId")]
pub thread_id: String,
}
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
pub enum Relation {
#[sea_orm(
belongs_to = "super::user::Entity",
from = "Column::UserId",
to = "super::user::Column::Id",
on_update = "NoAction",
on_delete = "Cascade"
)]
User,
}
impl Related<super::user::Entity> for Entity {
fn to() -> RelationDef {
Relation::User.def()
}
}
impl ActiveModelBehavior for ActiveModel {}

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