This commit is contained in:
syuilo 2019-02-22 14:02:56 +09:00
parent e8d2959717
commit be3298639d
No known key found for this signature in database
GPG key ID: BDC4C49D06AB9D69
27 changed files with 98 additions and 173 deletions

View file

@ -4,9 +4,9 @@ import User, { isRemoteUser, isLocalUser } from '../../../models/user';
import { IdentifiableError } from '../../../misc/identifiable-error';
/**
* Get valied note for API processing
* Get note for API processing
*/
export async function getValiedNote(noteId: mongo.ObjectID) {
export async function getNote(noteId: mongo.ObjectID) {
const note = await Note.findOne({
_id: noteId,
deletedAt: { $exists: false }
@ -24,10 +24,17 @@ export async function getValiedNote(noteId: mongo.ObjectID) {
*/
export async function getUser(userId: mongo.ObjectID) {
const user = await User.findOne({
_id: userId
_id: userId,
isDeleted: false
}, {
fields: {
data: false,
profile: false,
clientSettings: false
}
});
if (user == null) {
if (user === null) {
throw new IdentifiableError('15348ddd-432d-49c2-8a5a-8069753becff', 'No such user.');
}