Refactor
This commit is contained in:
parent
e8d2959717
commit
be3298639d
27 changed files with 98 additions and 173 deletions
|
@ -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.');
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue