wip
This commit is contained in:
@@ -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');
|
||||
|
@@ -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);
|
||||
|
||||
|
@@ -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');
|
||||
|
@@ -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');
|
||||
|
@@ -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');
|
||||
|
@@ -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';
|
||||
|
@@ -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';
|
||||
|
@@ -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);
|
||||
|
@@ -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');
|
||||
|
@@ -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');
|
||||
|
@@ -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');
|
||||
|
@@ -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');
|
||||
|
@@ -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');
|
||||
|
@@ -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');
|
||||
|
@@ -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');
|
||||
|
@@ -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');
|
||||
|
@@ -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');
|
||||
|
@@ -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');
|
||||
|
@@ -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';
|
||||
|
@@ -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');
|
||||
|
@@ -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';
|
||||
|
Reference in New Issue
Block a user