fix lint
This commit is contained in:
@@ -14,13 +14,13 @@ export const meta = {
|
||||
params: {
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
|
||||
group: {
|
||||
validator: $.optional.bool,
|
||||
default: false
|
||||
}
|
||||
default: false,
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@@ -30,7 +30,7 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'MessagingMessage',
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
|
@@ -26,7 +26,7 @@ export const meta = {
|
||||
|
||||
limit: {
|
||||
validator: $.optional.num.range(1, 100),
|
||||
default: 10
|
||||
default: 10,
|
||||
},
|
||||
|
||||
sinceId: {
|
||||
@@ -39,8 +39,8 @@ export const meta = {
|
||||
|
||||
markAsRead: {
|
||||
validator: $.optional.bool,
|
||||
default: true
|
||||
}
|
||||
default: true,
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@@ -50,28 +50,28 @@ export const meta = {
|
||||
type: 'object' as const,
|
||||
optional: false as const, nullable: false as const,
|
||||
ref: 'MessagingMessage',
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchUser: {
|
||||
message: 'No such user.',
|
||||
code: 'NO_SUCH_USER',
|
||||
id: '11795c64-40ea-4198-b06e-3c873ed9039d'
|
||||
id: '11795c64-40ea-4198-b06e-3c873ed9039d',
|
||||
},
|
||||
|
||||
noSuchGroup: {
|
||||
message: 'No such group.',
|
||||
code: 'NO_SUCH_GROUP',
|
||||
id: 'c4d9f88c-9270-4632-b032-6ed8cee36f7f'
|
||||
id: 'c4d9f88c-9270-4632-b032-6ed8cee36f7f',
|
||||
},
|
||||
|
||||
groupAccessDenied: {
|
||||
message: 'You can not read messages of groups that you have not joined.',
|
||||
code: 'GROUP_ACCESS_DENIED',
|
||||
id: 'a053a8dd-a491-4718-8f87-50775aad9284'
|
||||
id: 'a053a8dd-a491-4718-8f87-50775aad9284',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@@ -109,7 +109,7 @@ export default define(meta, async (ps, user) => {
|
||||
}
|
||||
|
||||
return await Promise.all(messages.map(message => MessagingMessages.pack(message, user, {
|
||||
populateRecipient: false
|
||||
populateRecipient: false,
|
||||
})));
|
||||
} else if (ps.groupId != null) {
|
||||
// Fetch recipient (group)
|
||||
@@ -122,7 +122,7 @@ export default define(meta, async (ps, user) => {
|
||||
// check joined
|
||||
const joining = await UserGroupJoinings.findOne({
|
||||
userId: user.id,
|
||||
userGroupId: recipientGroup.id
|
||||
userGroupId: recipientGroup.id,
|
||||
});
|
||||
|
||||
if (joining == null) {
|
||||
@@ -140,7 +140,7 @@ export default define(meta, async (ps, user) => {
|
||||
}
|
||||
|
||||
return await Promise.all(messages.map(message => MessagingMessages.pack(message, user, {
|
||||
populateGroup: false
|
||||
populateGroup: false,
|
||||
})));
|
||||
} else {
|
||||
throw new Error();
|
||||
|
@@ -25,12 +25,12 @@ export const meta = {
|
||||
},
|
||||
|
||||
text: {
|
||||
validator: $.optional.str.pipe(MessagingMessages.validateText)
|
||||
validator: $.optional.str.pipe(MessagingMessages.validateText),
|
||||
},
|
||||
|
||||
fileId: {
|
||||
validator: $.optional.type(ID),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
res: {
|
||||
@@ -43,45 +43,45 @@ export const meta = {
|
||||
recipientIsYourself: {
|
||||
message: 'You can not send a message to yourself.',
|
||||
code: 'RECIPIENT_IS_YOURSELF',
|
||||
id: '17e2ba79-e22a-4cbc-bf91-d327643f4a7e'
|
||||
id: '17e2ba79-e22a-4cbc-bf91-d327643f4a7e',
|
||||
},
|
||||
|
||||
noSuchUser: {
|
||||
message: 'No such user.',
|
||||
code: 'NO_SUCH_USER',
|
||||
id: '11795c64-40ea-4198-b06e-3c873ed9039d'
|
||||
id: '11795c64-40ea-4198-b06e-3c873ed9039d',
|
||||
},
|
||||
|
||||
noSuchGroup: {
|
||||
message: 'No such group.',
|
||||
code: 'NO_SUCH_GROUP',
|
||||
id: 'c94e2a5d-06aa-4914-8fa6-6a42e73d6537'
|
||||
id: 'c94e2a5d-06aa-4914-8fa6-6a42e73d6537',
|
||||
},
|
||||
|
||||
groupAccessDenied: {
|
||||
message: 'You can not send messages to groups that you have not joined.',
|
||||
code: 'GROUP_ACCESS_DENIED',
|
||||
id: 'd96b3cca-5ad1-438b-ad8b-02f931308fbd'
|
||||
id: 'd96b3cca-5ad1-438b-ad8b-02f931308fbd',
|
||||
},
|
||||
|
||||
noSuchFile: {
|
||||
message: 'No such file.',
|
||||
code: 'NO_SUCH_FILE',
|
||||
id: '4372b8e2-185d-4146-8749-2f68864a3e5f'
|
||||
id: '4372b8e2-185d-4146-8749-2f68864a3e5f',
|
||||
},
|
||||
|
||||
contentRequired: {
|
||||
message: 'Content required. You need to set text or fileId.',
|
||||
code: 'CONTENT_REQUIRED',
|
||||
id: '25587321-b0e6-449c-9239-f8925092942c'
|
||||
id: '25587321-b0e6-449c-9239-f8925092942c',
|
||||
},
|
||||
|
||||
youHaveBeenBlocked: {
|
||||
message: 'You cannot send a message because you have been blocked by this user.',
|
||||
code: 'YOU_HAVE_BEEN_BLOCKED',
|
||||
id: 'c15a5199-7422-4968-941a-2a462c478f7d'
|
||||
id: 'c15a5199-7422-4968-941a-2a462c478f7d',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
@@ -119,7 +119,7 @@ export default define(meta, async (ps, user) => {
|
||||
// check joined
|
||||
const joining = await UserGroupJoinings.findOne({
|
||||
userId: user.id,
|
||||
userGroupId: recipientGroup.id
|
||||
userGroupId: recipientGroup.id,
|
||||
});
|
||||
|
||||
if (joining == null) {
|
||||
@@ -131,7 +131,7 @@ export default define(meta, async (ps, user) => {
|
||||
if (ps.fileId != null) {
|
||||
file = await DriveFiles.findOne({
|
||||
id: ps.fileId,
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
if (file == null) {
|
||||
|
@@ -16,28 +16,28 @@ export const meta = {
|
||||
limit: {
|
||||
duration: ms('1hour'),
|
||||
max: 300,
|
||||
minInterval: ms('1sec')
|
||||
minInterval: ms('1sec'),
|
||||
},
|
||||
|
||||
params: {
|
||||
messageId: {
|
||||
validator: $.type(ID),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchMessage: {
|
||||
message: 'No such message.',
|
||||
code: 'NO_SUCH_MESSAGE',
|
||||
id: '54b5b326-7925-42cf-8019-130fda8b56af'
|
||||
id: '54b5b326-7925-42cf-8019-130fda8b56af',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
const message = await MessagingMessages.findOne({
|
||||
id: ps.messageId,
|
||||
userId: user.id
|
||||
userId: user.id,
|
||||
});
|
||||
|
||||
if (message == null) {
|
||||
|
@@ -15,16 +15,16 @@ export const meta = {
|
||||
params: {
|
||||
messageId: {
|
||||
validator: $.type(ID),
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchMessage: {
|
||||
message: 'No such message.',
|
||||
code: 'NO_SUCH_MESSAGE',
|
||||
id: '86d56a2f-a9c3-4afb-b13c-3e9bfef9aa14'
|
||||
id: '86d56a2f-a9c3-4afb-b13c-3e9bfef9aa14',
|
||||
},
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default define(meta, async (ps, user) => {
|
||||
|
Reference in New Issue
Block a user