This commit is contained in:
syuilo
2018-07-06 02:58:29 +09:00
parent fcfd9239c1
commit 9b41023c43
109 changed files with 212 additions and 130 deletions

View File

@@ -5,7 +5,7 @@ import { ILocalUser } from '../../../../models/user';
/**
* Show conversation of a note
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
if (noteIdErr) return rej('invalid noteId param');

View File

@@ -7,6 +7,8 @@ import { IApp } from '../../../../models/app';
import getParams from '../../get-params';
export const meta = {
name: 'notes/create',
desc: {
ja: '投稿します。'
},
@@ -57,7 +59,8 @@ export const meta = {
}).optional.nullable.strict().note({
desc: {
ja: '位置情報'
}
},
ref: 'geo'
}),
mediaIds: $.arr($.type(ID)).optional.unique().range(1, 4).note({
@@ -80,7 +83,8 @@ export const meta = {
}).optional.strict().note({
desc: {
ja: 'アンケート'
}
},
ref: 'poll'
})
},
@@ -100,7 +104,7 @@ export const meta = {
/**
* Create a note
*/
module.exports = (params: any, user: ILocalUser, app: IApp) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser, app: IApp) => new Promise(async (res, rej) => {
const [ps, psErr] = getParams(meta, params);
if (psErr) return rej(psErr);

View File

@@ -6,7 +6,7 @@ import { ILocalUser } from '../../../../models/user';
/**
* Delete a note
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
if (noteIdErr) return rej('invalid noteId param');

View File

@@ -6,7 +6,7 @@ import { ILocalUser } from '../../../../../models/user';
/**
* Favorite a note
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
if (noteIdErr) return rej('invalid noteId param');

View File

@@ -6,7 +6,7 @@ import { ILocalUser } from '../../../../../models/user';
/**
* Unfavorite a note
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
if (noteIdErr) return rej('invalid noteId param');

View File

@@ -7,7 +7,7 @@ import { ILocalUser } from '../../../../models/user';
/**
* Get timeline of global
*/
module.exports = async (params: any, user: ILocalUser) => {
export default async (params: any, user: ILocalUser) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
if (limitErr) throw 'invalid limit param';

View File

@@ -7,7 +7,7 @@ import { ILocalUser } from '../../../../models/user';
/**
* Get timeline of local
*/
module.exports = async (params: any, user: ILocalUser) => {
export default async (params: any, user: ILocalUser) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
if (limitErr) throw 'invalid limit param';

View File

@@ -7,7 +7,7 @@ import { ILocalUser } from '../../../../models/user';
/**
* Get mentions of myself
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'following' parameter
const [following = false, followingError] =
$.bool.optional.get(params.following);

View File

@@ -6,7 +6,7 @@ import { ILocalUser } from '../../../../../models/user';
/**
* Get recommended polls
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
if (limitErr) return rej('invalid limit param');

View File

@@ -10,7 +10,7 @@ import { ILocalUser } from '../../../../../models/user';
/**
* Vote poll of a note
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
if (noteIdErr) return rej('invalid noteId param');

View File

@@ -6,7 +6,7 @@ import { ILocalUser } from '../../../../models/user';
/**
* Show reactions of a note
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
if (noteIdErr) return rej('invalid noteId param');

View File

@@ -7,7 +7,7 @@ import { ILocalUser } from '../../../../../models/user';
/**
* React to a note
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
if (noteIdErr) return rej('invalid noteId param');

View File

@@ -6,7 +6,7 @@ import { ILocalUser } from '../../../../../models/user';
/**
* Unreact to a note
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
if (noteIdErr) return rej('invalid noteId param');

View File

@@ -5,7 +5,7 @@ import { ILocalUser } from '../../../../models/user';
/**
* Get replies of a note
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
if (noteIdErr) return rej('invalid noteId param');

View File

@@ -5,7 +5,7 @@ import { ILocalUser } from '../../../../models/user';
/**
* Show a renotes of a note
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
if (noteIdErr) return rej('invalid noteId param');

View File

@@ -5,7 +5,7 @@ import { ILocalUser } from '../../../../models/user';
import { pack } from '../../../../models/note';
import es from '../../../../db/elasticsearch';
module.exports = (params: any, me: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, me: ILocalUser) => new Promise(async (res, rej) => {
// Get 'query' parameter
const [query, queryError] = $.str.get(params.query);
if (queryError) return rej('invalid query param');

View File

@@ -8,7 +8,7 @@ import { pack } from '../../../../models/note';
/**
* Search notes by tag
*/
module.exports = (params: any, me: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, me: ILocalUser) => new Promise(async (res, rej) => {
// Get 'tag' parameter
const [tag, tagError] = $.str.get(params.tag);
if (tagError) return rej('invalid tag param');

View File

@@ -5,7 +5,7 @@ import { ILocalUser } from '../../../../models/user';
/**
* Show a note
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'noteId' parameter
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
if (noteIdErr) return rej('invalid noteId param');

View File

@@ -8,7 +8,7 @@ import { ILocalUser } from '../../../../models/user';
/**
* Get timeline of myself
*/
module.exports = async (params: any, user: ILocalUser) => {
export default async (params: any, user: ILocalUser) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
if (limitErr) throw 'invalid limit param';

View File

@@ -6,7 +6,7 @@ import { ILocalUser } from '../../../../models/user';
/**
* Get trend notes
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
if (limitErr) return rej('invalid limit param');

View File

@@ -8,7 +8,7 @@ import { ILocalUser } from '../../../../models/user';
/**
* Get timeline of a user list
*/
module.exports = async (params: any, user: ILocalUser) => {
export default async (params: any, user: ILocalUser) => {
// Get 'limit' parameter
const [limit = 10, limitErr] = $.num.optional.range(1, 100).get(params.limit);
if (limitErr) throw 'invalid limit param';