diff --git a/src/client/pages/user/clips.vue b/src/client/pages/user/clips.vue
new file mode 100644
index 0000000000..2a66b6752d
--- /dev/null
+++ b/src/client/pages/user/clips.vue
@@ -0,0 +1,57 @@
+
+
+
+
+ {{ item.name }}
+ {{ item.description }}
+
+
+
+
+
+
+
+
diff --git a/src/client/pages/user/index.vue b/src/client/pages/user/index.vue
index 0c816a2d22..70f6662604 100644
--- a/src/client/pages/user/index.vue
+++ b/src/client/pages/user/index.vue
@@ -60,12 +60,15 @@
+
{{ $t('notes') }}
+
{{ $t('clips') }}
+
{{ $t('pages') }}
@@ -83,6 +86,8 @@
+
+
@@ -193,8 +198,8 @@
+
+
diff --git a/src/models/repositories/clip.ts b/src/models/repositories/clip.ts
index 2830546528..11f743349f 100644
--- a/src/models/repositories/clip.ts
+++ b/src/models/repositories/clip.ts
@@ -24,6 +24,12 @@ export class ClipRepository extends Repository {
isPublic: clip.isPublic,
});
}
+
+ public packMany(
+ clips: Clip[],
+ ) {
+ return Promise.all(clips.map(x => this.pack(x)));
+ }
}
export const packedClipSchema = {
diff --git a/src/server/api/endpoints/users/clips.ts b/src/server/api/endpoints/users/clips.ts
new file mode 100644
index 0000000000..72aae7252c
--- /dev/null
+++ b/src/server/api/endpoints/users/clips.ts
@@ -0,0 +1,40 @@
+import $ from 'cafy';
+import { ID } from '../../../../misc/cafy-id';
+import define from '../../define';
+import { Clips } from '../../../../models';
+import { makePaginationQuery } from '../../common/make-pagination-query';
+
+export const meta = {
+ tags: ['users', 'clips'],
+
+ params: {
+ userId: {
+ validator: $.type(ID),
+ },
+
+ limit: {
+ validator: $.optional.num.range(1, 100),
+ default: 10
+ },
+
+ sinceId: {
+ validator: $.optional.type(ID),
+ },
+
+ untilId: {
+ validator: $.optional.type(ID),
+ },
+ }
+};
+
+export default define(meta, async (ps, user) => {
+ const query = makePaginationQuery(Clips.createQueryBuilder('clip'), ps.sinceId, ps.untilId)
+ .andWhere(`clip.userId = :userId`, { userId: ps.userId })
+ .andWhere('clip.isPublic = true');
+
+ const clips = await query
+ .take(ps.limit!)
+ .getMany();
+
+ return await Clips.packMany(clips);
+});
diff --git a/src/server/api/endpoints/users/pages.ts b/src/server/api/endpoints/users/pages.ts
new file mode 100644
index 0000000000..706a2e115b
--- /dev/null
+++ b/src/server/api/endpoints/users/pages.ts
@@ -0,0 +1,40 @@
+import $ from 'cafy';
+import { ID } from '../../../../misc/cafy-id';
+import define from '../../define';
+import { Pages } from '../../../../models';
+import { makePaginationQuery } from '../../common/make-pagination-query';
+
+export const meta = {
+ tags: ['users', 'pages'],
+
+ params: {
+ userId: {
+ validator: $.type(ID),
+ },
+
+ limit: {
+ validator: $.optional.num.range(1, 100),
+ default: 10
+ },
+
+ sinceId: {
+ validator: $.optional.type(ID),
+ },
+
+ untilId: {
+ validator: $.optional.type(ID),
+ },
+ }
+};
+
+export default define(meta, async (ps, user) => {
+ const query = makePaginationQuery(Pages.createQueryBuilder('page'), ps.sinceId, ps.untilId)
+ .andWhere(`page.userId = :userId`, { userId: ps.userId })
+ .andWhere('page.visibility = \'public\'');
+
+ const pages = await query
+ .take(ps.limit!)
+ .getMany();
+
+ return await Pages.packMany(pages);
+});