Compare commits
No commits in common. "main" and "activity-pub" have entirely different histories.
main
...
activity-p
|
@ -1,2 +1,2 @@
|
|||
[registries.crates-io]
|
||||
protocol = "sparse"
|
||||
protocol = "sparse"
|
|
@ -1,11 +1,7 @@
|
|||
magnetar-dev.local {
|
||||
nattyarch.local {
|
||||
log {
|
||||
|
||||
}
|
||||
|
||||
handle /.well-known/host-meta {
|
||||
reverse_proxy 127.0.0.1:4939
|
||||
}
|
||||
|
||||
handle /.well-known/webfinger {
|
||||
reverse_proxy 127.0.0.1:4939
|
||||
|
@ -24,7 +20,7 @@ magnetar-dev.local {
|
|||
}
|
||||
|
||||
@render_html {
|
||||
not path /api* /proxy* /files* /avatar* /identicon*
|
||||
not path /api* /proxy* /files* /avatar* /identicon* /streaming
|
||||
header Accept text/html*
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
steps:
|
||||
pipeline:
|
||||
publish-docker-latest:
|
||||
image: docker.io/plugins/kaniko
|
||||
settings:
|
||||
|
@ -12,5 +12,7 @@ steps:
|
|||
from_secret: docker_password
|
||||
|
||||
when:
|
||||
- event: push
|
||||
branch: main
|
||||
event: [push]
|
||||
branch: [main]
|
||||
|
||||
branches: [main]
|
File diff suppressed because it is too large
Load Diff
105
Cargo.toml
105
Cargo.toml
|
@ -8,142 +8,101 @@ license = "AGPL-3.0-only"
|
|||
[workspace]
|
||||
members = [
|
||||
".",
|
||||
"ext_activity_streams",
|
||||
"ext_federation",
|
||||
"ext_activity_pub",
|
||||
"ext_nodeinfo",
|
||||
"ext_webfinger",
|
||||
"ext_model",
|
||||
"ext_calckey_model",
|
||||
"fe_calckey",
|
||||
"magnetar_common",
|
||||
"magnetar_runtime",
|
||||
"magnetar_sdk",
|
||||
"magnetar_mmm_parser",
|
||||
"core",
|
||||
"core"
|
||||
]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.3.0-alpha"
|
||||
version = "0.2.0"
|
||||
edition = "2021"
|
||||
|
||||
[workspace.dependencies]
|
||||
async-trait = "0.1"
|
||||
async-stream = "0.3"
|
||||
axum = "0.7"
|
||||
axum-extra = "0.9"
|
||||
base64 = "0.22"
|
||||
bytes = "1.7"
|
||||
cached = "0.54"
|
||||
axum = "0.6"
|
||||
cached = "0.46"
|
||||
cfg-if = "1"
|
||||
chrono = "0.4"
|
||||
compact_str = "0.8"
|
||||
dotenvy = "0.15"
|
||||
ed25519-dalek = "2.1"
|
||||
either = "1.9"
|
||||
emojis = "0.6"
|
||||
futures = "0.3"
|
||||
futures-channel = "0.3"
|
||||
futures-core = "0.3"
|
||||
futures-util = "0.3"
|
||||
headers = "0.4"
|
||||
http = "1.0"
|
||||
httpdate = "1"
|
||||
hyper = "1.1"
|
||||
idna = "1"
|
||||
indexmap = "2.2"
|
||||
itertools = "0.13"
|
||||
kdl = "4"
|
||||
lru = "0.12"
|
||||
miette = "7"
|
||||
nom = "7"
|
||||
nom_locate = "4"
|
||||
headers = "0.3"
|
||||
http = "0.2"
|
||||
hyper = "0.14"
|
||||
js-sys = "0.3"
|
||||
log = "0.4"
|
||||
miette = "5.9"
|
||||
percent-encoding = "2.2"
|
||||
priority-queue = "2.0"
|
||||
quick-xml = "0.36"
|
||||
redis = "0.26"
|
||||
regex = "1.9"
|
||||
rmp-serde = "1.3"
|
||||
rsa = "0.9"
|
||||
reqwest = "0.12"
|
||||
sea-orm = "1"
|
||||
sea-orm-migration = "1"
|
||||
redis = "0.23"
|
||||
reqwest = "0.11"
|
||||
sea-orm = "0.12"
|
||||
sea-orm-migration = "0.12"
|
||||
serde = "1"
|
||||
serde_json = "1"
|
||||
serde_urlencoded = "0.7"
|
||||
sha2 = "0.10"
|
||||
smallvec = "1.13"
|
||||
strum = "0.26"
|
||||
strum = "0.25"
|
||||
tera = { version = "1", default-features = false }
|
||||
thiserror = "2"
|
||||
thiserror = "1"
|
||||
tokio = "1.24"
|
||||
tokio-util = "0.7"
|
||||
tokio-stream = "0.1"
|
||||
toml = "0.8"
|
||||
tower = "0.5"
|
||||
tower-http = "0.6"
|
||||
tower = "0.4"
|
||||
tower-http = "0.4"
|
||||
tracing = "0.1"
|
||||
tracing-subscriber = "0.3"
|
||||
ts-rs = "7"
|
||||
ulid = "1"
|
||||
unicode-segmentation = "1.10"
|
||||
url = "2.3"
|
||||
walkdir = "2.3"
|
||||
wasm-bindgen = "0.2"
|
||||
wasm-bindgen-futures = "0.4"
|
||||
web-sys = "0.3"
|
||||
|
||||
[dependencies]
|
||||
magnetar_activity_pub = { path = "./ext_activity_pub" }
|
||||
magnetar_core = { path = "./core" }
|
||||
magnetar_common = { path = "./magnetar_common" }
|
||||
magnetar_federation = { path = "./ext_federation" }
|
||||
magnetar_host_meta = { path = "./ext_host_meta" }
|
||||
magnetar_webfinger = { path = "./ext_webfinger" }
|
||||
magnetar_nodeinfo = { path = "./ext_nodeinfo" }
|
||||
magnetar_model = { path = "./ext_model" }
|
||||
magnetar_runtime = { path = "./magnetar_runtime" }
|
||||
magnetar_calckey_model = { path = "./ext_calckey_model" }
|
||||
magnetar_sdk = { path = "./magnetar_sdk" }
|
||||
|
||||
cached = { workspace = true }
|
||||
lru = { workspace = true }
|
||||
|
||||
chrono = { workspace = true }
|
||||
dotenvy = { workspace = true }
|
||||
|
||||
axum = { workspace = true, features = ["macros"] }
|
||||
axum-extra = { workspace = true, features = ["typed-header"] }
|
||||
async-stream = { workspace = true }
|
||||
async-trait = { workspace = true }
|
||||
axum = { workspace = true, features = ["macros", "headers"] }
|
||||
futures-util = { workspace = true }
|
||||
headers = { workspace = true }
|
||||
hyper = { workspace = true, features = ["full"] }
|
||||
reqwest = { workspace = true, features = ["hickory-dns"] }
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
tokio-stream = { workspace = true }
|
||||
tower = { workspace = true }
|
||||
tower-http = { workspace = true, features = ["cors", "trace", "fs"] }
|
||||
ulid = { workspace = true }
|
||||
url = { workspace = true }
|
||||
|
||||
reqwest = { workspace = true, features = ["json"] }
|
||||
|
||||
tracing-subscriber = { workspace = true, features = ["env-filter"] }
|
||||
tracing = { workspace = true }
|
||||
|
||||
cfg-if = { workspace = true }
|
||||
|
||||
bytes = { workspace = true }
|
||||
compact_str = { workspace = true }
|
||||
either = { workspace = true }
|
||||
futures = { workspace = true }
|
||||
futures-util = { workspace = true }
|
||||
itertools = { workspace = true }
|
||||
miette = { workspace = true, features = ["fancy"] }
|
||||
strum = { workspace = true, features = ["derive"] }
|
||||
thiserror = { workspace = true }
|
||||
miette = { workspace = true }
|
||||
|
||||
percent-encoding = { workspace = true }
|
||||
|
||||
kdl = { workspace = true }
|
||||
rmp-serde = { workspace = true }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true }
|
||||
serde_urlencoded = { workspace = true }
|
||||
toml = { workspace = true }
|
||||
quick-xml = { workspace = true, features = ["serialize", "overlapped-lists"] }
|
||||
|
||||
unicode-segmentation = { workspace = true }
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
||||
lto = true
|
52
Dockerfile
52
Dockerfile
|
@ -1,25 +1,20 @@
|
|||
FROM docker.io/rust:1.82-bookworm as build
|
||||
FROM docker.io/alpine:3.18 as build_fe
|
||||
|
||||
RUN apk add --no-cache --no-progress git alpine-sdk nodejs-current npm
|
||||
|
||||
WORKDIR /fe_calckey
|
||||
COPY ./fe_calckey/frontend ./frontend
|
||||
WORKDIR /fe_calckey/frontend
|
||||
|
||||
RUN corepack enable && corepack prepare pnpm@latest --activate && pnpm i --frozen-lockfile
|
||||
|
||||
RUN env NODE_ENV=production sh -c "pnpm run build && pnpm run gulp"
|
||||
|
||||
|
||||
FROM docker.io/rust:1.71-bullseye as build
|
||||
|
||||
RUN update-ca-certificates
|
||||
|
||||
RUN apt update
|
||||
RUN apt install -y git nodejs npm
|
||||
RUN npm install -g corepack
|
||||
|
||||
RUN corepack enable && corepack prepare pnpm@latest --activate
|
||||
|
||||
WORKDIR /magnetar
|
||||
COPY ./ .
|
||||
|
||||
WORKDIR /magnetar/fe_calckey/frontend
|
||||
RUN pnpm i --frozen-lockfile
|
||||
|
||||
WORKDIR /magnetar
|
||||
RUN cargo build --release --locked --workspace --bins
|
||||
|
||||
WORKDIR /magnetar/fe_calckey/frontend
|
||||
RUN env NODE_ENV=production sh -c "pnpm run build && pnpm run gulp"
|
||||
|
||||
ENV USER=magnetar
|
||||
ENV UID=10001
|
||||
|
||||
|
@ -31,10 +26,13 @@ RUN adduser \
|
|||
--uid "${UID}" \
|
||||
"${USER}"
|
||||
|
||||
FROM docker.io/debian:bookworm-slim
|
||||
WORKDIR /magnetar
|
||||
|
||||
RUN apt update
|
||||
RUN apt install -y openssl
|
||||
COPY ./ .
|
||||
|
||||
RUN cargo build --release --locked --workspace --bins
|
||||
|
||||
FROM docker.io/debian:bullseye-slim
|
||||
|
||||
COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
|
||||
|
||||
|
@ -44,10 +42,10 @@ COPY --from=build /etc/group /etc/group
|
|||
WORKDIR /magnetar
|
||||
|
||||
WORKDIR /magnetar/fe_calckey/frontend
|
||||
COPY --from=build /magnetar/fe_calckey/frontend/built ./built
|
||||
COPY --from=build /magnetar/fe_calckey/frontend/assets ./assets
|
||||
COPY --from=build /magnetar/fe_calckey/frontend/client/assets ./client/assets
|
||||
COPY --from=build /magnetar/fe_calckey/frontend/assets-be ./assets-be
|
||||
COPY --from=build_fe /fe_calckey/frontend/built ./built
|
||||
COPY --from=build_fe /fe_calckey/frontend/assets ./assets
|
||||
COPY --from=build_fe /fe_calckey/frontend/client/assets ./client/assets
|
||||
COPY --from=build_fe /fe_calckey/frontend/assets-be ./assets-be
|
||||
|
||||
WORKDIR /magnetar
|
||||
|
||||
|
@ -61,4 +59,4 @@ USER magnetar:magnetar
|
|||
EXPOSE 4938/tcp
|
||||
EXPOSE 4939/tcp
|
||||
|
||||
ENTRYPOINT ["/magnetar/magnetar"]
|
||||
ENTRYPOINT ["/magnetar/magnetar"]
|
|
@ -1,4 +1,3 @@
|
|||
*
|
||||
!.gitignore
|
||||
!default.toml
|
||||
!default-vars.kdl
|
||||
!default.toml
|
|
@ -1,34 +0,0 @@
|
|||
cache {
|
||||
local-user-cache {
|
||||
// Size is unlimited
|
||||
lifetime 300min
|
||||
}
|
||||
|
||||
emoji-cache {
|
||||
size 4096
|
||||
}
|
||||
|
||||
remote-instance-cache {
|
||||
size 256
|
||||
lifetime 100s
|
||||
}
|
||||
|
||||
drive-file-cache {
|
||||
size 128
|
||||
lifetime 10s
|
||||
}
|
||||
}
|
||||
|
||||
api-model {
|
||||
note {
|
||||
buffer 10
|
||||
}
|
||||
|
||||
notification {
|
||||
buffer 10
|
||||
}
|
||||
}
|
||||
|
||||
activity-pub {
|
||||
user-agent "magnetar/$version ($host)"
|
||||
}
|
|
@ -47,33 +47,6 @@
|
|||
# Environment variable: MAG_C_BIND_ADDR
|
||||
# networking.bind_addr = "::"
|
||||
|
||||
# [Optional]
|
||||
# The URL of a media proxy
|
||||
# Default: null
|
||||
# Environment variable: MAG_C_MEDIA_PROXY
|
||||
# networking.media_proxy = ""
|
||||
|
||||
# [Optional]
|
||||
# Whether to proxy remote files through this instance
|
||||
# Default: false
|
||||
# Environment variable: MAG_C_PROXY_REMOTE_FILES
|
||||
# networking.proxy_remote_files = false
|
||||
|
||||
# ------------------------------[ RPC CONNECTION ]-----------------------------
|
||||
|
||||
# [Optional]
|
||||
# A type of connection to use for the application's internal RPC
|
||||
# Possible values: "none", "tcp", "unix"
|
||||
# Default: "none"
|
||||
# Environment variable: MAG_C_RPC_CONNECTION_TYPE
|
||||
# rpc.connection_type = "none"
|
||||
|
||||
# [Optional]
|
||||
# The corresponding bind address (or path for Unix-domain sockets) for the internal RPC
|
||||
# Default: ""
|
||||
# Environment variable: MAG_C_RPC_BIND_ADDR
|
||||
# rpc.bind_addr = ""
|
||||
|
||||
# -----------------------------[ CALCKEY FRONTEND ]----------------------------
|
||||
|
||||
# [Optional]
|
||||
|
@ -97,6 +70,7 @@
|
|||
# -------------------------------[ FEDERATION ]--------------------------------
|
||||
|
||||
|
||||
|
||||
# --------------------------------[ BRANDING ]---------------------------------
|
||||
|
||||
# [Optional]
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
|
||||
use std::{
|
||||
borrow::{Borrow, Cow},
|
||||
fmt::Display,
|
||||
};
|
||||
use std::borrow::{Borrow, Cow};
|
||||
|
||||
#[derive(Debug, Clone, Eq, PartialEq)]
|
||||
pub struct Acct(String);
|
||||
|
@ -26,12 +23,6 @@ impl AsRef<str> for Acct {
|
|||
}
|
||||
}
|
||||
|
||||
impl Display for Acct {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "acct:{}", self.0)
|
||||
}
|
||||
}
|
||||
|
||||
impl Serialize for Acct {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
|
|
|
@ -8,12 +8,10 @@ pub mod acct;
|
|||
|
||||
pub trait ContentType: Serialize {
|
||||
fn mime_type(&self) -> &'static str;
|
||||
|
||||
fn alt_mime_types(&self) -> &[&'static str];
|
||||
}
|
||||
|
||||
macro_rules! content_type {
|
||||
($visib:vis $typ:ident, $expression:expr $(,$alt:expr)*) => {
|
||||
($visib:vis $typ:ident, $expression:expr) => {
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Debug, Default)]
|
||||
$visib struct $typ;
|
||||
|
||||
|
@ -33,17 +31,13 @@ macro_rules! content_type {
|
|||
fn mime_type(&self) -> &'static str {
|
||||
$expression
|
||||
}
|
||||
|
||||
fn alt_mime_types(&self) -> &[&'static str] {
|
||||
&[$($alt),*]
|
||||
}
|
||||
}
|
||||
|
||||
impl<'de> Deserialize<'de> for $typ {
|
||||
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error> {
|
||||
let content_type = String::deserialize(deserializer)?;
|
||||
|
||||
if matches!(content_type.as_ref(), $expression $(| $alt)*) {
|
||||
if matches!(content_type.as_ref(), $expression) {
|
||||
Ok(Self)
|
||||
} else {
|
||||
Err(Error::custom(format!(
|
||||
|
@ -60,11 +54,9 @@ pub mod content_type {
|
|||
use serde::de::Error;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
|
||||
content_type!(pub ContentActivityStreams, "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"", "application/activity+json", "application/activity+json; charset=utf-8");
|
||||
content_type!(pub ContentActivityJson, "application/activity+json", "application/ld+json; profile=\"https://www.w3.org/ns/activitystreams\"", "application/activity+json; charset=utf-8");
|
||||
content_type!(pub ContentActivityStreams, "application/activity+json");
|
||||
content_type!(pub ContentHtml, "text/html");
|
||||
content_type!(pub ContentJson, "application/json");
|
||||
content_type!(pub ContentXrdXml, "application/xrd+xml");
|
||||
content_type!(pub ContentJrdJson, "application/jrd+json");
|
||||
content_type!(pub ContentMultipartFormData, "multipart/form-data");
|
||||
content_type!(pub ContentUrlEncoded, "application/x-www-form-urlencoded");
|
||||
|
@ -120,9 +112,6 @@ pub mod rel {
|
|||
|
||||
link_rel!(pub RelWebFingerProfilePage, "http://webfinger.net/rel/profile-page");
|
||||
link_rel!(pub RelSelf, "self");
|
||||
link_rel!(pub RelNext, "next");
|
||||
link_rel!(pub RelPrev, "prev");
|
||||
link_rel!(pub RelLrdd, "lrdd");
|
||||
link_rel!(pub RelOStatusSubscribe, "http://ostatus.org/schema/1.0/subscribe");
|
||||
link_rel!(pub RelNodeInfo20, "http://nodeinfo.diaspora.software/ns/schema/2.0");
|
||||
link_rel!(pub RelNodeInfo21, "http://nodeinfo.diaspora.software/ns/schema/2.1");
|
||||
|
@ -150,7 +139,8 @@ where
|
|||
let dt = data
|
||||
.iter()
|
||||
.filter_map(Value::as_str)
|
||||
.find_map(|val| T::from_str(val).ok());
|
||||
.filter_map(|val| T::from_str(val).ok())
|
||||
.next();
|
||||
|
||||
if let Some(value) = dt {
|
||||
Ok(ListContaining(value))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "magnetar_activity_streams"
|
||||
name = "magnetar_activity_pub"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license = "MIT OR Apache-2.0"
|
||||
|
@ -9,14 +9,11 @@ crate-type = ["rlib"]
|
|||
|
||||
[dependencies]
|
||||
async-trait = { workspace = true }
|
||||
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true }
|
||||
|
||||
either = { workspace = true }
|
||||
chrono = { workspace = true, features = ["serde"] }
|
||||
thiserror = { workspace = true }
|
||||
url = { workspace = true, features = ["serde"] }
|
||||
|
||||
[dev-dependencies]
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
tokio = { workspace = true, features = ["full"] }
|
|
@ -0,0 +1,237 @@
|
|||
pub mod link;
|
||||
pub mod object;
|
||||
pub mod recipe;
|
||||
|
||||
use crate::link::Link;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use std::borrow::Cow;
|
||||
use std::fmt::Debug;
|
||||
use std::ops::Deref;
|
||||
use url::Url;
|
||||
|
||||
pub trait ObjectSingle: Clone + Debug + Sized + 'static {
|
||||
fn get_type() -> &'static str;
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct ObjectRaw<T> {
|
||||
#[serde(flatten)]
|
||||
data: Box<T>,
|
||||
#[serde(flatten)]
|
||||
raw: Value,
|
||||
}
|
||||
|
||||
impl<T> Deref for ObjectRaw<T> {
|
||||
type Target = T;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
&self.data
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> ObjectRaw<T> {
|
||||
pub fn into_inner(self) -> Box<T> {
|
||||
self.data
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> AsRef<T> for ObjectRaw<T> {
|
||||
fn as_ref(&self) -> &T {
|
||||
self.as_data()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> ObjectRaw<T> {
|
||||
pub fn as_data(&self) -> &T {
|
||||
&self.data
|
||||
}
|
||||
|
||||
pub fn as_json(&self) -> &Value {
|
||||
&self.raw
|
||||
}
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
pub trait Resolver: Send + Sync {
|
||||
type Error: Send + Sync;
|
||||
|
||||
async fn resolve<T: for<'a> Deserialize<'a>>(&self, id: &str) -> Result<T, Self::Error>;
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
pub trait Resolvable {
|
||||
type Output: Clone + Send + Sync;
|
||||
|
||||
async fn resolve<R: Resolver>(&self, resolver: &R) -> Result<Cow<Self::Output>, R::Error>;
|
||||
|
||||
fn unresolve(&self) -> Option<&str>;
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! def_ld {
|
||||
($obj_type: expr, $x: ty) => {
|
||||
impl $crate::ObjectSingle for $x {
|
||||
fn get_type() -> &'static str {
|
||||
$obj_type
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! ld_document {
|
||||
($y: ident, $x: ty) => {
|
||||
impl $y {
|
||||
pub async fn resolve<R: $crate::Resolver>(
|
||||
&self,
|
||||
resolver: &R,
|
||||
) -> Result<std::borrow::Cow<ObjectRaw<$x>>, R::Error> {
|
||||
match self {
|
||||
$y::Object(obj) => Ok(std::borrow::Cow::Borrowed(obj)),
|
||||
$y::Remote(Id(link)) => {
|
||||
Ok(std::borrow::Cow::Owned(resolver.resolve(link).await?))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unresolve(&self) -> Option<&str> {
|
||||
match self {
|
||||
$y::Object(obj) => obj.as_data().as_id.as_deref(),
|
||||
$y::Remote(Id(id)) => Some(&id),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum $y {
|
||||
Remote(Id),
|
||||
Object(Box<ObjectRaw<$x>>),
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl $crate::Resolvable for $y {
|
||||
type Output = $crate::ObjectRaw<$x>;
|
||||
|
||||
async fn resolve<R: $crate::Resolver>(
|
||||
&self,
|
||||
resolver: &R,
|
||||
) -> Result<std::borrow::Cow<Self::Output>, R::Error> {
|
||||
self.resolve(resolver).await
|
||||
}
|
||||
|
||||
fn unresolve(&self) -> Option<&str> {
|
||||
self.unresolve()
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
impl ObjectRaw<$x> {
|
||||
pub fn try_cast<T>() -> T {}
|
||||
}
|
||||
|
||||
*/
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! ld_union {
|
||||
($y: ident, $z: ident, $($item_name: ident as $item_type: ty),+) => {
|
||||
impl $y {
|
||||
pub async fn resolve<R: $crate::Resolver>(
|
||||
&self,
|
||||
resolver: &R,
|
||||
) -> Result<std::borrow::Cow<ObjectRaw<$z>>, R::Error> {
|
||||
match self {
|
||||
$y::Object(obj) => Ok(std::borrow::Cow::Borrowed(obj)),
|
||||
$y::Remote(Id(link)) => {
|
||||
Ok(std::borrow::Cow::Owned(resolver.resolve(link).await?))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn unresolve(&self) -> Option<&str> {
|
||||
match self {
|
||||
$y::Object(obj) => obj.as_data().base.as_id.as_deref(),
|
||||
$y::Remote(Id(id)) => Some(&id),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct $z {
|
||||
#[serde(flatten)]
|
||||
pub base: $crate::Base,
|
||||
$(
|
||||
#[serde(flatten)]
|
||||
$item_name: Box<$item_type>,
|
||||
)+
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum $y {
|
||||
Remote(Id),
|
||||
Object(ObjectRaw<$z>),
|
||||
}
|
||||
|
||||
#[async_trait::async_trait]
|
||||
impl $crate::Resolvable for $y {
|
||||
type Output = $crate::ObjectRaw<$z>;
|
||||
|
||||
async fn resolve<R: $crate::Resolver>(
|
||||
&self,
|
||||
resolver: &R,
|
||||
) -> Result<std::borrow::Cow<Self::Output>, R::Error> {
|
||||
self.resolve(resolver).await
|
||||
}
|
||||
|
||||
fn unresolve(&self) -> Option<&str> {
|
||||
self.unresolve()
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum OneOrMore<T> {
|
||||
One(T),
|
||||
Many(Vec<T>),
|
||||
}
|
||||
|
||||
impl<T> OneOrMore<T> {
|
||||
pub fn into_vec(self) -> Vec<T> {
|
||||
match self {
|
||||
OneOrMore::One(x) => vec![x],
|
||||
OneOrMore::Many(x) => x,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> std::slice::Iter<'_, T> {
|
||||
match self {
|
||||
OneOrMore::One(x) => std::slice::from_ref(x).iter(),
|
||||
OneOrMore::Many(x) => x.iter(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
|
||||
pub struct Base {
|
||||
#[serde(rename = "@type")]
|
||||
as_type: Option<OneOrMore<String>>,
|
||||
#[serde(rename = "@id")]
|
||||
as_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum LinkOrUrl {
|
||||
Url(Url),
|
||||
Link(Box<Link>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[repr(transparent)]
|
||||
pub struct Id(pub String);
|
|
@ -1,7 +1,8 @@
|
|||
use crate::def_ld;
|
||||
use crate::{def_ld, ld_document, Id, ObjectRaw};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct LinkMention {}
|
||||
pub struct LinkMention;
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Mention", LinkMention);
|
||||
ld_document!(RefLinkMention, LinkMention);
|
|
@ -1,13 +1,12 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{def_ld, ObjectSlot};
|
||||
use crate::object::ObjectLinkUnion;
|
||||
use crate::object::RefObjectLinkUnion;
|
||||
use crate::OneOrMore;
|
||||
use crate::{def_ld, ld_document, Id, ObjectRaw};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub mod link_types;
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct Link<'a> {
|
||||
pub struct Link {
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#href")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub href: Option<String>,
|
||||
|
@ -38,7 +37,8 @@ pub struct Link<'a> {
|
|||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#preview")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub preview: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
pub preview: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Link", Link<'_>);
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Link", Link);
|
||||
ld_document!(RefLink, Link);
|
|
@ -0,0 +1,240 @@
|
|||
use crate::object::{Object, RefObjectLinkUnion};
|
||||
use crate::{def_ld, ld_document, Id, ObjectRaw, ObjectSingle, OneOrMore};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct Activity {
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#actor")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub actor: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#object")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub object: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#target")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub target: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#result")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub result: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#origin")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub origin: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#instrument")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub instrument: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
}
|
||||
|
||||
def_ld!("Activity", Activity, base as Object);
|
||||
ld_document!(RefActivity, Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct IntransitiveActivity;
|
||||
|
||||
def_ld!(
|
||||
"IntransitiveActivity",
|
||||
IntransitiveActivity,
|
||||
base as Activity
|
||||
);
|
||||
ld_document!(RefIntransitiveActivity, IntransitiveActivity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityAccept;
|
||||
|
||||
def_ld!("Accept", ActivityAccept, base as Activity);
|
||||
ld_document!(RefActivityAccept, ActivityAccept);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityTentativeAccept;
|
||||
|
||||
def_ld!(
|
||||
"TentativeAccept",
|
||||
ActivityTentativeAccept,
|
||||
base as ActivityAccept
|
||||
);
|
||||
ld_document!(RefActivityTentativeAccept, ActivityTentativeAccept);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityAdd;
|
||||
|
||||
def_ld!("Add", ActivityAdd, base as Activity);
|
||||
ld_document!(RefActivityAdd, ActivityAdd);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityArrive;
|
||||
|
||||
def_ld!("Arrive", ActivityArrive, base as Activity);
|
||||
ld_document!(RefActivityArrive, ActivityArrive);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityCreate;
|
||||
|
||||
def_ld!("Create", ActivityCreate, base as Activity);
|
||||
ld_document!(RefActivityCreate, ActivityCreate);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityDelete;
|
||||
|
||||
def_ld!("Delete", ActivityDelete, base as Activity);
|
||||
ld_document!(RefActivityDelete, ActivityDelete);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityFollow;
|
||||
|
||||
def_ld!("Follow", ActivityFollow, base as Activity);
|
||||
ld_document!(RefActivityFollow, ActivityFollow);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityIgnore;
|
||||
|
||||
def_ld!("Ignore", ActivityIgnore, base as Activity);
|
||||
ld_document!(RefActivityIgnore, ActivityIgnore);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityJoin;
|
||||
|
||||
def_ld!("Join", ActivityJoin, base as Activity);
|
||||
ld_document!(RefActivityJoin, ActivityJoin);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityLeave;
|
||||
|
||||
def_ld!("Leave", ActivityLeave, base as Activity);
|
||||
ld_document!(RefActivityLeave, ActivityLeave);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityLike;
|
||||
|
||||
def_ld!("Like", ActivityLike, base as Activity);
|
||||
ld_document!(RefActivityLike, ActivityLike);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityOffer;
|
||||
|
||||
def_ld!("Offer", ActivityOffer, base as Activity);
|
||||
ld_document!(RefActivityOffer, ActivityOffer);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityInvite;
|
||||
|
||||
def_ld!("Invite", ActivityInvite, base as ActivityOffer);
|
||||
ld_document!(RefActivityInvite, ActivityInvite);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityReject;
|
||||
|
||||
def_ld!("Reject", ActivityReject, base as Activity);
|
||||
ld_document!(RefActivityReject, ActivityReject);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityTentativeReject;
|
||||
|
||||
def_ld!(
|
||||
"TentativeReject",
|
||||
ActivityTentativeReject,
|
||||
base as ActivityReject
|
||||
);
|
||||
ld_document!(RefActivityTentativeReject, ActivityTentativeReject);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityRemove;
|
||||
|
||||
def_ld!("Remove", ActivityRemove, base as Activity);
|
||||
ld_document!(RefActivityRemove, ActivityRemove);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityUndo;
|
||||
|
||||
def_ld!("Undo", ActivityUndo, base as Activity);
|
||||
ld_document!(RefActivityUndo, ActivityUndo);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityUpdate;
|
||||
|
||||
def_ld!("Update", ActivityUpdate, base as Activity);
|
||||
ld_document!(RefActivityUpdate, ActivityUpdate);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityView;
|
||||
|
||||
def_ld!("View", ActivityView, base as Activity);
|
||||
ld_document!(RefActivityView, ActivityView);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityListen;
|
||||
|
||||
def_ld!("Listen", ActivityListen, base as Activity);
|
||||
ld_document!(RefActivityListen, ActivityListen);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityRead;
|
||||
|
||||
def_ld!("Read", ActivityRead, base as Activity);
|
||||
ld_document!(RefActivityRead, ActivityRead);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityMove;
|
||||
|
||||
def_ld!("Move", ActivityMove, base as Activity);
|
||||
ld_document!(RefActivityMove, ActivityMove);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityTravel;
|
||||
|
||||
def_ld!("Travel", ActivityTravel, base as IntransitiveActivity);
|
||||
ld_document!(RefActivityTravel, ActivityTravel);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityAnnounce;
|
||||
|
||||
def_ld!("Announce", ActivityAnnounce, base as Activity);
|
||||
ld_document!(RefActivityAnnounce, ActivityAnnounce);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityBlock;
|
||||
|
||||
def_ld!("Block", ActivityBlock, base as ActivityIgnore);
|
||||
ld_document!(RefActivityBlock, ActivityBlock);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityFlag;
|
||||
|
||||
def_ld!("Flag", ActivityFlag, base as Activity);
|
||||
ld_document!(RefActivityFlag, ActivityFlag);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityDislike;
|
||||
|
||||
def_ld!("Dislike", ActivityDislike, base as Activity);
|
||||
ld_document!(RefActivityDislike, ActivityDislike);
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ActivityClosedStatus {
|
||||
Date(DateTime<Utc>),
|
||||
Bool(bool),
|
||||
Other(RefObjectLinkUnion),
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityQuestion {
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#oneOf")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub one_of: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#anyOf")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub any_of: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#closed")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub closed: Option<OneOrMore<ActivityClosedStatus>>,
|
||||
}
|
||||
|
||||
def_ld!("Question", ActivityQuestion, base as IntransitiveActivity);
|
||||
ld_document!(RefActivityQuestion, ActivityQuestion);
|
|
@ -1,34 +1,32 @@
|
|||
use crate::object::{RefCollection, RefOrderedCollection};
|
||||
use crate::{def_ld, ld_document, Id, ObjectRaw};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
||||
use crate::{def_ld, ObjectSlot};
|
||||
use crate::object::{Collection, ObjectLinkUnion, OrderedCollection};
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActorActivityPubProps<'a> {
|
||||
pub struct ActorActivityPubProps {
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#inbox")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub inbox: Option<ObjectSlot<'a, OrderedCollection>>,
|
||||
pub inbox: Option<RefOrderedCollection>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#outbox")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub outbox: Option<ObjectSlot<'a, OrderedCollection>>,
|
||||
pub outbox: Option<RefOrderedCollection>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#following")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub following: Option<ObjectSlot<'a, Collection>>,
|
||||
pub following: Option<RefCollection>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#followers")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub followers: Option<ObjectSlot<'a, Collection>>,
|
||||
pub followers: Option<RefCollection>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#liked")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub liked: Option<ObjectSlot<'a, Collection>>,
|
||||
pub liked: Option<RefCollection>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#shares")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub shares: Option<ObjectSlot<'a, Collection>>,
|
||||
pub shares: Option<RefCollection>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#preferredUsername")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
@ -36,30 +34,35 @@ pub struct ActorActivityPubProps<'a> {
|
|||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#endpoints")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub endpoints: Option<Value>,
|
||||
pub endpoints: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActorApplication {}
|
||||
pub struct ActorApplication;
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Application", ActorApplication, base as Object);
|
||||
def_ld!("Application", ActorApplication, base as Object);
|
||||
ld_document!(RefActorApplication, ActorApplication);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActorGroup {}
|
||||
pub struct ActorGroup;
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Group", ActorGroup, base as Object);
|
||||
def_ld!("Group", ActorGroup, base as Object);
|
||||
ld_document!(RefActorGroup, ActorGroup);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActorOrganization {}
|
||||
pub struct ActorOrganization;
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Organization", ActorOrganization, base as Object);
|
||||
def_ld!("Organization", ActorOrganization, base as Object);
|
||||
ld_document!(RefActorOrganization, ActorOrganization);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActorPerson {}
|
||||
pub struct ActorPerson;
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Person", ActorPerson, base as Object);
|
||||
def_ld!("Person", ActorPerson, base as Object);
|
||||
ld_document!(RefActorPerson, ActorPerson);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActorService {}
|
||||
pub struct ActorService;
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Service", ActorService, base as Object);
|
||||
def_ld!("Service", ActorService, base as Object);
|
||||
ld_document!(RefActorService, ActorService);
|
|
@ -1,30 +1,28 @@
|
|||
use std::collections::HashMap;
|
||||
|
||||
use crate::link::Link;
|
||||
use crate::object::object_types::RefObjectImageLinkUnion;
|
||||
use crate::{def_ld, Id};
|
||||
use crate::{ld_document, ld_union, Base, LinkOrUrl, ObjectRaw, ObjectSingle, OneOrMore};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{ld_union, LinkOrUrl, ObjectSlot, OneOrMore};
|
||||
use crate::def_ld;
|
||||
use crate::link::Link;
|
||||
use crate::object::object_types::ObjectImageLinkUnion;
|
||||
use std::collections::HashMap;
|
||||
|
||||
pub mod activity;
|
||||
pub mod actor;
|
||||
pub mod object_types;
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct Object<'a> {
|
||||
pub struct Object {
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#attachment")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub attachment: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
pub attachment: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#attributedTo")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub attributed_to: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
pub attributed_to: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#audience")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub audience: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
pub audience: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#content")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
@ -36,7 +34,7 @@ pub struct Object<'a> {
|
|||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#context")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub context: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
pub context: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#name")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
@ -52,27 +50,27 @@ pub struct Object<'a> {
|
|||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#generator")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub generator: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
pub generator: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#icon")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub icon: Option<OneOrMore<ObjectSlot<'a, ObjectImageLinkUnion>>>,
|
||||
pub icon: Option<OneOrMore<RefObjectImageLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#image")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub image: Option<OneOrMore<ObjectSlot<'a, ObjectImageLinkUnion>>>,
|
||||
pub image: Option<OneOrMore<RefObjectImageLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#inReplyTo")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub in_reply_to: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
pub in_reply_to: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#location")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub location: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
pub location: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#preview")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub preview: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
pub preview: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#published")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
@ -80,7 +78,7 @@ pub struct Object<'a> {
|
|||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#replies")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub replies: Option<ObjectSlot<'a, CollectionLinkUnion>>,
|
||||
pub replies: Option<RefCollectionLinkUnion>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#startTime")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
@ -96,7 +94,7 @@ pub struct Object<'a> {
|
|||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#tag")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub tag: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
pub tag: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#updated")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
@ -104,23 +102,23 @@ pub struct Object<'a> {
|
|||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#url")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub url: Option<OneOrMore<LinkOrUrl<'a>>>,
|
||||
pub url: Option<OneOrMore<LinkOrUrl>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#to")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub to: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
pub to: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#bto")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub bto: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
pub bto: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#cc")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub cc: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
pub cc: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#bcc")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub bcc: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
pub bcc: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#mediaType")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
@ -133,11 +131,13 @@ pub struct Object<'a> {
|
|||
// ActivityPub
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#source")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub source: Option<ObjectSlot<'a, Object<'a>>>,
|
||||
pub source: Option<RefObject>,
|
||||
}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Object", Object<'_>);
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Object", Object);
|
||||
ld_document!(RefObject, Object);
|
||||
ld_union!(
|
||||
RefObjectLinkUnion,
|
||||
ObjectLinkUnion,
|
||||
object_props as Object,
|
||||
link_props as Link
|
||||
|
@ -170,7 +170,9 @@ def_ld!(
|
|||
"https://www.w3.org/ns/activitystreams#Collection",
|
||||
Collection
|
||||
);
|
||||
ld_document!(RefCollection, Collection);
|
||||
ld_union!(
|
||||
RefCollectionLinkUnion,
|
||||
CollectionLinkUnion,
|
||||
collection_props as Collection,
|
||||
link_props as Link
|
||||
|
@ -187,6 +189,7 @@ def_ld!(
|
|||
"https://www.w3.org/ns/activitystreams#OrderedCollection",
|
||||
OrderedCollection
|
||||
);
|
||||
ld_document!(RefOrderedCollection, OrderedCollection);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct CollectionPage {
|
||||
|
@ -207,7 +210,10 @@ def_ld!(
|
|||
"https://www.w3.org/ns/activitystreams#CollectionPage",
|
||||
CollectionPage
|
||||
);
|
||||
ld_document!(RefCollectionPage, CollectionPage);
|
||||
|
||||
ld_union!(
|
||||
RefCollectionPageLinkUnion,
|
||||
CollectionPageLinkUnion,
|
||||
page_props as CollectionPage,
|
||||
link_props as Link
|
||||
|
@ -224,3 +230,4 @@ def_ld!(
|
|||
"https://www.w3.org/ns/activitystreams#OrderedCollectionPage",
|
||||
OrderedCollectionPage
|
||||
);
|
||||
ld_document!(RefOrderedCollectionPage, OrderedCollectionPage);
|
|
@ -1,71 +1,80 @@
|
|||
use crate::link::Link;
|
||||
use crate::object::{Object, RefObject, RefObjectLinkUnion};
|
||||
use crate::{def_ld, ld_document, ld_union, Id, ObjectRaw, ObjectSingle, OneOrMore};
|
||||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{def_ld, ld_union, ObjectSlot, ObjectTyped, OneOrMore};
|
||||
use crate::link::Link;
|
||||
use crate::object::{Object, ObjectLinkUnion};
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ObjectRelationship<'a> {
|
||||
pub struct ObjectRelationship {
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#object")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub object: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
pub object: Option<OneOrMore<RefObjectLinkUnion>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#subject")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub subject: Option<ObjectSlot<'a, ObjectLinkUnion>>,
|
||||
pub subject: Option<RefObjectLinkUnion>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#relationship")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub relationship: Option<OneOrMore<ObjectSlot<'a, Object<'a>>>>,
|
||||
pub relationship: Option<OneOrMore<RefObject>>,
|
||||
}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Relationship", ObjectRelationship, base as Object);
|
||||
def_ld!("Relationship", ObjectRelationship, base as Object);
|
||||
ld_document!(RefObjectRelationship, ObjectRelationship);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ObjectArticle {}
|
||||
pub struct ObjectArticle;
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Article", ObjectArticle, base as Object);
|
||||
def_ld!("Article", ObjectArticle, base as Object);
|
||||
ld_document!(RefObjectArticle, ObjectArticle);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ObjectDocument {}
|
||||
pub struct ObjectDocument;
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Document", ObjectDocument, base as Object);
|
||||
def_ld!("Document", ObjectDocument, base as Object);
|
||||
ld_document!(RefObjectDocument, ObjectDocument);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ObjectAudio {}
|
||||
pub struct ObjectAudio;
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Audio", ObjectAudio, base as ObjectDocument);
|
||||
def_ld!("Audio", ObjectAudio, base as ObjectDocument);
|
||||
ld_document!(RefObjectAudio, ObjectAudio);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ObjectImage {}
|
||||
pub struct ObjectImage;
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Image", ObjectImage, base as ObjectDocument);
|
||||
def_ld!("Image", ObjectImage, base as ObjectDocument);
|
||||
ld_document!(RefObjectImage, ObjectImage);
|
||||
ld_union!(
|
||||
RefObjectImageLinkUnion,
|
||||
ObjectImageLinkUnion,
|
||||
image_props as ObjectImage,
|
||||
link_props as Link
|
||||
);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ObjectVideo {}
|
||||
pub struct ObjectVideo;
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Video", ObjectVideo, base as ObjectDocument);
|
||||
def_ld!("Video", ObjectVideo, base as ObjectDocument);
|
||||
ld_document!(RefObjectVideo, ObjectVideo);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ObjectNote {}
|
||||
pub struct ObjectNote;
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Note", ObjectNote, base as Object);
|
||||
def_ld!("Note", ObjectNote, base as Object);
|
||||
ld_document!(RefObjectNote, ObjectNote);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ObjectPage {}
|
||||
pub struct ObjectPage;
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Page", ObjectPage, base as ObjectDocument);
|
||||
def_ld!("Page", ObjectPage, base as ObjectDocument);
|
||||
ld_document!(RefObjectPage, ObjectPage);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ObjectEvent {}
|
||||
pub struct ObjectEvent;
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Event", ObjectEvent, base as Object);
|
||||
def_ld!("Event", ObjectEvent, base as Object);
|
||||
ld_document!(RefObjectEvent, ObjectEvent);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ObjectPlace {
|
||||
|
@ -94,16 +103,18 @@ pub struct ObjectPlace {
|
|||
pub units: Option<String>,
|
||||
}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Place", ObjectPlace, base as Object);
|
||||
def_ld!("Place", ObjectPlace, base as Object);
|
||||
ld_document!(RefObjectPlace, ObjectPlace);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ObjectProfile<'a> {
|
||||
pub struct ObjectProfile {
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#describes")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub describes: Option<ObjectSlot<'a, ObjectProfile<'a>>>,
|
||||
pub describes: Option<RefObject>,
|
||||
}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Profile", ObjectProfile, base as Object);
|
||||
def_ld!("Profile", ObjectProfile, base as Object);
|
||||
ld_document!(RefObjectProfile, ObjectProfile);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ObjectTombstone {
|
||||
|
@ -116,4 +127,5 @@ pub struct ObjectTombstone {
|
|||
pub deleted: Option<DateTime<Utc>>,
|
||||
}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Tombstone", ObjectTombstone, base as Object);
|
||||
def_ld!("Tombstone", ObjectTombstone, base as Object);
|
||||
ld_document!(RefObjectTombstone, ObjectTombstone);
|
|
@ -1,9 +1,16 @@
|
|||
use crate::{OneOrMore, Resolvable};
|
||||
use thiserror::Error;
|
||||
|
||||
use crate::OneOrMore;
|
||||
|
||||
#[macro_use]
|
||||
pub mod account_move;
|
||||
#[macro_use]
|
||||
pub mod block;
|
||||
#[macro_use]
|
||||
pub mod flag;
|
||||
#[macro_use]
|
||||
pub mod poll;
|
||||
#[macro_use]
|
||||
pub mod tag;
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
pub enum RecipeError {
|
|
@ -1,88 +0,0 @@
|
|||
use std::borrow::Cow;
|
||||
use std::fmt::Debug;
|
||||
|
||||
use serde::{Deserialize, Serialize};
|
||||
use url::Url;
|
||||
|
||||
use crate::link::Link;
|
||||
|
||||
pub mod link;
|
||||
pub mod object;
|
||||
pub mod recipe;
|
||||
|
||||
pub trait ObjectTyped: Clone + Debug + Sized + 'static {
|
||||
fn get_type() -> &'static str;
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! def_ld {
|
||||
($obj_type: expr, $x: ty) => {
|
||||
impl $crate::ObjectTyped for $x {
|
||||
fn get_type() -> &'static str {
|
||||
$obj_type
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[macro_export]
|
||||
macro_rules! ld_union {
|
||||
($z: ident, $($item_name: ident as $item_type: ty),+) => {
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct $z {
|
||||
$(
|
||||
#[serde(flatten)]
|
||||
$item_name: Box<$item_type>,
|
||||
)+
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum OneOrMore<T> {
|
||||
One(T),
|
||||
Many(Vec<T>),
|
||||
}
|
||||
|
||||
impl<T> OneOrMore<T> {
|
||||
pub fn into_vec(self) -> Vec<T> {
|
||||
match self {
|
||||
OneOrMore::One(x) => vec![x],
|
||||
OneOrMore::Many(x) => x,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn iter(&self) -> std::slice::Iter<'_, T> {
|
||||
match self {
|
||||
OneOrMore::One(x) => std::slice::from_ref(x).iter(),
|
||||
OneOrMore::Many(x) => x.iter(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
|
||||
pub struct Base {
|
||||
#[serde(rename = "@type")]
|
||||
as_type: Option<OneOrMore<String>>,
|
||||
#[serde(rename = "@id")]
|
||||
as_id: Option<String>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum LinkOrUrl<'a> {
|
||||
Url(Url),
|
||||
Link(Box<Link<'a>>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[repr(transparent)]
|
||||
pub struct Id(pub String);
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub enum ObjectSlot<'a, T: ObjectTyped> {
|
||||
Id(Id),
|
||||
Value(Cow<'a, T>),
|
||||
}
|
|
@ -1,211 +0,0 @@
|
|||
use chrono::{DateTime, Utc};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::{def_ld, ObjectSlot, ObjectTyped, OneOrMore};
|
||||
use crate::object::ObjectLinkUnion;
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct Activity<'a> {
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#actor")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub actor: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#object")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub object: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#target")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub target: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#result")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub result: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#origin")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub origin: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#instrument")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub instrument: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Activity", Activity<'_>, base as Object);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct IntransitiveActivity {}
|
||||
|
||||
def_ld!(
|
||||
"https://www.w3.org/ns/activitystreams#IntransitiveActivity",
|
||||
IntransitiveActivity,
|
||||
base as Activity
|
||||
);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityAccept {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Accept", ActivityAccept, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityTentativeAccept {}
|
||||
|
||||
def_ld!(
|
||||
"https://www.w3.org/ns/activitystreams#TentativeAccept",
|
||||
ActivityTentativeAccept,
|
||||
base as ActivityAccept
|
||||
);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityAdd;
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Add", ActivityAdd, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityArrive;
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Arrive", ActivityArrive, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityCreate;
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Create", ActivityCreate, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityDelete {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Delete", ActivityDelete, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityFollow {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Follow", ActivityFollow, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityIgnore {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Ignore", ActivityIgnore, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityJoin {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Join", ActivityJoin, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityLeave {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Leave", ActivityLeave, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityLike {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Like", ActivityLike, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityOffer {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Offer", ActivityOffer, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityInvite {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Invite", ActivityInvite, base as ActivityOffer);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityReject {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Reject", ActivityReject, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityTentativeReject {}
|
||||
|
||||
def_ld!(
|
||||
"https://www.w3.org/ns/activitystreams#TentativeReject",
|
||||
ActivityTentativeReject,
|
||||
base as ActivityReject
|
||||
);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityRemove {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Remove", ActivityRemove, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityUndo {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Undo", ActivityUndo, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityUpdate {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Update", ActivityUpdate, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityView {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#View", ActivityView, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityListen {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Listen", ActivityListen, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityRead {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Read", ActivityRead, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityMove {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Move", ActivityMove, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityTravel {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Travel", ActivityTravel, base as IntransitiveActivity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityAnnounce {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Announce", ActivityAnnounce, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityBlock {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Block", ActivityBlock, base as ActivityIgnore);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityFlag {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Flag", ActivityFlag, base as Activity);
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityDislike {}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Dislike", ActivityDislike, base as Activity);
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(untagged)]
|
||||
pub enum ActivityClosedStatus<'a> {
|
||||
Date(DateTime<Utc>),
|
||||
Bool(bool),
|
||||
Other(ObjectSlot<'a, ObjectLinkUnion>),
|
||||
}
|
||||
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct ActivityQuestion<'a> {
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#oneOf")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub one_of: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#anyOf")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub any_of: Option<OneOrMore<ObjectSlot<'a, ObjectLinkUnion>>>,
|
||||
|
||||
#[serde(rename = "https://www.w3.org/ns/activitystreams#closed")]
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub closed: Option<OneOrMore<ActivityClosedStatus<'a>>>,
|
||||
}
|
||||
|
||||
def_ld!("https://www.w3.org/ns/activitystreams#Question", ActivityQuestion<'_>, base as IntransitiveActivity);
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "magnetar_model"
|
||||
name = "magnetar_calckey_model"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
|
@ -8,26 +8,20 @@ crate-type = ["rlib"]
|
|||
|
||||
[dependencies]
|
||||
ck = { path = "./entity_ck" }
|
||||
ext_model_migration = { path = "./migration" }
|
||||
ext_calckey_model_migration = { path = "./migration" }
|
||||
|
||||
magnetar_common = { path = "../magnetar_common" }
|
||||
magnetar_sdk = { path = "../magnetar_sdk" }
|
||||
|
||||
dotenvy = { workspace = true }
|
||||
dotenvy = { workspace = true}
|
||||
futures-core = { workspace = true }
|
||||
futures-util = { workspace = true }
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
tokio-util = { workspace = true }
|
||||
redis = { workspace = true, features = ["tokio-comp", "json", "serde_json"] }
|
||||
sea-orm = { workspace = true, features = [
|
||||
"sqlx-postgres",
|
||||
"runtime-tokio-rustls",
|
||||
"macros",
|
||||
] }
|
||||
tokio-util = { workspace = true}
|
||||
redis = { workspace = true, features = ["tokio-comp", "json", "serde_json"]}
|
||||
sea-orm = { workspace = true, features = ["sqlx-postgres", "runtime-tokio-rustls", "macros"] }
|
||||
serde = { workspace = true, features = ["derive"] }
|
||||
serde_json = { workspace = true }
|
||||
strum = { workspace = true }
|
||||
chrono = { workspace = true }
|
||||
tracing = { workspace = true }
|
||||
thiserror = { workspace = true }
|
||||
url = { workspace = true }
|
||||
thiserror = { workspace = true }
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use super::sea_orm_active_enums::AntennaSrcEnum;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
@ -27,6 +27,8 @@ pub struct Model {
|
|||
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: Vec<String>,
|
||||
#[sea_orm(column_name = "excludeKeywords", column_type = "JsonBinary")]
|
||||
pub exclude_keywords: Json,
|
||||
|
@ -46,6 +48,14 @@ pub enum Relation {
|
|||
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",
|
||||
|
@ -68,6 +78,12 @@ impl Related<super::user::Entity> for Entity {
|
|||
}
|
||||
}
|
||||
|
||||
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()
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -65,6 +65,8 @@ pub enum Relation {
|
|||
on_delete = "SetNull"
|
||||
)]
|
||||
DriveFolder,
|
||||
#[sea_orm(has_many = "super::page::Entity")]
|
||||
Page,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::user::Entity",
|
||||
from = "Column::UserId",
|
||||
|
@ -81,6 +83,12 @@ impl Related<super::drive_folder::Entity> for Entity {
|
|||
}
|
||||
}
|
||||
|
||||
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()
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -0,0 +1,51 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[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 {}
|
|
@ -0,0 +1,54 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[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: Vec<String>,
|
||||
#[sea_orm(column_name = "isSensitive")]
|
||||
pub is_sensitive: bool,
|
||||
#[sea_orm(column_name = "likedCount")]
|
||||
pub liked_count: i32,
|
||||
pub tags: Vec<String>,
|
||||
}
|
||||
|
||||
#[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 {}
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use super::sea_orm_active_enums::MetaSensitivemediadetectionEnum;
|
||||
use super::sea_orm_active_enums::MetaSensitivemediadetectionsensitivityEnum;
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
pub mod prelude;
|
||||
|
||||
|
@ -20,6 +20,8 @@ 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 meta;
|
||||
|
@ -34,6 +36,8 @@ 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;
|
||||
|
@ -48,6 +52,10 @@ 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;
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use super::sea_orm_active_enums::MutedNoteReasonEnum;
|
||||
use sea_orm::entity::prelude::*;
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use super::sea_orm_active_enums::NoteVisibilityEnum;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
@ -60,8 +60,6 @@ pub struct Model {
|
|||
pub thread_id: Option<String>,
|
||||
#[sea_orm(column_name = "updatedAt")]
|
||||
pub updated_at: Option<DateTimeWithTimeZone>,
|
||||
pub is_quote: Option<bool>,
|
||||
pub is_renote: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use super::sea_orm_active_enums::NotificationTypeEnum;
|
||||
use sea_orm::entity::prelude::*;
|
||||
|
@ -24,6 +24,8 @@ pub struct Model {
|
|||
#[sea_orm(column_name = "followRequestId")]
|
||||
pub follow_request_id: Option<String>,
|
||||
pub r#type: NotificationTypeEnum,
|
||||
#[sea_orm(column_name = "userGroupInvitationId")]
|
||||
pub user_group_invitation_id: Option<String>,
|
||||
#[sea_orm(column_name = "customBody")]
|
||||
pub custom_body: Option<String>,
|
||||
#[sea_orm(column_name = "customHeader")]
|
||||
|
@ -76,6 +78,14 @@ pub enum Relation {
|
|||
on_delete = "Cascade"
|
||||
)]
|
||||
User1,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::user_group_invitation::Entity",
|
||||
from = "Column::UserGroupInvitationId",
|
||||
to = "super::user_group_invitation::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
UserGroupInvitation,
|
||||
}
|
||||
|
||||
impl Related<super::access_token::Entity> for Entity {
|
||||
|
@ -96,4 +106,10 @@ impl Related<super::note::Entity> for Entity {
|
|||
}
|
||||
}
|
||||
|
||||
impl Related<super::user_group_invitation::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::UserGroupInvitation.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
|
@ -0,0 +1,90 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use super::sea_orm_active_enums::PageVisibilityEnum;
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "page")]
|
||||
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 name: String,
|
||||
pub summary: Option<String>,
|
||||
#[sea_orm(column_name = "alignCenter")]
|
||||
pub align_center: bool,
|
||||
pub font: String,
|
||||
#[sea_orm(column_name = "userId")]
|
||||
pub user_id: String,
|
||||
#[sea_orm(column_name = "eyeCatchingImageId")]
|
||||
pub eye_catching_image_id: Option<String>,
|
||||
#[sea_orm(column_type = "JsonBinary")]
|
||||
pub content: Json,
|
||||
#[sea_orm(column_type = "JsonBinary")]
|
||||
pub variables: Json,
|
||||
pub visibility: PageVisibilityEnum,
|
||||
#[sea_orm(column_name = "visibleUserIds")]
|
||||
pub visible_user_ids: Vec<String>,
|
||||
#[sea_orm(column_name = "likedCount")]
|
||||
pub liked_count: i32,
|
||||
#[sea_orm(column_name = "hideTitleWhenPinned")]
|
||||
pub hide_title_when_pinned: bool,
|
||||
pub script: String,
|
||||
#[sea_orm(column_name = "isPublic")]
|
||||
pub is_public: bool,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::drive_file::Entity",
|
||||
from = "Column::EyeCatchingImageId",
|
||||
to = "super::drive_file::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
DriveFile,
|
||||
#[sea_orm(has_many = "super::page_like::Entity")]
|
||||
PageLike,
|
||||
#[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_one = "super::user_profile::Entity")]
|
||||
UserProfile,
|
||||
}
|
||||
|
||||
impl Related<super::drive_file::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::DriveFile.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::page_like::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::PageLike.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::user::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::User.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::user_profile::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::UserProfile.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
|
@ -0,0 +1,51 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "page_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 = "pageId")]
|
||||
pub page_id: String,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::page::Entity",
|
||||
from = "Column::PageId",
|
||||
to = "super::page::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
Page,
|
||||
#[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::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 {}
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use super::sea_orm_active_enums::PollNotevisibilityEnum;
|
||||
use sea_orm::entity::prelude::*;
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
pub use super::abuse_user_report::Entity as AbuseUserReport;
|
||||
pub use super::access_token::Entity as AccessToken;
|
||||
|
@ -18,6 +18,8 @@ pub use super::drive_folder::Entity as DriveFolder;
|
|||
pub use super::emoji::Entity as Emoji;
|
||||
pub use super::follow_request::Entity as FollowRequest;
|
||||
pub use super::following::Entity as Following;
|
||||
pub use super::gallery_like::Entity as GalleryLike;
|
||||
pub use super::gallery_post::Entity as GalleryPost;
|
||||
pub use super::hashtag::Entity as Hashtag;
|
||||
pub use super::instance::Entity as Instance;
|
||||
pub use super::meta::Entity as Meta;
|
||||
|
@ -32,6 +34,8 @@ pub use super::note_thread_muting::Entity as NoteThreadMuting;
|
|||
pub use super::note_unread::Entity as NoteUnread;
|
||||
pub use super::note_watching::Entity as NoteWatching;
|
||||
pub use super::notification::Entity as Notification;
|
||||
pub use super::page::Entity as Page;
|
||||
pub use super::page_like::Entity as PageLike;
|
||||
pub use super::password_reset_request::Entity as PasswordResetRequest;
|
||||
pub use super::poll::Entity as Poll;
|
||||
pub use super::poll_vote::Entity as PollVote;
|
||||
|
@ -45,6 +49,10 @@ pub use super::signin::Entity as Signin;
|
|||
pub use super::sw_subscription::Entity as SwSubscription;
|
||||
pub use super::used_username::Entity as UsedUsername;
|
||||
pub use super::user::Entity as User;
|
||||
pub use super::user_group::Entity as UserGroup;
|
||||
pub use super::user_group_invitation::Entity as UserGroupInvitation;
|
||||
pub use super::user_group_invite::Entity as UserGroupInvite;
|
||||
pub use super::user_group_joining::Entity as UserGroupJoining;
|
||||
pub use super::user_ip::Entity as UserIp;
|
||||
pub use super::user_keypair::Entity as UserKeypair;
|
||||
pub use super::user_list::Entity as UserList;
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use super::sea_orm_active_enums::RelayStatusEnum;
|
||||
use sea_orm::entity::prelude::*;
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -8,6 +8,8 @@ use serde::{Deserialize, Serialize};
|
|||
pub enum AntennaSrcEnum {
|
||||
#[sea_orm(string_value = "all")]
|
||||
All,
|
||||
#[sea_orm(string_value = "group")]
|
||||
Group,
|
||||
#[sea_orm(string_value = "home")]
|
||||
Home,
|
||||
#[sea_orm(string_value = "instances")]
|
||||
|
@ -98,10 +100,14 @@ pub enum NotificationTypeEnum {
|
|||
Follow,
|
||||
#[sea_orm(string_value = "followRequestAccepted")]
|
||||
FollowRequestAccepted,
|
||||
#[sea_orm(string_value = "groupInvited")]
|
||||
GroupInvited,
|
||||
#[sea_orm(string_value = "mention")]
|
||||
Mention,
|
||||
#[sea_orm(string_value = "pollEnded")]
|
||||
PollEnded,
|
||||
#[sea_orm(string_value = "pollVote")]
|
||||
PollVote,
|
||||
#[sea_orm(string_value = "quote")]
|
||||
Quote,
|
||||
#[sea_orm(string_value = "reaction")]
|
||||
|
@ -114,6 +120,20 @@ pub enum NotificationTypeEnum {
|
|||
Reply,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Copy, Serialize, Deserialize)]
|
||||
#[sea_orm(
|
||||
rs_type = "String",
|
||||
db_type = "Enum",
|
||||
enum_name = "page_visibility_enum"
|
||||
)]
|
||||
pub enum PageVisibilityEnum {
|
||||
#[sea_orm(string_value = "followers")]
|
||||
Followers,
|
||||
#[sea_orm(string_value = "public")]
|
||||
Public,
|
||||
#[sea_orm(string_value = "specified")]
|
||||
Specified,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Copy, Serialize, Deserialize)]
|
||||
#[sea_orm(
|
||||
rs_type = "String",
|
||||
db_type = "Enum",
|
||||
|
@ -153,3 +173,35 @@ pub enum UserProfileFfvisibilityEnum {
|
|||
#[sea_orm(string_value = "public")]
|
||||
Public,
|
||||
}
|
||||
#[derive(Debug, Clone, PartialEq, Eq, EnumIter, DeriveActiveEnum, Copy, Serialize, Deserialize)]
|
||||
#[sea_orm(
|
||||
rs_type = "String",
|
||||
db_type = "Enum",
|
||||
enum_name = "user_profile_mutingnotificationtypes_enum"
|
||||
)]
|
||||
pub enum UserProfileMutingnotificationtypesEnum {
|
||||
#[sea_orm(string_value = "app")]
|
||||
App,
|
||||
#[sea_orm(string_value = "follow")]
|
||||
Follow,
|
||||
#[sea_orm(string_value = "followRequestAccepted")]
|
||||
FollowRequestAccepted,
|
||||
#[sea_orm(string_value = "groupInvited")]
|
||||
GroupInvited,
|
||||
#[sea_orm(string_value = "mention")]
|
||||
Mention,
|
||||
#[sea_orm(string_value = "pollEnded")]
|
||||
PollEnded,
|
||||
#[sea_orm(string_value = "pollVote")]
|
||||
PollVote,
|
||||
#[sea_orm(string_value = "quote")]
|
||||
Quote,
|
||||
#[sea_orm(string_value = "reaction")]
|
||||
Reaction,
|
||||
#[sea_orm(string_value = "receiveFollowRequest")]
|
||||
ReceiveFollowRequest,
|
||||
#[sea_orm(string_value = "renote")]
|
||||
Renote,
|
||||
#[sea_orm(string_value = "reply")]
|
||||
Reply,
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
@ -106,6 +106,10 @@ pub enum Relation {
|
|||
DriveFile1,
|
||||
#[sea_orm(has_many = "super::drive_folder::Entity")]
|
||||
DriveFolder,
|
||||
#[sea_orm(has_many = "super::gallery_like::Entity")]
|
||||
GalleryLike,
|
||||
#[sea_orm(has_many = "super::gallery_post::Entity")]
|
||||
GalleryPost,
|
||||
#[sea_orm(has_many = "super::meta::Entity")]
|
||||
Meta,
|
||||
#[sea_orm(has_many = "super::moderation_log::Entity")]
|
||||
|
@ -124,6 +128,10 @@ pub enum Relation {
|
|||
NoteUnread,
|
||||
#[sea_orm(has_many = "super::note_watching::Entity")]
|
||||
NoteWatching,
|
||||
#[sea_orm(has_many = "super::page::Entity")]
|
||||
Page,
|
||||
#[sea_orm(has_many = "super::page_like::Entity")]
|
||||
PageLike,
|
||||
#[sea_orm(has_many = "super::password_reset_request::Entity")]
|
||||
PasswordResetRequest,
|
||||
#[sea_orm(has_many = "super::poll_vote::Entity")]
|
||||
|
@ -136,6 +144,14 @@ pub enum Relation {
|
|||
Signin,
|
||||
#[sea_orm(has_many = "super::sw_subscription::Entity")]
|
||||
SwSubscription,
|
||||
#[sea_orm(has_many = "super::user_group::Entity")]
|
||||
UserGroup,
|
||||
#[sea_orm(has_many = "super::user_group_invitation::Entity")]
|
||||
UserGroupInvitation,
|
||||
#[sea_orm(has_many = "super::user_group_invite::Entity")]
|
||||
UserGroupInvite,
|
||||
#[sea_orm(has_many = "super::user_group_joining::Entity")]
|
||||
UserGroupJoining,
|
||||
#[sea_orm(has_one = "super::user_keypair::Entity")]
|
||||
UserKeypair,
|
||||
#[sea_orm(has_many = "super::user_list::Entity")]
|
||||
|
@ -202,6 +218,18 @@ impl Related<super::drive_folder::Entity> for Entity {
|
|||
}
|
||||
}
|
||||
|
||||
impl Related<super::gallery_like::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::GalleryLike.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::gallery_post::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::GalleryPost.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::meta::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Meta.def()
|
||||
|
@ -256,6 +284,18 @@ impl Related<super::note_watching::Entity> for Entity {
|
|||
}
|
||||
}
|
||||
|
||||
impl Related<super::page::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Page.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::page_like::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::PageLike.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::password_reset_request::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::PasswordResetRequest.def()
|
||||
|
@ -292,6 +332,30 @@ impl Related<super::sw_subscription::Entity> for Entity {
|
|||
}
|
||||
}
|
||||
|
||||
impl Related<super::user_group::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::UserGroup.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::user_group_invitation::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::UserGroupInvitation.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::user_group_invite::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::UserGroupInvite.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::user_group_joining::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::UserGroupJoining.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::user_keypair::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::UserKeypair.def()
|
|
@ -0,0 +1,62 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "user_group")]
|
||||
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: String,
|
||||
#[sea_orm(column_name = "isPrivate")]
|
||||
pub is_private: 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,
|
||||
#[sea_orm(has_many = "super::user_group_invitation::Entity")]
|
||||
UserGroupInvitation,
|
||||
#[sea_orm(has_many = "super::user_group_invite::Entity")]
|
||||
UserGroupInvite,
|
||||
#[sea_orm(has_many = "super::user_group_joining::Entity")]
|
||||
UserGroupJoining,
|
||||
}
|
||||
|
||||
impl Related<super::user::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::User.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::user_group_invitation::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::UserGroupInvitation.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::user_group_invite::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::UserGroupInvite.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::user_group_joining::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::UserGroupJoining.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
|
@ -0,0 +1,59 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "user_group_invitation")]
|
||||
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 = "userGroupId")]
|
||||
pub user_group_id: 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::UserId",
|
||||
to = "super::user::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
User,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::user_group::Entity",
|
||||
from = "Column::UserGroupId",
|
||||
to = "super::user_group::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
UserGroup,
|
||||
}
|
||||
|
||||
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 Related<super::user_group::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::UserGroup.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
|
@ -0,0 +1,51 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "user_group_invite")]
|
||||
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 = "userGroupId")]
|
||||
pub user_group_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,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::user_group::Entity",
|
||||
from = "Column::UserGroupId",
|
||||
to = "super::user_group::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
UserGroup,
|
||||
}
|
||||
|
||||
impl Related<super::user::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::User.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::user_group::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::UserGroup.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
|
@ -0,0 +1,59 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq, Serialize, Deserialize)]
|
||||
#[sea_orm(table_name = "user_group_joining")]
|
||||
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 = "userGroupId")]
|
||||
pub user_group_id: String,
|
||||
}
|
||||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(has_many = "super::antenna::Entity")]
|
||||
Antenna,
|
||||
#[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::Entity",
|
||||
from = "Column::UserGroupId",
|
||||
to = "super::user_group::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "Cascade"
|
||||
)]
|
||||
UserGroup,
|
||||
}
|
||||
|
||||
impl Related<super::antenna::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::Antenna.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::user::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::User.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl Related<super::user_group::Entity> for Entity {
|
||||
fn to() -> RelationDef {
|
||||
Relation::UserGroup.def()
|
||||
}
|
||||
}
|
||||
|
||||
impl ActiveModelBehavior for ActiveModel {}
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,7 +1,7 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use super::sea_orm_active_enums::NotificationTypeEnum;
|
||||
use super::sea_orm_active_enums::UserProfileFfvisibilityEnum;
|
||||
use super::sea_orm_active_enums::UserProfileMutingnotificationtypesEnum;
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
|
@ -42,6 +42,8 @@ pub struct Model {
|
|||
pub security_keys_available: bool,
|
||||
#[sea_orm(column_name = "usePasswordLessLogin")]
|
||||
pub use_password_less_login: bool,
|
||||
#[sea_orm(column_name = "pinnedPageId", unique)]
|
||||
pub pinned_page_id: Option<String>,
|
||||
#[sea_orm(column_type = "JsonBinary")]
|
||||
pub room: Json,
|
||||
#[sea_orm(column_type = "JsonBinary")]
|
||||
|
@ -51,7 +53,7 @@ pub struct Model {
|
|||
#[sea_orm(column_name = "mutedWords", column_type = "JsonBinary")]
|
||||
pub muted_words: Json,
|
||||
#[sea_orm(column_name = "mutingNotificationTypes")]
|
||||
pub muting_notification_types: Vec<NotificationTypeEnum>,
|
||||
pub muting_notification_types: Vec<UserProfileMutingnotificationtypesEnum>,
|
||||
#[sea_orm(column_name = "noCrawle")]
|
||||
pub no_crawle: bool,
|
||||
#[sea_orm(column_name = "receiveAnnouncementEmail")]
|
||||
|
@ -75,6 +77,14 @@ pub struct Model {
|
|||
|
||||
#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)]
|
||||
pub enum Relation {
|
||||
#[sea_orm(
|
||||
belongs_to = "super::page::Entity",
|
||||
from = "Column::PinnedPageId",
|
||||
to = "super::page::Column::Id",
|
||||
on_update = "NoAction",
|
||||
on_delete = "SetNull"
|
||||
)]
|
||||
Page,
|
||||
#[sea_orm(
|
||||
belongs_to = "super::user::Entity",
|
||||
from = "Column::UserId",
|
||||
|
@ -85,6 +95,12 @@ pub enum Relation {
|
|||
User,
|
||||
}
|
||||
|
||||
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()
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,4 +1,4 @@
|
|||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.10
|
||||
//! `SeaORM` Entity. Generated by sea-orm-codegen 0.12.1
|
||||
|
||||
use sea_orm::entity::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "ext_model_migration"
|
||||
name = "ext_calckey_model_migration"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
|
||||
|
@ -8,12 +8,9 @@ name = "migrate"
|
|||
path = "src/main.rs"
|
||||
|
||||
[lib]
|
||||
name = "ext_model_migration"
|
||||
name = "ext_calckey_model_migration"
|
||||
path = "src/lib.rs"
|
||||
|
||||
[dependencies]
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
sea-orm-migration = { workspace = true, features = [
|
||||
"runtime-tokio-rustls",
|
||||
"sqlx-postgres",
|
||||
] }
|
||||
sea-orm-migration = { workspace = true, features = ["runtime-tokio-rustls", "sqlx-postgres"] }
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue