Removed all references to galleries
ci/woodpecker/tag/ociImageTag Pipeline was successful
Details
ci/woodpecker/tag/ociImageTag Pipeline was successful
Details
This commit is contained in:
parent
8654fe13a6
commit
786f3626af
|
@ -41,8 +41,6 @@ import {UserPublickey} from "@/models/entities/user-publickey.js";
|
||||||
import {UserProfile} from "@/models/entities/user-profile.js";
|
import {UserProfile} from "@/models/entities/user-profile.js";
|
||||||
import {UserSecurityKey} from "@/models/entities/user-security-key.js";
|
import {UserSecurityKey} from "@/models/entities/user-security-key.js";
|
||||||
import {AttestationChallenge} from "@/models/entities/attestation-challenge.js";
|
import {AttestationChallenge} from "@/models/entities/attestation-challenge.js";
|
||||||
import {GalleryPost} from "@/models/entities/gallery-post.js";
|
|
||||||
import {GalleryLike} from "@/models/entities/gallery-like.js";
|
|
||||||
import {ModerationLog} from "@/models/entities/moderation-log.js";
|
import {ModerationLog} from "@/models/entities/moderation-log.js";
|
||||||
import {UsedUsername} from "@/models/entities/used-username.js";
|
import {UsedUsername} from "@/models/entities/used-username.js";
|
||||||
import {Announcement} from "@/models/entities/announcement.js";
|
import {Announcement} from "@/models/entities/announcement.js";
|
||||||
|
@ -134,8 +132,6 @@ export const entities = [
|
||||||
NoteWatching,
|
NoteWatching,
|
||||||
NoteThreadMuting,
|
NoteThreadMuting,
|
||||||
NoteUnread,
|
NoteUnread,
|
||||||
GalleryPost,
|
|
||||||
GalleryLike,
|
|
||||||
DriveFile,
|
DriveFile,
|
||||||
DriveFolder,
|
DriveFolder,
|
||||||
Poll,
|
Poll,
|
||||||
|
|
|
@ -16,10 +16,6 @@ export const kinds = [
|
||||||
"write:notifications",
|
"write:notifications",
|
||||||
"read:reactions",
|
"read:reactions",
|
||||||
"write:reactions",
|
"write:reactions",
|
||||||
"write:votes",
|
"write:votes"
|
||||||
"read:gallery",
|
|
||||||
"write:gallery",
|
|
||||||
"read:gallery-likes",
|
|
||||||
"write:gallery-likes",
|
|
||||||
];
|
];
|
||||||
// IF YOU ADD KINDS(PERMISSIONS), YOU MUST ADD TRANSLATIONS (under _permissions).
|
// IF YOU ADD KINDS(PERMISSIONS), YOU MUST ADD TRANSLATIONS (under _permissions).
|
||||||
|
|
|
@ -24,7 +24,6 @@ import {packedAntennaSchema} from "@/models/schema/antenna.js";
|
||||||
import {packedClipSchema} from "@/models/schema/clip.js";
|
import {packedClipSchema} from "@/models/schema/clip.js";
|
||||||
import {packedFederationInstanceSchema} from "@/models/schema/federation-instance.js";
|
import {packedFederationInstanceSchema} from "@/models/schema/federation-instance.js";
|
||||||
import {packedQueueCountSchema} from "@/models/schema/queue.js";
|
import {packedQueueCountSchema} from "@/models/schema/queue.js";
|
||||||
import {packedGalleryPostSchema} from "@/models/schema/gallery-post.js";
|
|
||||||
import {packedEmojiSchema} from "@/models/schema/emoji.js";
|
import {packedEmojiSchema} from "@/models/schema/emoji.js";
|
||||||
import {packedNoteEdit} from "@/models/schema/note-edit.js";
|
import {packedNoteEdit} from "@/models/schema/note-edit.js";
|
||||||
|
|
||||||
|
@ -55,7 +54,6 @@ export const refs = {
|
||||||
Antenna: packedAntennaSchema,
|
Antenna: packedAntennaSchema,
|
||||||
Clip: packedClipSchema,
|
Clip: packedClipSchema,
|
||||||
FederationInstance: packedFederationInstanceSchema,
|
FederationInstance: packedFederationInstanceSchema,
|
||||||
GalleryPost: packedGalleryPostSchema,
|
|
||||||
Emoji: packedEmojiSchema,
|
Emoji: packedEmojiSchema,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
import {
|
|
||||||
PrimaryColumn,
|
|
||||||
Entity,
|
|
||||||
Index,
|
|
||||||
JoinColumn,
|
|
||||||
Column,
|
|
||||||
ManyToOne,
|
|
||||||
} from "typeorm";
|
|
||||||
import { User } from "./user.js";
|
|
||||||
import { id } from "../id.js";
|
|
||||||
import { GalleryPost } from "./gallery-post.js";
|
|
||||||
|
|
||||||
@Entity()
|
|
||||||
@Index(["userId", "postId"], { unique: true })
|
|
||||||
export class GalleryLike {
|
|
||||||
@PrimaryColumn(id())
|
|
||||||
public id: string;
|
|
||||||
|
|
||||||
@Column("timestamp with time zone")
|
|
||||||
public createdAt: Date;
|
|
||||||
|
|
||||||
@Index()
|
|
||||||
@Column(id())
|
|
||||||
public userId: User["id"];
|
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Column(id())
|
|
||||||
public postId: GalleryPost["id"];
|
|
||||||
|
|
||||||
@ManyToOne((type) => GalleryPost, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public post: GalleryPost | null;
|
|
||||||
}
|
|
|
@ -1,90 +0,0 @@
|
||||||
import {
|
|
||||||
Entity,
|
|
||||||
Index,
|
|
||||||
JoinColumn,
|
|
||||||
Column,
|
|
||||||
PrimaryColumn,
|
|
||||||
ManyToOne,
|
|
||||||
} from "typeorm";
|
|
||||||
import { User } from "./user.js";
|
|
||||||
import { id } from "../id.js";
|
|
||||||
import type { DriveFile } from "./drive-file.js";
|
|
||||||
|
|
||||||
@Entity()
|
|
||||||
export class GalleryPost {
|
|
||||||
@PrimaryColumn(id())
|
|
||||||
public id: string;
|
|
||||||
|
|
||||||
@Index()
|
|
||||||
@Column("timestamp with time zone", {
|
|
||||||
comment: "The created date of the GalleryPost.",
|
|
||||||
})
|
|
||||||
public createdAt: Date;
|
|
||||||
|
|
||||||
@Index()
|
|
||||||
@Column("timestamp with time zone", {
|
|
||||||
comment: "The updated date of the GalleryPost.",
|
|
||||||
})
|
|
||||||
public updatedAt: Date;
|
|
||||||
|
|
||||||
@Column("varchar", {
|
|
||||||
length: 256,
|
|
||||||
})
|
|
||||||
public title: string;
|
|
||||||
|
|
||||||
@Column("varchar", {
|
|
||||||
length: 2048,
|
|
||||||
nullable: true,
|
|
||||||
})
|
|
||||||
public description: string | null;
|
|
||||||
|
|
||||||
@Index()
|
|
||||||
@Column({
|
|
||||||
...id(),
|
|
||||||
comment: "The ID of author.",
|
|
||||||
})
|
|
||||||
public userId: User["id"];
|
|
||||||
|
|
||||||
@ManyToOne((type) => User, {
|
|
||||||
onDelete: "CASCADE",
|
|
||||||
})
|
|
||||||
@JoinColumn()
|
|
||||||
public user: User | null;
|
|
||||||
|
|
||||||
@Index()
|
|
||||||
@Column({
|
|
||||||
...id(),
|
|
||||||
array: true,
|
|
||||||
default: "{}",
|
|
||||||
})
|
|
||||||
public fileIds: DriveFile["id"][];
|
|
||||||
|
|
||||||
@Index()
|
|
||||||
@Column("boolean", {
|
|
||||||
default: false,
|
|
||||||
comment: "Whether the post is sensitive.",
|
|
||||||
})
|
|
||||||
public isSensitive: boolean;
|
|
||||||
|
|
||||||
@Index()
|
|
||||||
@Column("integer", {
|
|
||||||
default: 0,
|
|
||||||
})
|
|
||||||
public likedCount: number;
|
|
||||||
|
|
||||||
@Index()
|
|
||||||
@Column("varchar", {
|
|
||||||
length: 128,
|
|
||||||
array: true,
|
|
||||||
default: "{}",
|
|
||||||
})
|
|
||||||
public tags: string[];
|
|
||||||
|
|
||||||
constructor(data: Partial<GalleryPost>) {
|
|
||||||
if (data == null) return;
|
|
||||||
|
|
||||||
for (const [k, v] of Object.entries(data)) {
|
|
||||||
(this as any)[k] = v;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -35,8 +35,6 @@ import {UserProfile} from "./entities/user-profile.js";
|
||||||
import {AttestationChallenge} from "./entities/attestation-challenge.js";
|
import {AttestationChallenge} from "./entities/attestation-challenge.js";
|
||||||
import {UserSecurityKey} from "./entities/user-security-key.js";
|
import {UserSecurityKey} from "./entities/user-security-key.js";
|
||||||
import {HashtagRepository} from "./repositories/hashtag.js";
|
import {HashtagRepository} from "./repositories/hashtag.js";
|
||||||
import {GalleryPostRepository} from "./repositories/gallery-post.js";
|
|
||||||
import {GalleryLikeRepository} from "./repositories/gallery-like.js";
|
|
||||||
import {ModerationLogRepository} from "./repositories/moderation-logs.js";
|
import {ModerationLogRepository} from "./repositories/moderation-logs.js";
|
||||||
import {UsedUsername} from "./entities/used-username.js";
|
import {UsedUsername} from "./entities/used-username.js";
|
||||||
import {ClipRepository} from "./repositories/clip.js";
|
import {ClipRepository} from "./repositories/clip.js";
|
||||||
|
@ -98,8 +96,6 @@ export const RegistrationTickets = db.getRepository(RegistrationTicket);
|
||||||
export const AuthSessions = AuthSessionRepository;
|
export const AuthSessions = AuthSessionRepository;
|
||||||
export const AccessTokens = db.getRepository(AccessToken);
|
export const AccessTokens = db.getRepository(AccessToken);
|
||||||
export const Signins = SigninRepository;
|
export const Signins = SigninRepository;
|
||||||
export const GalleryPosts = GalleryPostRepository;
|
|
||||||
export const GalleryLikes = GalleryLikeRepository;
|
|
||||||
export const ModerationLogs = ModerationLogRepository;
|
export const ModerationLogs = ModerationLogRepository;
|
||||||
export const Clips = ClipRepository;
|
export const Clips = ClipRepository;
|
||||||
export const ClipNotes = db.getRepository(ClipNote);
|
export const ClipNotes = db.getRepository(ClipNote);
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
import { db } from "@/db/postgre.js";
|
|
||||||
import { GalleryLike } from "@/models/entities/gallery-like.js";
|
|
||||||
import { GalleryPosts } from "../index.js";
|
|
||||||
|
|
||||||
export const GalleryLikeRepository = db.getRepository(GalleryLike).extend({
|
|
||||||
async pack(src: GalleryLike["id"] | GalleryLike, me?: any) {
|
|
||||||
const like =
|
|
||||||
typeof src === "object" ? src : await this.findOneByOrFail({ id: src });
|
|
||||||
|
|
||||||
return {
|
|
||||||
id: like.id,
|
|
||||||
post: await GalleryPosts.pack(like.post || like.postId, me),
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
packMany(likes: any[], me: any) {
|
|
||||||
return Promise.all(likes.map((x) => this.pack(x, me)));
|
|
||||||
},
|
|
||||||
});
|
|
|
@ -1,41 +0,0 @@
|
||||||
import { db } from "@/db/postgre.js";
|
|
||||||
import { GalleryPost } from "@/models/entities/gallery-post.js";
|
|
||||||
import type { Packed } from "@/misc/schema.js";
|
|
||||||
import { Users, DriveFiles, GalleryLikes } from "../index.js";
|
|
||||||
import { awaitAll } from "@/prelude/await-all.js";
|
|
||||||
import type { User } from "@/models/entities/user.js";
|
|
||||||
|
|
||||||
export const GalleryPostRepository = db.getRepository(GalleryPost).extend({
|
|
||||||
async pack(
|
|
||||||
src: GalleryPost["id"] | GalleryPost,
|
|
||||||
me?: { id: User["id"] } | null | undefined,
|
|
||||||
): Promise<Packed<"GalleryPost">> {
|
|
||||||
const meId = me ? me.id : null;
|
|
||||||
const post =
|
|
||||||
typeof src === "object" ? src : await this.findOneByOrFail({ id: src });
|
|
||||||
|
|
||||||
return await awaitAll({
|
|
||||||
id: post.id,
|
|
||||||
createdAt: post.createdAt.toISOString(),
|
|
||||||
updatedAt: post.updatedAt.toISOString(),
|
|
||||||
userId: post.userId,
|
|
||||||
user: Users.pack(post.user || post.userId, me),
|
|
||||||
title: post.title,
|
|
||||||
description: post.description,
|
|
||||||
fileIds: post.fileIds,
|
|
||||||
files: DriveFiles.packMany(post.fileIds),
|
|
||||||
tags: post.tags.length > 0 ? post.tags : undefined,
|
|
||||||
isSensitive: post.isSensitive,
|
|
||||||
likedCount: post.likedCount,
|
|
||||||
isLiked: meId
|
|
||||||
? await GalleryLikes.findOneBy({ postId: post.id, userId: meId }).then(
|
|
||||||
(x) => x != null,
|
|
||||||
)
|
|
||||||
: undefined,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
packMany(posts: GalleryPost[], me?: { id: User["id"] } | null | undefined) {
|
|
||||||
return Promise.all(posts.map((x) => this.pack(x, me)));
|
|
||||||
},
|
|
||||||
});
|
|
|
@ -1,8 +1,6 @@
|
||||||
import {Note} from "@/models/entities/note.js";
|
import {Note} from "@/models/entities/note.js";
|
||||||
import type {User} from "@/models/entities/user.js";
|
import type {User} from "@/models/entities/user.js";
|
||||||
import {Followings, NoteReactions, Polls, PollVotes, Users,} from "../index.js";
|
import {Followings, Polls, PollVotes, Users,} from "../index.js";
|
||||||
import {convertLegacyReaction,} from "@/misc/reaction-lib.js";
|
|
||||||
import type {NoteReaction} from "@/models/entities/note-reaction.js";
|
|
||||||
import {db} from "@/db/postgre.js";
|
import {db} from "@/db/postgre.js";
|
||||||
|
|
||||||
export async function populatePoll(note: Note, meId: User["id"] | null) {
|
export async function populatePoll(note: Note, meId: User["id"] | null) {
|
||||||
|
@ -43,35 +41,6 @@ export async function populatePoll(note: Note, meId: User["id"] | null) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async function populateMyReaction(
|
|
||||||
note: Note,
|
|
||||||
meId: User["id"],
|
|
||||||
_hint_?: {
|
|
||||||
myReactions: Map<Note["id"], NoteReaction | null>;
|
|
||||||
},
|
|
||||||
) {
|
|
||||||
if (_hint_?.myReactions) {
|
|
||||||
const reaction = _hint_.myReactions.get(note.id);
|
|
||||||
if (reaction) {
|
|
||||||
return convertLegacyReaction(reaction.reaction);
|
|
||||||
} else if (reaction === null) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
// 実装上抜けがあるだけかもしれないので、「ヒントに含まれてなかったら(=undefinedなら)return」のようにはしない
|
|
||||||
}
|
|
||||||
|
|
||||||
const reaction = await NoteReactions.findOneBy({
|
|
||||||
userId: meId,
|
|
||||||
noteId: note.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (reaction) {
|
|
||||||
return convertLegacyReaction(reaction.reaction);
|
|
||||||
}
|
|
||||||
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const NoteRepository = db.getRepository(Note).extend({
|
export const NoteRepository = db.getRepository(Note).extend({
|
||||||
async isVisibleForMe(note: Note, meId: User["id"] | null): Promise<boolean> {
|
async isVisibleForMe(note: Note, meId: User["id"] | null): Promise<boolean> {
|
||||||
// This code must always be synchronized with the checks in generateVisibilityQuery.
|
// This code must always be synchronized with the checks in generateVisibilityQuery.
|
||||||
|
|
|
@ -1,83 +0,0 @@
|
||||||
export const packedGalleryPostSchema = {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: "string",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
format: "id",
|
|
||||||
example: "xxxxxxxxxx",
|
|
||||||
},
|
|
||||||
createdAt: {
|
|
||||||
type: "string",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
format: "date-time",
|
|
||||||
},
|
|
||||||
updatedAt: {
|
|
||||||
type: "string",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
format: "date-time",
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
type: "string",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
description: {
|
|
||||||
type: "string",
|
|
||||||
optional: false,
|
|
||||||
nullable: true,
|
|
||||||
},
|
|
||||||
userId: {
|
|
||||||
type: "string",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
format: "id",
|
|
||||||
},
|
|
||||||
user: {
|
|
||||||
type: "object",
|
|
||||||
ref: "UserLite",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
fileIds: {
|
|
||||||
type: "array",
|
|
||||||
optional: true,
|
|
||||||
nullable: false,
|
|
||||||
items: {
|
|
||||||
type: "string",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
format: "id",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
files: {
|
|
||||||
type: "array",
|
|
||||||
optional: true,
|
|
||||||
nullable: false,
|
|
||||||
items: {
|
|
||||||
type: "object",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
ref: "DriveFile",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
tags: {
|
|
||||||
type: "array",
|
|
||||||
optional: true,
|
|
||||||
nullable: false,
|
|
||||||
items: {
|
|
||||||
type: "string",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
isSensitive: {
|
|
||||||
type: "boolean",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
|
@ -140,15 +140,6 @@ import * as ep___following_requests_accept from "./endpoints/following/requests/
|
||||||
import * as ep___following_requests_cancel from "./endpoints/following/requests/cancel.js";
|
import * as ep___following_requests_cancel from "./endpoints/following/requests/cancel.js";
|
||||||
import * as ep___following_requests_list from "./endpoints/following/requests/list.js";
|
import * as ep___following_requests_list from "./endpoints/following/requests/list.js";
|
||||||
import * as ep___following_requests_reject from "./endpoints/following/requests/reject.js";
|
import * as ep___following_requests_reject from "./endpoints/following/requests/reject.js";
|
||||||
import * as ep___gallery_featured from "./endpoints/gallery/featured.js";
|
|
||||||
import * as ep___gallery_popular from "./endpoints/gallery/popular.js";
|
|
||||||
import * as ep___gallery_posts from "./endpoints/gallery/posts.js";
|
|
||||||
import * as ep___gallery_posts_create from "./endpoints/gallery/posts/create.js";
|
|
||||||
import * as ep___gallery_posts_delete from "./endpoints/gallery/posts/delete.js";
|
|
||||||
import * as ep___gallery_posts_like from "./endpoints/gallery/posts/like.js";
|
|
||||||
import * as ep___gallery_posts_show from "./endpoints/gallery/posts/show.js";
|
|
||||||
import * as ep___gallery_posts_unlike from "./endpoints/gallery/posts/unlike.js";
|
|
||||||
import * as ep___gallery_posts_update from "./endpoints/gallery/posts/update.js";
|
|
||||||
import * as ep___getOnlineUsersCount from "./endpoints/get-online-users-count.js";
|
import * as ep___getOnlineUsersCount from "./endpoints/get-online-users-count.js";
|
||||||
import * as ep___hashtags_list from "./endpoints/hashtags/list.js";
|
import * as ep___hashtags_list from "./endpoints/hashtags/list.js";
|
||||||
import * as ep___hashtags_search from "./endpoints/hashtags/search.js";
|
import * as ep___hashtags_search from "./endpoints/hashtags/search.js";
|
||||||
|
@ -175,8 +166,6 @@ import * as ep___i_exportNotes from "./endpoints/i/export-notes.js";
|
||||||
import * as ep___i_importPosts from "./endpoints/i/import-posts.js";
|
import * as ep___i_importPosts from "./endpoints/i/import-posts.js";
|
||||||
import * as ep___i_exportUserLists from "./endpoints/i/export-user-lists.js";
|
import * as ep___i_exportUserLists from "./endpoints/i/export-user-lists.js";
|
||||||
import * as ep___i_favorites from "./endpoints/i/favorites.js";
|
import * as ep___i_favorites from "./endpoints/i/favorites.js";
|
||||||
import * as ep___i_gallery_likes from "./endpoints/i/gallery/likes.js";
|
|
||||||
import * as ep___i_gallery_posts from "./endpoints/i/gallery/posts.js";
|
|
||||||
import * as ep___i_getWordMutedNotesCount from "./endpoints/i/get-word-muted-notes-count.js";
|
import * as ep___i_getWordMutedNotesCount from "./endpoints/i/get-word-muted-notes-count.js";
|
||||||
import * as ep___i_importBlocking from "./endpoints/i/import-blocking.js";
|
import * as ep___i_importBlocking from "./endpoints/i/import-blocking.js";
|
||||||
import * as ep___i_importFollowing from "./endpoints/i/import-following.js";
|
import * as ep___i_importFollowing from "./endpoints/i/import-following.js";
|
||||||
|
@ -271,7 +260,6 @@ import * as ep___users from "./endpoints/users.js";
|
||||||
import * as ep___users_clips from "./endpoints/users/clips.js";
|
import * as ep___users_clips from "./endpoints/users/clips.js";
|
||||||
import * as ep___users_followers from "./endpoints/users/followers.js";
|
import * as ep___users_followers from "./endpoints/users/followers.js";
|
||||||
import * as ep___users_following from "./endpoints/users/following.js";
|
import * as ep___users_following from "./endpoints/users/following.js";
|
||||||
import * as ep___users_gallery_posts from "./endpoints/users/gallery/posts.js";
|
|
||||||
import * as ep___users_getFrequentlyRepliedUsers from "./endpoints/users/get-frequently-replied-users.js";
|
import * as ep___users_getFrequentlyRepliedUsers from "./endpoints/users/get-frequently-replied-users.js";
|
||||||
import * as ep___users_lists_create from "./endpoints/users/lists/create.js";
|
import * as ep___users_lists_create from "./endpoints/users/lists/create.js";
|
||||||
import * as ep___users_lists_delete from "./endpoints/users/lists/delete.js";
|
import * as ep___users_lists_delete from "./endpoints/users/lists/delete.js";
|
||||||
|
@ -284,7 +272,6 @@ import * as ep___users_lists_update from "./endpoints/users/lists/update.js";
|
||||||
import * as ep___users_notes from "./endpoints/users/notes.js";
|
import * as ep___users_notes from "./endpoints/users/notes.js";
|
||||||
import * as ep___users_reactions from "./endpoints/users/reactions.js";
|
import * as ep___users_reactions from "./endpoints/users/reactions.js";
|
||||||
import * as ep___users_recommendation from "./endpoints/users/recommendation.js";
|
import * as ep___users_recommendation from "./endpoints/users/recommendation.js";
|
||||||
import * as ep___users_relation from "./endpoints/users/relation.js";
|
|
||||||
import * as ep___users_reportAbuse from "./endpoints/users/report-abuse.js";
|
import * as ep___users_reportAbuse from "./endpoints/users/report-abuse.js";
|
||||||
import * as ep___users_searchByUsernameAndHost from "./endpoints/users/search-by-username-and-host.js";
|
import * as ep___users_searchByUsernameAndHost from "./endpoints/users/search-by-username-and-host.js";
|
||||||
import * as ep___users_search from "./endpoints/users/search.js";
|
import * as ep___users_search from "./endpoints/users/search.js";
|
||||||
|
@ -443,15 +430,6 @@ const eps = [
|
||||||
["following/requests/cancel", ep___following_requests_cancel],
|
["following/requests/cancel", ep___following_requests_cancel],
|
||||||
["following/requests/list", ep___following_requests_list],
|
["following/requests/list", ep___following_requests_list],
|
||||||
["following/requests/reject", ep___following_requests_reject],
|
["following/requests/reject", ep___following_requests_reject],
|
||||||
["gallery/featured", ep___gallery_featured],
|
|
||||||
["gallery/popular", ep___gallery_popular],
|
|
||||||
["gallery/posts", ep___gallery_posts],
|
|
||||||
["gallery/posts/create", ep___gallery_posts_create],
|
|
||||||
["gallery/posts/delete", ep___gallery_posts_delete],
|
|
||||||
["gallery/posts/like", ep___gallery_posts_like],
|
|
||||||
["gallery/posts/show", ep___gallery_posts_show],
|
|
||||||
["gallery/posts/unlike", ep___gallery_posts_unlike],
|
|
||||||
["gallery/posts/update", ep___gallery_posts_update],
|
|
||||||
["get-online-users-count", ep___getOnlineUsersCount],
|
["get-online-users-count", ep___getOnlineUsersCount],
|
||||||
["hashtags/list", ep___hashtags_list],
|
["hashtags/list", ep___hashtags_list],
|
||||||
["hashtags/search", ep___hashtags_search],
|
["hashtags/search", ep___hashtags_search],
|
||||||
|
@ -480,8 +458,6 @@ const eps = [
|
||||||
["i/import-posts", ep___i_importPosts],
|
["i/import-posts", ep___i_importPosts],
|
||||||
["i/export-user-lists", ep___i_exportUserLists],
|
["i/export-user-lists", ep___i_exportUserLists],
|
||||||
["i/favorites", ep___i_favorites],
|
["i/favorites", ep___i_favorites],
|
||||||
["i/gallery/likes", ep___i_gallery_likes],
|
|
||||||
["i/gallery/posts", ep___i_gallery_posts],
|
|
||||||
["i/get-word-muted-notes-count", ep___i_getWordMutedNotesCount],
|
["i/get-word-muted-notes-count", ep___i_getWordMutedNotesCount],
|
||||||
["i/import-blocking", ep___i_importBlocking],
|
["i/import-blocking", ep___i_importBlocking],
|
||||||
["i/import-following", ep___i_importFollowing],
|
["i/import-following", ep___i_importFollowing],
|
||||||
|
@ -576,7 +552,6 @@ const eps = [
|
||||||
["users/clips", ep___users_clips],
|
["users/clips", ep___users_clips],
|
||||||
["users/followers", ep___users_followers],
|
["users/followers", ep___users_followers],
|
||||||
["users/following", ep___users_following],
|
["users/following", ep___users_following],
|
||||||
["users/gallery/posts", ep___users_gallery_posts],
|
|
||||||
["users/get-frequently-replied-users", ep___users_getFrequentlyRepliedUsers],
|
["users/get-frequently-replied-users", ep___users_getFrequentlyRepliedUsers],
|
||||||
["users/lists/create", ep___users_lists_create],
|
["users/lists/create", ep___users_lists_create],
|
||||||
["users/lists/delete", ep___users_lists_delete],
|
["users/lists/delete", ep___users_lists_delete],
|
||||||
|
@ -589,7 +564,6 @@ const eps = [
|
||||||
["users/notes", ep___users_notes],
|
["users/notes", ep___users_notes],
|
||||||
["users/reactions", ep___users_reactions],
|
["users/reactions", ep___users_reactions],
|
||||||
["users/recommendation", ep___users_recommendation],
|
["users/recommendation", ep___users_recommendation],
|
||||||
["users/relation", ep___users_relation],
|
|
||||||
["users/report-abuse", ep___users_reportAbuse],
|
["users/report-abuse", ep___users_reportAbuse],
|
||||||
["users/search-by-username-and-host", ep___users_searchByUsernameAndHost],
|
["users/search-by-username-and-host", ep___users_searchByUsernameAndHost],
|
||||||
["users/search", ep___users_search],
|
["users/search", ep___users_search],
|
||||||
|
|
|
@ -1,40 +0,0 @@
|
||||||
import define from "../../define.js";
|
|
||||||
import { GalleryPosts } from "@/models/index.js";
|
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
tags: ["gallery"],
|
|
||||||
|
|
||||||
requireCredential: false,
|
|
||||||
requireCredentialPrivateMode: true,
|
|
||||||
|
|
||||||
res: {
|
|
||||||
type: "array",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
items: {
|
|
||||||
type: "object",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
ref: "GalleryPost",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const paramDef = {
|
|
||||||
type: "object",
|
|
||||||
properties: {},
|
|
||||||
required: [],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, me) => {
|
|
||||||
const query = GalleryPosts.createQueryBuilder("post")
|
|
||||||
.andWhere("post.createdAt > :date", {
|
|
||||||
date: new Date(Date.now() - 1000 * 60 * 60 * 24 * 3),
|
|
||||||
})
|
|
||||||
.andWhere("post.likedCount > 0")
|
|
||||||
.orderBy("post.likedCount", "DESC");
|
|
||||||
|
|
||||||
const posts = await query.take(10).getMany();
|
|
||||||
|
|
||||||
return await GalleryPosts.packMany(posts, me);
|
|
||||||
});
|
|
|
@ -1,37 +0,0 @@
|
||||||
import define from "../../define.js";
|
|
||||||
import { GalleryPosts } from "@/models/index.js";
|
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
tags: ["gallery"],
|
|
||||||
|
|
||||||
requireCredential: false,
|
|
||||||
requireCredentialPrivateMode: true,
|
|
||||||
|
|
||||||
res: {
|
|
||||||
type: "array",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
items: {
|
|
||||||
type: "object",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
ref: "GalleryPost",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const paramDef = {
|
|
||||||
type: "object",
|
|
||||||
properties: {},
|
|
||||||
required: [],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, me) => {
|
|
||||||
const query = GalleryPosts.createQueryBuilder("post")
|
|
||||||
.andWhere("post.likedCount > 0")
|
|
||||||
.orderBy("post.likedCount", "DESC");
|
|
||||||
|
|
||||||
const posts = await query.take(10).getMany();
|
|
||||||
|
|
||||||
return await GalleryPosts.packMany(posts, me);
|
|
||||||
});
|
|
|
@ -1,42 +0,0 @@
|
||||||
import define from "../../define.js";
|
|
||||||
import { makePaginationQuery } from "../../common/make-pagination-query.js";
|
|
||||||
import { GalleryPosts } from "@/models/index.js";
|
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
tags: ["gallery"],
|
|
||||||
requireCredentialPrivateMode: true,
|
|
||||||
|
|
||||||
res: {
|
|
||||||
type: "array",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
items: {
|
|
||||||
type: "object",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
ref: "GalleryPost",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const paramDef = {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
limit: { type: "integer", minimum: 1, maximum: 100, default: 10 },
|
|
||||||
sinceId: { type: "string", format: "misskey:id" },
|
|
||||||
untilId: { type: "string", format: "misskey:id" },
|
|
||||||
},
|
|
||||||
required: [],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, me) => {
|
|
||||||
const query = makePaginationQuery(
|
|
||||||
GalleryPosts.createQueryBuilder("post"),
|
|
||||||
ps.sinceId,
|
|
||||||
ps.untilId,
|
|
||||||
).innerJoinAndSelect("post.user", "user");
|
|
||||||
|
|
||||||
const posts = await query.take(ps.limit).getMany();
|
|
||||||
|
|
||||||
return await GalleryPosts.packMany(posts, me);
|
|
||||||
});
|
|
|
@ -1,81 +0,0 @@
|
||||||
import define from "../../../define.js";
|
|
||||||
import { DriveFiles, GalleryPosts } from "@/models/index.js";
|
|
||||||
import { genId } from "../../../../../misc/gen-id.js";
|
|
||||||
import { GalleryPost } from "@/models/entities/gallery-post.js";
|
|
||||||
import { ApiError } from "../../../error.js";
|
|
||||||
import type { DriveFile } from "@/models/entities/drive-file.js";
|
|
||||||
import { HOUR } from "@/const.js";
|
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
tags: ["gallery"],
|
|
||||||
|
|
||||||
requireCredential: true,
|
|
||||||
|
|
||||||
kind: "write:gallery",
|
|
||||||
|
|
||||||
limit: {
|
|
||||||
duration: HOUR,
|
|
||||||
max: 300,
|
|
||||||
},
|
|
||||||
|
|
||||||
res: {
|
|
||||||
type: "object",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
ref: "GalleryPost",
|
|
||||||
},
|
|
||||||
|
|
||||||
errors: {},
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const paramDef = {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
title: { type: "string", minLength: 1 },
|
|
||||||
description: { type: "string", nullable: true },
|
|
||||||
fileIds: {
|
|
||||||
type: "array",
|
|
||||||
uniqueItems: true,
|
|
||||||
minItems: 1,
|
|
||||||
maxItems: 32,
|
|
||||||
items: {
|
|
||||||
type: "string",
|
|
||||||
format: "misskey:id",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
isSensitive: { type: "boolean", default: false },
|
|
||||||
},
|
|
||||||
required: ["title", "fileIds"],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, user) => {
|
|
||||||
const files = (
|
|
||||||
await Promise.all(
|
|
||||||
ps.fileIds.map((fileId) =>
|
|
||||||
DriveFiles.findOneBy({
|
|
||||||
id: fileId,
|
|
||||||
userId: user.id,
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
).filter((file): file is DriveFile => file != null);
|
|
||||||
|
|
||||||
if (files.length === 0) {
|
|
||||||
throw new Error();
|
|
||||||
}
|
|
||||||
|
|
||||||
const post = await GalleryPosts.insert(
|
|
||||||
new GalleryPost({
|
|
||||||
id: genId(),
|
|
||||||
createdAt: new Date(),
|
|
||||||
updatedAt: new Date(),
|
|
||||||
title: ps.title,
|
|
||||||
description: ps.description,
|
|
||||||
userId: user.id,
|
|
||||||
isSensitive: ps.isSensitive,
|
|
||||||
fileIds: files.map((file) => file.id),
|
|
||||||
}),
|
|
||||||
).then((x) => GalleryPosts.findOneByOrFail(x.identifiers[0]));
|
|
||||||
|
|
||||||
return await GalleryPosts.pack(post, user);
|
|
||||||
});
|
|
|
@ -1,40 +0,0 @@
|
||||||
import define from "../../../define.js";
|
|
||||||
import { ApiError } from "../../../error.js";
|
|
||||||
import { GalleryPosts } from "@/models/index.js";
|
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
tags: ["gallery"],
|
|
||||||
|
|
||||||
requireCredential: true,
|
|
||||||
|
|
||||||
kind: "write:gallery",
|
|
||||||
|
|
||||||
errors: {
|
|
||||||
noSuchPost: {
|
|
||||||
message: "No such post.",
|
|
||||||
code: "NO_SUCH_POST",
|
|
||||||
id: "ae52f367-4bd7-4ecd-afc6-5672fff427f5",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const paramDef = {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
postId: { type: "string", format: "misskey:id" },
|
|
||||||
},
|
|
||||||
required: ["postId"],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, user) => {
|
|
||||||
const post = await GalleryPosts.findOneBy({
|
|
||||||
id: ps.postId,
|
|
||||||
userId: user.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (post == null) {
|
|
||||||
throw new ApiError(meta.errors.noSuchPost);
|
|
||||||
}
|
|
||||||
|
|
||||||
await GalleryPosts.delete(post.id);
|
|
||||||
});
|
|
|
@ -1,61 +0,0 @@
|
||||||
import define from "../../../define.js";
|
|
||||||
import { ApiError } from "../../../error.js";
|
|
||||||
import { GalleryPosts, GalleryLikes } from "@/models/index.js";
|
|
||||||
import { genId } from "@/misc/gen-id.js";
|
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
tags: ["gallery"],
|
|
||||||
|
|
||||||
requireCredential: true,
|
|
||||||
|
|
||||||
kind: "write:gallery-likes",
|
|
||||||
|
|
||||||
errors: {
|
|
||||||
noSuchPost: {
|
|
||||||
message: "No such post.",
|
|
||||||
code: "NO_SUCH_POST",
|
|
||||||
id: "56c06af3-1287-442f-9701-c93f7c4a62ff",
|
|
||||||
},
|
|
||||||
|
|
||||||
alreadyLiked: {
|
|
||||||
message: "The post has already been liked.",
|
|
||||||
code: "ALREADY_LIKED",
|
|
||||||
id: "40e9ed56-a59c-473a-bf3f-f289c54fb5a7",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const paramDef = {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
postId: { type: "string", format: "misskey:id" },
|
|
||||||
},
|
|
||||||
required: ["postId"],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, user) => {
|
|
||||||
const post = await GalleryPosts.findOneBy({ id: ps.postId });
|
|
||||||
if (post == null) {
|
|
||||||
throw new ApiError(meta.errors.noSuchPost);
|
|
||||||
}
|
|
||||||
|
|
||||||
// if already liked
|
|
||||||
const exist = await GalleryLikes.findOneBy({
|
|
||||||
postId: post.id,
|
|
||||||
userId: user.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (exist != null) {
|
|
||||||
throw new ApiError(meta.errors.alreadyLiked);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create like
|
|
||||||
await GalleryLikes.insert({
|
|
||||||
id: genId(),
|
|
||||||
createdAt: new Date(),
|
|
||||||
postId: post.id,
|
|
||||||
userId: user.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
GalleryPosts.increment({ id: post.id }, "likedCount", 1);
|
|
||||||
});
|
|
|
@ -1,45 +0,0 @@
|
||||||
import define from "../../../define.js";
|
|
||||||
import { ApiError } from "../../../error.js";
|
|
||||||
import { GalleryPosts } from "@/models/index.js";
|
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
tags: ["gallery"],
|
|
||||||
|
|
||||||
requireCredential: false,
|
|
||||||
requireCredentialPrivateMode: true,
|
|
||||||
|
|
||||||
errors: {
|
|
||||||
noSuchPost: {
|
|
||||||
message: "No such post.",
|
|
||||||
code: "NO_SUCH_POST",
|
|
||||||
id: "1137bf14-c5b0-4604-85bb-5b5371b1cd45",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
res: {
|
|
||||||
type: "object",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
ref: "GalleryPost",
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const paramDef = {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
postId: { type: "string", format: "misskey:id" },
|
|
||||||
},
|
|
||||||
required: ["postId"],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, me) => {
|
|
||||||
const post = await GalleryPosts.findOneBy({
|
|
||||||
id: ps.postId,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (post == null) {
|
|
||||||
throw new ApiError(meta.errors.noSuchPost);
|
|
||||||
}
|
|
||||||
|
|
||||||
return await GalleryPosts.pack(post, me);
|
|
||||||
});
|
|
|
@ -1,54 +0,0 @@
|
||||||
import define from "../../../define.js";
|
|
||||||
import { ApiError } from "../../../error.js";
|
|
||||||
import { GalleryPosts, GalleryLikes } from "@/models/index.js";
|
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
tags: ["gallery"],
|
|
||||||
|
|
||||||
requireCredential: true,
|
|
||||||
|
|
||||||
kind: "write:gallery-likes",
|
|
||||||
|
|
||||||
errors: {
|
|
||||||
noSuchPost: {
|
|
||||||
message: "No such post.",
|
|
||||||
code: "NO_SUCH_POST",
|
|
||||||
id: "c32e6dd0-b555-4413-925e-b3757d19ed84",
|
|
||||||
},
|
|
||||||
|
|
||||||
notLiked: {
|
|
||||||
message: "You have not liked that post.",
|
|
||||||
code: "NOT_LIKED",
|
|
||||||
id: "e3e8e06e-be37-41f7-a5b4-87a8250288f0",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const paramDef = {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
postId: { type: "string", format: "misskey:id" },
|
|
||||||
},
|
|
||||||
required: ["postId"],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, user) => {
|
|
||||||
const post = await GalleryPosts.findOneBy({ id: ps.postId });
|
|
||||||
if (post == null) {
|
|
||||||
throw new ApiError(meta.errors.noSuchPost);
|
|
||||||
}
|
|
||||||
|
|
||||||
const exist = await GalleryLikes.findOneBy({
|
|
||||||
postId: post.id,
|
|
||||||
userId: user.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (exist == null) {
|
|
||||||
throw new ApiError(meta.errors.notLiked);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Delete like
|
|
||||||
await GalleryLikes.delete(exist.id);
|
|
||||||
|
|
||||||
GalleryPosts.decrement({ id: post.id }, "likedCount", 1);
|
|
||||||
});
|
|
|
@ -1,84 +0,0 @@
|
||||||
import define from "../../../define.js";
|
|
||||||
import { DriveFiles, GalleryPosts } from "@/models/index.js";
|
|
||||||
import { GalleryPost } from "@/models/entities/gallery-post.js";
|
|
||||||
import { ApiError } from "../../../error.js";
|
|
||||||
import type { DriveFile } from "@/models/entities/drive-file.js";
|
|
||||||
import { HOUR } from "@/const.js";
|
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
tags: ["gallery"],
|
|
||||||
|
|
||||||
requireCredential: true,
|
|
||||||
|
|
||||||
kind: "write:gallery",
|
|
||||||
|
|
||||||
limit: {
|
|
||||||
duration: HOUR,
|
|
||||||
max: 300,
|
|
||||||
},
|
|
||||||
|
|
||||||
res: {
|
|
||||||
type: "object",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
ref: "GalleryPost",
|
|
||||||
},
|
|
||||||
|
|
||||||
errors: {},
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const paramDef = {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
postId: { type: "string", format: "misskey:id" },
|
|
||||||
title: { type: "string", minLength: 1 },
|
|
||||||
description: { type: "string", nullable: true },
|
|
||||||
fileIds: {
|
|
||||||
type: "array",
|
|
||||||
uniqueItems: true,
|
|
||||||
minItems: 1,
|
|
||||||
maxItems: 32,
|
|
||||||
items: {
|
|
||||||
type: "string",
|
|
||||||
format: "misskey:id",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
isSensitive: { type: "boolean", default: false },
|
|
||||||
},
|
|
||||||
required: ["postId", "title", "fileIds"],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, user) => {
|
|
||||||
const files = (
|
|
||||||
await Promise.all(
|
|
||||||
ps.fileIds.map((fileId) =>
|
|
||||||
DriveFiles.findOneBy({
|
|
||||||
id: fileId,
|
|
||||||
userId: user.id,
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
).filter((file): file is DriveFile => file != null);
|
|
||||||
|
|
||||||
if (files.length === 0) {
|
|
||||||
throw new Error();
|
|
||||||
}
|
|
||||||
|
|
||||||
await GalleryPosts.update(
|
|
||||||
{
|
|
||||||
id: ps.postId,
|
|
||||||
userId: user.id,
|
|
||||||
},
|
|
||||||
{
|
|
||||||
updatedAt: new Date(),
|
|
||||||
title: ps.title,
|
|
||||||
description: ps.description,
|
|
||||||
isSensitive: ps.isSensitive,
|
|
||||||
fileIds: files.map((file) => file.id),
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const post = await GalleryPosts.findOneByOrFail({ id: ps.postId });
|
|
||||||
|
|
||||||
return await GalleryPosts.pack(post, user);
|
|
||||||
});
|
|
|
@ -1,60 +0,0 @@
|
||||||
import define from "../../../define.js";
|
|
||||||
import { GalleryLikes } from "@/models/index.js";
|
|
||||||
import { makePaginationQuery } from "../../../common/make-pagination-query.js";
|
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
tags: ["account", "gallery"],
|
|
||||||
|
|
||||||
requireCredential: true,
|
|
||||||
|
|
||||||
kind: "read:gallery-likes",
|
|
||||||
|
|
||||||
res: {
|
|
||||||
type: "array",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
items: {
|
|
||||||
type: "object",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: "string",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
format: "id",
|
|
||||||
},
|
|
||||||
post: {
|
|
||||||
type: "object",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
ref: "GalleryPost",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const paramDef = {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
limit: { type: "integer", minimum: 1, maximum: 100, default: 10 },
|
|
||||||
sinceId: { type: "string", format: "misskey:id" },
|
|
||||||
untilId: { type: "string", format: "misskey:id" },
|
|
||||||
},
|
|
||||||
required: [],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, user) => {
|
|
||||||
const query = makePaginationQuery(
|
|
||||||
GalleryLikes.createQueryBuilder("like"),
|
|
||||||
ps.sinceId,
|
|
||||||
ps.untilId,
|
|
||||||
)
|
|
||||||
.andWhere("like.userId = :meId", { meId: user.id })
|
|
||||||
.leftJoinAndSelect("like.post", "post");
|
|
||||||
|
|
||||||
const likes = await query.take(ps.limit).getMany();
|
|
||||||
|
|
||||||
return await GalleryLikes.packMany(likes, user);
|
|
||||||
});
|
|
|
@ -1,45 +0,0 @@
|
||||||
import { GalleryPosts } from "@/models/index.js";
|
|
||||||
import define from "../../../define.js";
|
|
||||||
import { makePaginationQuery } from "../../../common/make-pagination-query.js";
|
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
tags: ["account", "gallery"],
|
|
||||||
|
|
||||||
requireCredential: true,
|
|
||||||
|
|
||||||
kind: "read:gallery",
|
|
||||||
|
|
||||||
res: {
|
|
||||||
type: "array",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
items: {
|
|
||||||
type: "object",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
ref: "GalleryPost",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const paramDef = {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
limit: { type: "integer", minimum: 1, maximum: 100, default: 10 },
|
|
||||||
sinceId: { type: "string", format: "misskey:id" },
|
|
||||||
untilId: { type: "string", format: "misskey:id" },
|
|
||||||
},
|
|
||||||
required: [],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, user) => {
|
|
||||||
const query = makePaginationQuery(
|
|
||||||
GalleryPosts.createQueryBuilder("post"),
|
|
||||||
ps.sinceId,
|
|
||||||
ps.untilId,
|
|
||||||
).andWhere("post.userId = :meId", { meId: user.id });
|
|
||||||
|
|
||||||
const posts = await query.take(ps.limit).getMany();
|
|
||||||
|
|
||||||
return await GalleryPosts.packMany(posts, user);
|
|
||||||
});
|
|
|
@ -1,45 +0,0 @@
|
||||||
import define from "../../../define.js";
|
|
||||||
import { GalleryPosts } from "@/models/index.js";
|
|
||||||
import { makePaginationQuery } from "../../../common/make-pagination-query.js";
|
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
tags: ["users", "gallery"],
|
|
||||||
requireCredentialPrivateMode: true,
|
|
||||||
|
|
||||||
description: "Show all gallery posts by the given user.",
|
|
||||||
|
|
||||||
res: {
|
|
||||||
type: "array",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
items: {
|
|
||||||
type: "object",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
ref: "GalleryPost",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const paramDef = {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
userId: { type: "string", format: "misskey:id" },
|
|
||||||
limit: { type: "integer", minimum: 1, maximum: 100, default: 10 },
|
|
||||||
sinceId: { type: "string", format: "misskey:id" },
|
|
||||||
untilId: { type: "string", format: "misskey:id" },
|
|
||||||
},
|
|
||||||
required: ["userId"],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, user) => {
|
|
||||||
const query = makePaginationQuery(
|
|
||||||
GalleryPosts.createQueryBuilder("post"),
|
|
||||||
ps.sinceId,
|
|
||||||
ps.untilId,
|
|
||||||
).andWhere("post.userId = :userId", { userId: ps.userId });
|
|
||||||
|
|
||||||
const posts = await query.take(ps.limit).getMany();
|
|
||||||
|
|
||||||
return await GalleryPosts.packMany(posts, user);
|
|
||||||
});
|
|
|
@ -1,151 +0,0 @@
|
||||||
import { Users } from "@/models/index.js";
|
|
||||||
import define from "../../define.js";
|
|
||||||
|
|
||||||
export const meta = {
|
|
||||||
tags: ["users"],
|
|
||||||
|
|
||||||
requireCredential: true,
|
|
||||||
|
|
||||||
description:
|
|
||||||
"Show the different kinds of relations between the authenticated user and the specified user(s).",
|
|
||||||
|
|
||||||
res: {
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
oneOf: [
|
|
||||||
{
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: "string",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
format: "id",
|
|
||||||
},
|
|
||||||
isFollowing: {
|
|
||||||
type: "boolean",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
hasPendingFollowRequestFromYou: {
|
|
||||||
type: "boolean",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
hasPendingFollowRequestToYou: {
|
|
||||||
type: "boolean",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
isFollowed: {
|
|
||||||
type: "boolean",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
isBlocking: {
|
|
||||||
type: "boolean",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
isBlocked: {
|
|
||||||
type: "boolean",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
isMuted: {
|
|
||||||
type: "boolean",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
isRenoteMuted: {
|
|
||||||
type: "boolean",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "array",
|
|
||||||
items: {
|
|
||||||
type: "object",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
properties: {
|
|
||||||
id: {
|
|
||||||
type: "string",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
format: "id",
|
|
||||||
},
|
|
||||||
isFollowing: {
|
|
||||||
type: "boolean",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
hasPendingFollowRequestFromYou: {
|
|
||||||
type: "boolean",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
hasPendingFollowRequestToYou: {
|
|
||||||
type: "boolean",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
isFollowed: {
|
|
||||||
type: "boolean",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
isBlocking: {
|
|
||||||
type: "boolean",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
isBlocked: {
|
|
||||||
type: "boolean",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
isMuted: {
|
|
||||||
type: "boolean",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
isRenoteMuted: {
|
|
||||||
type: "boolean",
|
|
||||||
optional: false,
|
|
||||||
nullable: false,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const paramDef = {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
userId: {
|
|
||||||
anyOf: [
|
|
||||||
{ type: "string", format: "misskey:id" },
|
|
||||||
{
|
|
||||||
type: "array",
|
|
||||||
items: { type: "string", format: "misskey:id" },
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["userId"],
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export default define(meta, paramDef, async (ps, me) => {
|
|
||||||
const ids = Array.isArray(ps.userId) ? ps.userId : [ps.userId];
|
|
||||||
|
|
||||||
const relations = await Promise.all(
|
|
||||||
ids.map((id) => Users.getRelation(me.id, id)),
|
|
||||||
);
|
|
||||||
|
|
||||||
return Array.isArray(ps.userId) ? relations : relations[0];
|
|
||||||
});
|
|
Loading…
Reference in New Issue