This commit is contained in:
syuilo 2021-12-09 23:58:30 +09:00
parent 0abe2dfee0
commit c69b72e199
573 changed files with 3318 additions and 3318 deletions

View file

@ -16,22 +16,22 @@ export const meta = {
params: {
noteId: {
validator: $.type(ID),
}
},
},
errors: {
noSuchNote: {
message: 'No such note.',
code: 'NO_SUCH_NOTE',
id: '6dd26674-e060-4816-909a-45ba3f4da458'
id: '6dd26674-e060-4816-909a-45ba3f4da458',
},
alreadyFavorited: {
message: 'The note has already been marked as a favorite.',
code: 'ALREADY_FAVORITED',
id: 'a402c12b-34dd-41d2-97d8-4d2ffd96a1a6'
id: 'a402c12b-34dd-41d2-97d8-4d2ffd96a1a6',
},
}
},
};
export default define(meta, async (ps, user) => {
@ -44,7 +44,7 @@ export default define(meta, async (ps, user) => {
// if already favorited
const exist = await NoteFavorites.findOne({
noteId: note.id,
userId: user.id
userId: user.id,
});
if (exist != null) {
@ -56,6 +56,6 @@ export default define(meta, async (ps, user) => {
id: genId(),
createdAt: new Date(),
noteId: note.id,
userId: user.id
userId: user.id,
});
});

View file

@ -15,22 +15,22 @@ export const meta = {
params: {
noteId: {
validator: $.type(ID),
}
},
},
errors: {
noSuchNote: {
message: 'No such note.',
code: 'NO_SUCH_NOTE',
id: '80848a2c-398f-4343-baa9-df1d57696c56'
id: '80848a2c-398f-4343-baa9-df1d57696c56',
},
notFavorited: {
message: 'You have not marked that note a favorite.',
code: 'NOT_FAVORITED',
id: 'b625fc69-635e-45e9-86f4-dbefbef35af5'
id: 'b625fc69-635e-45e9-86f4-dbefbef35af5',
},
}
},
};
export default define(meta, async (ps, user) => {
@ -43,7 +43,7 @@ export default define(meta, async (ps, user) => {
// if already favorited
const exist = await NoteFavorites.findOne({
noteId: note.id,
userId: user.id
userId: user.id,
});
if (exist == null) {