fix lint
This commit is contained in:
@@ -14,7 +14,7 @@ export const meta = {
|
||||
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
|
||||
sinceId: {
|
||||
@@ -24,7 +24,7 @@ export const meta = {
|
||||
untilId: {
|
||||
validator: $.optional.type(ID),
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
|
@@ -17,11 +17,11 @@ export const meta = {
|
||||
},
|
||||
|
||||
username: {
|
||||
validator: $.optional.str
|
||||
validator: $.optional.str,
|
||||
},
|
||||
|
||||
host: {
|
||||
validator: $.optional.nullable.str
|
||||
validator: $.optional.nullable.str,
|
||||
},
|
||||
|
||||
sinceId: {
|
||||
@@ -34,7 +34,7 @@ export const meta = {
|
||||
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -45,22 +45,22 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Following',
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchUser: {
|
||||
message: 'No such user.',
|
||||
code: 'NO_SUCH_USER',
|
||||
id: '27fa5435-88ab-43de-9360-387de88727cd'
|
||||
id: '27fa5435-88ab-43de-9360-387de88727cd',
|
||||
},
|
||||
|
||||
forbidden: {
|
||||
message: 'Forbidden.',
|
||||
code: 'FORBIDDEN',
|
||||
id: '3c6a84db-d619-26af-ca14-06232a21df8a'
|
||||
id: '3c6a84db-d619-26af-ca14-06232a21df8a',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
|
@@ -17,11 +17,11 @@ export const meta = {
|
||||
},
|
||||
|
||||
username: {
|
||||
validator: $.optional.str
|
||||
validator: $.optional.str,
|
||||
},
|
||||
|
||||
host: {
|
||||
validator: $.optional.nullable.str
|
||||
validator: $.optional.nullable.str,
|
||||
},
|
||||
|
||||
sinceId: {
|
||||
@@ -34,7 +34,7 @@ export const meta = {
|
||||
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -45,22 +45,22 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Following',
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchUser: {
|
||||
message: 'No such user.',
|
||||
code: 'NO_SUCH_USER',
|
||||
id: '63e4aba4-4156-4e53-be25-c9559e42d71b'
|
||||
id: '63e4aba4-4156-4e53-be25-c9559e42d71b',
|
||||
},
|
||||
|
||||
forbidden: {
|
||||
message: 'Forbidden.',
|
||||
code: 'FORBIDDEN',
|
||||
id: 'f6cdb0df-c19f-ec5c-7dbb-0ba84a1f92ba'
|
||||
id: 'f6cdb0df-c19f-ec5c-7dbb-0ba84a1f92ba',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
|
@@ -14,7 +14,7 @@ export const meta = {
|
||||
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
|
||||
sinceId: {
|
||||
@@ -24,7 +24,7 @@ export const meta = {
|
||||
untilId: {
|
||||
validator: $.optional.type(ID),
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
|
@@ -19,7 +19,7 @@ export const meta = {
|
||||
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
},
|
||||
|
||||
@@ -30,16 +30,16 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'User',
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchUser: {
|
||||
message: 'No such user.',
|
||||
code: 'NO_SUCH_USER',
|
||||
id: 'e6965129-7b2a-40a4-bae2-cd84cd434822'
|
||||
}
|
||||
}
|
||||
id: 'e6965129-7b2a-40a4-bae2-cd84cd434822',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
@@ -53,13 +53,13 @@ export default define(meta, async (ps, me) => {
|
||||
const recentNotes = await Notes.find({
|
||||
where: {
|
||||
userId: user.id,
|
||||
replyId: Not(IsNull())
|
||||
replyId: Not(IsNull()),
|
||||
},
|
||||
order: {
|
||||
id: -1
|
||||
id: -1,
|
||||
},
|
||||
take: 1000,
|
||||
select: ['replyId']
|
||||
select: ['replyId'],
|
||||
});
|
||||
|
||||
// 投稿が少なかったら中断
|
||||
@@ -72,7 +72,7 @@ export default define(meta, async (ps, me) => {
|
||||
where: {
|
||||
id: In(recentNotes.map(p => p.replyId)),
|
||||
},
|
||||
select: ['userId']
|
||||
select: ['userId'],
|
||||
});
|
||||
|
||||
const repliedUsers: any = {};
|
||||
@@ -98,7 +98,7 @@ export default define(meta, async (ps, me) => {
|
||||
// Make replies object (includes weights)
|
||||
const repliesObj = await Promise.all(topRepliedUsers.map(async (user) => ({
|
||||
user: await Users.pack(user, me, { detail: true }),
|
||||
weight: repliedUsers[user] / peak
|
||||
weight: repliedUsers[user] / peak,
|
||||
})));
|
||||
|
||||
return repliesObj;
|
||||
|
@@ -14,8 +14,8 @@ export const meta = {
|
||||
|
||||
params: {
|
||||
name: {
|
||||
validator: $.str.range(1, 100)
|
||||
}
|
||||
validator: $.str.range(1, 100),
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@@ -38,7 +38,7 @@ export default define(meta, async (ps, user) => {
|
||||
id: genId(),
|
||||
createdAt: new Date(),
|
||||
userId: user.id,
|
||||
userGroupId: userGroup.id
|
||||
userGroupId: userGroup.id,
|
||||
} as UserGroupJoining);
|
||||
|
||||
return await UserGroups.pack(userGroup);
|
||||
|
@@ -14,22 +14,22 @@ export const meta = {
|
||||
params: {
|
||||
groupId: {
|
||||
validator: $.type(ID),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchGroup: {
|
||||
message: 'No such group.',
|
||||
code: 'NO_SUCH_GROUP',
|
||||
id: '63dbd64c-cd77-413f-8e08-61781e210b38'
|
||||
}
|
||||
}
|
||||
id: '63dbd64c-cd77-413f-8e08-61781e210b38',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
const userGroup = await UserGroups.findOne({
|
||||
id: ps.groupId,
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
if (userGroup == null) {
|
||||
|
@@ -23,9 +23,9 @@ export const meta = {
|
||||
noSuchInvitation: {
|
||||
message: 'No such invitation.',
|
||||
code: 'NO_SUCH_INVITATION',
|
||||
id: '98c11eca-c890-4f42-9806-c8c8303ebb5e'
|
||||
id: '98c11eca-c890-4f42-9806-c8c8303ebb5e',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@@ -47,7 +47,7 @@ export default define(meta, async (ps, user) => {
|
||||
id: genId(),
|
||||
createdAt: new Date(),
|
||||
userId: user.id,
|
||||
userGroupId: invitation.userGroupId
|
||||
userGroupId: invitation.userGroupId,
|
||||
} as UserGroupJoining);
|
||||
|
||||
UserGroupInvitations.delete(invitation.id);
|
||||
|
@@ -21,9 +21,9 @@ export const meta = {
|
||||
noSuchInvitation: {
|
||||
message: 'No such invitation.',
|
||||
code: 'NO_SUCH_INVITATION',
|
||||
id: 'ad7471d4-2cd9-44b4-ac68-e7136b4ce656'
|
||||
id: 'ad7471d4-2cd9-44b4-ac68-e7136b4ce656',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
|
@@ -29,27 +29,27 @@ export const meta = {
|
||||
noSuchGroup: {
|
||||
message: 'No such group.',
|
||||
code: 'NO_SUCH_GROUP',
|
||||
id: '583f8bc0-8eee-4b78-9299-1e14fc91e409'
|
||||
id: '583f8bc0-8eee-4b78-9299-1e14fc91e409',
|
||||
},
|
||||
|
||||
noSuchUser: {
|
||||
message: 'No such user.',
|
||||
code: 'NO_SUCH_USER',
|
||||
id: 'da52de61-002c-475b-90e1-ba64f9cf13a8'
|
||||
id: 'da52de61-002c-475b-90e1-ba64f9cf13a8',
|
||||
},
|
||||
|
||||
alreadyAdded: {
|
||||
message: 'That user has already been added to that group.',
|
||||
code: 'ALREADY_ADDED',
|
||||
id: '7e35c6a0-39b2-4488-aea6-6ee20bd5da2c'
|
||||
id: '7e35c6a0-39b2-4488-aea6-6ee20bd5da2c',
|
||||
},
|
||||
|
||||
alreadyInvited: {
|
||||
message: 'That user has already been invited to that group.',
|
||||
code: 'ALREADY_INVITED',
|
||||
id: 'ee0f58b4-b529-4d13-b761-b9a3e69f97e6'
|
||||
}
|
||||
}
|
||||
id: 'ee0f58b4-b529-4d13-b761-b9a3e69f97e6',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
@@ -71,7 +71,7 @@ export default define(meta, async (ps, me) => {
|
||||
|
||||
const joining = await UserGroupJoinings.findOne({
|
||||
userGroupId: userGroup.id,
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
if (joining) {
|
||||
@@ -80,7 +80,7 @@ export default define(meta, async (ps, me) => {
|
||||
|
||||
const existInvitation = await UserGroupInvitations.findOne({
|
||||
userGroupId: userGroup.id,
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
if (existInvitation) {
|
||||
@@ -91,12 +91,12 @@ export default define(meta, async (ps, me) => {
|
||||
id: genId(),
|
||||
createdAt: new Date(),
|
||||
userId: user.id,
|
||||
userGroupId: userGroup.id
|
||||
userGroupId: userGroup.id,
|
||||
} as UserGroupInvitation).then(x => UserGroupInvitations.findOneOrFail(x.identifiers[0]));
|
||||
|
||||
// 通知を作成
|
||||
createNotification(user.id, 'groupInvited', {
|
||||
notifierId: me.id,
|
||||
userGroupInvitationId: invitation.id
|
||||
userGroupInvitationId: invitation.id,
|
||||
});
|
||||
});
|
||||
|
@@ -16,7 +16,7 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'UserGroup',
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -28,8 +28,8 @@ export default define(meta, async (ps, me) => {
|
||||
const joinings = await UserGroupJoinings.find({
|
||||
userId: me.id,
|
||||
...(ownedGroups.length > 0 ? {
|
||||
userGroupId: Not(In(ownedGroups.map(x => x.id)))
|
||||
} : {})
|
||||
userGroupId: Not(In(ownedGroups.map(x => x.id))),
|
||||
} : {}),
|
||||
});
|
||||
|
||||
return await Promise.all(joinings.map(x => UserGroups.pack(x.userGroupId)));
|
||||
|
@@ -21,15 +21,15 @@ export const meta = {
|
||||
noSuchGroup: {
|
||||
message: 'No such group.',
|
||||
code: 'NO_SUCH_GROUP',
|
||||
id: '62780270-1f67-5dc0-daca-3eb510612e31'
|
||||
id: '62780270-1f67-5dc0-daca-3eb510612e31',
|
||||
},
|
||||
|
||||
youAreOwner: {
|
||||
message: 'Your are the owner.',
|
||||
code: 'YOU_ARE_OWNER',
|
||||
id: 'b6d6e0c2-ef8a-9bb8-653d-79f4a3107c69'
|
||||
id: 'b6d6e0c2-ef8a-9bb8-653d-79f4a3107c69',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
|
@@ -15,7 +15,7 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'UserGroup',
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
@@ -26,21 +26,21 @@ export const meta = {
|
||||
noSuchGroup: {
|
||||
message: 'No such group.',
|
||||
code: 'NO_SUCH_GROUP',
|
||||
id: '4662487c-05b1-4b78-86e5-fd46998aba74'
|
||||
id: '4662487c-05b1-4b78-86e5-fd46998aba74',
|
||||
},
|
||||
|
||||
noSuchUser: {
|
||||
message: 'No such user.',
|
||||
code: 'NO_SUCH_USER',
|
||||
id: '0b5cc374-3681-41da-861e-8bc1146f7a55'
|
||||
id: '0b5cc374-3681-41da-861e-8bc1146f7a55',
|
||||
},
|
||||
|
||||
isOwner: {
|
||||
message: 'The user is the owner.',
|
||||
code: 'IS_OWNER',
|
||||
id: '1546eed5-4414-4dea-81c1-b0aec4f6d2af'
|
||||
id: '1546eed5-4414-4dea-81c1-b0aec4f6d2af',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
|
@@ -27,9 +27,9 @@ export const meta = {
|
||||
noSuchGroup: {
|
||||
message: 'No such group.',
|
||||
code: 'NO_SUCH_GROUP',
|
||||
id: 'ea04751e-9b7e-487b-a509-330fb6bd6b9b'
|
||||
id: 'ea04751e-9b7e-487b-a509-330fb6bd6b9b',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
@@ -44,7 +44,7 @@ export default define(meta, async (ps, me) => {
|
||||
|
||||
const joining = await UserGroupJoinings.findOne({
|
||||
userId: me.id,
|
||||
userGroupId: userGroup.id
|
||||
userGroupId: userGroup.id,
|
||||
});
|
||||
|
||||
if (joining == null && userGroup.userId !== me.id) {
|
||||
|
@@ -32,21 +32,21 @@ export const meta = {
|
||||
noSuchGroup: {
|
||||
message: 'No such group.',
|
||||
code: 'NO_SUCH_GROUP',
|
||||
id: '8e31d36b-2f88-4ccd-a438-e2d78a9162db'
|
||||
id: '8e31d36b-2f88-4ccd-a438-e2d78a9162db',
|
||||
},
|
||||
|
||||
noSuchUser: {
|
||||
message: 'No such user.',
|
||||
code: 'NO_SUCH_USER',
|
||||
id: '711f7ebb-bbb9-4dfa-b540-b27809fed5e9'
|
||||
id: '711f7ebb-bbb9-4dfa-b540-b27809fed5e9',
|
||||
},
|
||||
|
||||
noSuchGroupMember: {
|
||||
message: 'No such group member.',
|
||||
code: 'NO_SUCH_GROUP_MEMBER',
|
||||
id: 'd31bebee-196d-42c2-9a3e-9474d4be6cc4'
|
||||
id: 'd31bebee-196d-42c2-9a3e-9474d4be6cc4',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
@@ -68,7 +68,7 @@ export default define(meta, async (ps, me) => {
|
||||
|
||||
const joining = await UserGroupJoinings.findOne({
|
||||
userGroupId: userGroup.id,
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
if (joining == null) {
|
||||
@@ -76,7 +76,7 @@ export default define(meta, async (ps, me) => {
|
||||
}
|
||||
|
||||
await UserGroups.update(userGroup.id, {
|
||||
userId: ps.userId
|
||||
userId: ps.userId,
|
||||
});
|
||||
|
||||
return await UserGroups.pack(userGroup.id);
|
||||
|
@@ -18,7 +18,7 @@ export const meta = {
|
||||
|
||||
name: {
|
||||
validator: $.str.range(1, 100),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@@ -31,16 +31,16 @@ export const meta = {
|
||||
noSuchGroup: {
|
||||
message: 'No such group.',
|
||||
code: 'NO_SUCH_GROUP',
|
||||
id: '9081cda3-7a9e-4fac-a6ce-908d70f282f6'
|
||||
id: '9081cda3-7a9e-4fac-a6ce-908d70f282f6',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
// Fetch the group
|
||||
const userGroup = await UserGroups.findOne({
|
||||
id: ps.groupId,
|
||||
userId: me.id
|
||||
userId: me.id,
|
||||
});
|
||||
|
||||
if (userGroup == null) {
|
||||
@@ -48,7 +48,7 @@ export default define(meta, async (ps, me) => {
|
||||
}
|
||||
|
||||
await UserGroups.update(userGroup.id, {
|
||||
name: ps.name
|
||||
name: ps.name,
|
||||
});
|
||||
|
||||
return await UserGroups.pack(userGroup.id);
|
||||
|
@@ -13,8 +13,8 @@ export const meta = {
|
||||
|
||||
params: {
|
||||
name: {
|
||||
validator: $.str.range(1, 100)
|
||||
}
|
||||
validator: $.str.range(1, 100),
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
|
@@ -14,22 +14,22 @@ export const meta = {
|
||||
params: {
|
||||
listId: {
|
||||
validator: $.type(ID),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchList: {
|
||||
message: 'No such list.',
|
||||
code: 'NO_SUCH_LIST',
|
||||
id: '78436795-db79-42f5-b1e2-55ea2cf19166'
|
||||
}
|
||||
}
|
||||
id: '78436795-db79-42f5-b1e2-55ea2cf19166',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
const userList = await UserLists.findOne({
|
||||
id: ps.listId,
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
if (userList == null) {
|
||||
|
@@ -15,7 +15,7 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'UserList',
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
@@ -27,15 +27,15 @@ export const meta = {
|
||||
noSuchList: {
|
||||
message: 'No such list.',
|
||||
code: 'NO_SUCH_LIST',
|
||||
id: '7f44670e-ab16-43b8-b4c1-ccd2ee89cc02'
|
||||
id: '7f44670e-ab16-43b8-b4c1-ccd2ee89cc02',
|
||||
},
|
||||
|
||||
noSuchUser: {
|
||||
message: 'No such user.',
|
||||
code: 'NO_SUCH_USER',
|
||||
id: '588e7f72-c744-4a61-b180-d354e912bda2'
|
||||
}
|
||||
}
|
||||
id: '588e7f72-c744-4a61-b180-d354e912bda2',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
|
@@ -27,27 +27,27 @@ export const meta = {
|
||||
noSuchList: {
|
||||
message: 'No such list.',
|
||||
code: 'NO_SUCH_LIST',
|
||||
id: '2214501d-ac96-4049-b717-91e42272a711'
|
||||
id: '2214501d-ac96-4049-b717-91e42272a711',
|
||||
},
|
||||
|
||||
noSuchUser: {
|
||||
message: 'No such user.',
|
||||
code: 'NO_SUCH_USER',
|
||||
id: 'a89abd3d-f0bc-4cce-beb1-2f446f4f1e6a'
|
||||
id: 'a89abd3d-f0bc-4cce-beb1-2f446f4f1e6a',
|
||||
},
|
||||
|
||||
alreadyAdded: {
|
||||
message: 'That user has already been added to that list.',
|
||||
code: 'ALREADY_ADDED',
|
||||
id: '1de7c884-1595-49e9-857e-61f12f4d4fc5'
|
||||
id: '1de7c884-1595-49e9-857e-61f12f4d4fc5',
|
||||
},
|
||||
|
||||
youHaveBeenBlocked: {
|
||||
message: 'You cannot push this user because you have been blocked by this user.',
|
||||
code: 'YOU_HAVE_BEEN_BLOCKED',
|
||||
id: '990232c5-3f9d-4d83-9f3f-ef27b6332a4b'
|
||||
id: '990232c5-3f9d-4d83-9f3f-ef27b6332a4b',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
@@ -80,7 +80,7 @@ export default define(meta, async (ps, me) => {
|
||||
|
||||
const exist = await UserListJoinings.findOne({
|
||||
userListId: userList.id,
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
if (exist) {
|
||||
|
@@ -27,9 +27,9 @@ export const meta = {
|
||||
noSuchList: {
|
||||
message: 'No such list.',
|
||||
code: 'NO_SUCH_LIST',
|
||||
id: '7bc05c21-1d7a-41ae-88f1-66820f4dc686'
|
||||
id: '7bc05c21-1d7a-41ae-88f1-66820f4dc686',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
|
@@ -18,7 +18,7 @@ export const meta = {
|
||||
|
||||
name: {
|
||||
validator: $.str.range(1, 100),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@@ -31,16 +31,16 @@ export const meta = {
|
||||
noSuchList: {
|
||||
message: 'No such list.',
|
||||
code: 'NO_SUCH_LIST',
|
||||
id: '796666fe-3dff-4d39-becb-8a5932c1d5b7'
|
||||
id: '796666fe-3dff-4d39-becb-8a5932c1d5b7',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
// Fetch the list
|
||||
const userList = await UserLists.findOne({
|
||||
id: ps.listId,
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
if (userList == null) {
|
||||
@@ -48,7 +48,7 @@ export default define(meta, async (ps, user) => {
|
||||
}
|
||||
|
||||
await UserLists.update(userList.id, {
|
||||
name: ps.name
|
||||
name: ps.name,
|
||||
});
|
||||
|
||||
return await UserLists.pack(userList.id);
|
||||
|
@@ -72,16 +72,16 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'Note',
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchUser: {
|
||||
message: 'No such user.',
|
||||
code: 'NO_SUCH_USER',
|
||||
id: '27e494ba-2ac2-48e8-893b-10d4d8c2387b'
|
||||
}
|
||||
}
|
||||
id: '27e494ba-2ac2-48e8-893b-10d4d8c2387b',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
|
@@ -14,7 +14,7 @@ export const meta = {
|
||||
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
|
||||
sinceId: {
|
||||
@@ -24,7 +24,7 @@ export const meta = {
|
||||
untilId: {
|
||||
validator: $.optional.type(ID),
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
|
@@ -45,16 +45,16 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'NoteReaction',
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
reactionsNotPublic: {
|
||||
message: 'Reactions of the user is not public.',
|
||||
code: 'REACTIONS_NOT_PUBLIC',
|
||||
id: '673a7dd2-6924-1093-e0c0-e68456ceae5c'
|
||||
id: '673a7dd2-6924-1093-e0c0-e68456ceae5c',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
|
@@ -15,13 +15,13 @@ export const meta = {
|
||||
params: {
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
|
||||
offset: {
|
||||
validator: $.optional.num.min(0),
|
||||
default: 0
|
||||
}
|
||||
default: 0,
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@@ -31,7 +31,7 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'User',
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
@@ -11,7 +11,7 @@ export const meta = {
|
||||
params: {
|
||||
userId: {
|
||||
validator: $.either($.type(ID), $.arr($.type(ID)).unique()),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@@ -23,37 +23,37 @@ export const meta = {
|
||||
id: {
|
||||
type: 'string' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
format: 'id'
|
||||
format: 'id',
|
||||
},
|
||||
isFollowing: {
|
||||
type: 'boolean' as const,
|
||||
optional: false as const, nullable: false as const
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
hasPendingFollowRequestFromYou: {
|
||||
type: 'boolean' as const,
|
||||
optional: false as const, nullable: false as const
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
hasPendingFollowRequestToYou: {
|
||||
type: 'boolean' as const,
|
||||
optional: false as const, nullable: false as const
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
isFollowed: {
|
||||
type: 'boolean' as const,
|
||||
optional: false as const, nullable: false as const
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
isBlocking: {
|
||||
type: 'boolean' as const,
|
||||
optional: false as const, nullable: false as const
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
isBlocked: {
|
||||
type: 'boolean' as const,
|
||||
optional: false as const, nullable: false as const
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
isMuted: {
|
||||
type: 'boolean' as const,
|
||||
optional: false as const, nullable: false as const
|
||||
}
|
||||
}
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
type: 'array' as const,
|
||||
@@ -65,41 +65,41 @@ export const meta = {
|
||||
id: {
|
||||
type: 'string' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
format: 'id'
|
||||
format: 'id',
|
||||
},
|
||||
isFollowing: {
|
||||
type: 'boolean' as const,
|
||||
optional: false as const, nullable: false as const
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
hasPendingFollowRequestFromYou: {
|
||||
type: 'boolean' as const,
|
||||
optional: false as const, nullable: false as const
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
hasPendingFollowRequestToYou: {
|
||||
type: 'boolean' as const,
|
||||
optional: false as const, nullable: false as const
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
isFollowed: {
|
||||
type: 'boolean' as const,
|
||||
optional: false as const, nullable: false as const
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
isBlocking: {
|
||||
type: 'boolean' as const,
|
||||
optional: false as const, nullable: false as const
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
isBlocked: {
|
||||
type: 'boolean' as const,
|
||||
optional: false as const, nullable: false as const
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
isMuted: {
|
||||
type: 'boolean' as const,
|
||||
optional: false as const, nullable: false as const
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
optional: false as const, nullable: false as const,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
|
@@ -37,7 +37,7 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'User',
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
@@ -42,7 +42,7 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'User',
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
@@ -23,12 +23,12 @@ export const meta = {
|
||||
},
|
||||
|
||||
username: {
|
||||
validator: $.optional.str
|
||||
validator: $.optional.str,
|
||||
},
|
||||
|
||||
host: {
|
||||
validator: $.optional.nullable.str
|
||||
}
|
||||
validator: $.optional.nullable.str,
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@@ -42,15 +42,15 @@ export const meta = {
|
||||
message: 'Failed to resolve remote user.',
|
||||
code: 'FAILED_TO_RESOLVE_REMOTE_USER',
|
||||
id: 'ef7b9be4-9cba-4e6f-ab41-90ed171c7d3c',
|
||||
kind: 'server' as const
|
||||
kind: 'server' as const,
|
||||
},
|
||||
|
||||
noSuchUser: {
|
||||
message: 'No such user.',
|
||||
code: 'NO_SUCH_USER',
|
||||
id: '4362f8dc-731f-4ad8-a694-be5a88922a24'
|
||||
id: '4362f8dc-731f-4ad8-a694-be5a88922a24',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
@@ -64,10 +64,10 @@ export default define(meta, async (ps, me) => {
|
||||
}
|
||||
|
||||
const users = await Users.find(isAdminOrModerator ? {
|
||||
id: In(ps.userIds)
|
||||
id: In(ps.userIds),
|
||||
} : {
|
||||
id: In(ps.userIds),
|
||||
isSuspended: false
|
||||
isSuspended: false,
|
||||
});
|
||||
|
||||
// リクエストされた通りに並べ替え
|
||||
@@ -77,7 +77,7 @@ export default define(meta, async (ps, me) => {
|
||||
}
|
||||
|
||||
return await Promise.all(_users.map(u => Users.pack(u, me, {
|
||||
detail: true
|
||||
detail: true,
|
||||
})));
|
||||
} else {
|
||||
// Lookup user
|
||||
@@ -99,7 +99,7 @@ export default define(meta, async (ps, me) => {
|
||||
}
|
||||
|
||||
return await Users.pack(user, me, {
|
||||
detail: true
|
||||
detail: true,
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@@ -19,9 +19,9 @@ export const meta = {
|
||||
noSuchUser: {
|
||||
message: 'No such user.',
|
||||
code: 'NO_SUCH_USER',
|
||||
id: '9e638e45-3b25-4ef7-8f95-07e8498f1819'
|
||||
id: '9e638e45-3b25-4ef7-8f95-07e8498f1819',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, me) => {
|
||||
|
Reference in New Issue
Block a user