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';
/**
* Get drive files
*/
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';
/**
* Create a file
*/
module.exports = async (file: any, params: any, user: ILocalUser): Promise<any> => {
export default async (file: any, params: any, user: ILocalUser): Promise<any> => {
if (file == null) {
throw 'file is required';
}

View File

@@ -7,7 +7,7 @@ import { ILocalUser } from '../../../../../models/user';
/**
* Delete a file
*/
module.exports = async (params: any, user: ILocalUser) => {
export default async (params: any, user: ILocalUser) => {
// Get 'fileId' parameter
const [fileId, fileIdErr] = $.type(ID).get(params.fileId);
if (fileIdErr) throw 'invalid fileId param';

View File

@@ -5,7 +5,7 @@ import { ILocalUser } from '../../../../../models/user';
/**
* Find a file(s)
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'name' parameter
const [name, nameErr] = $.str.get(params.name);
if (nameErr) return rej('invalid name param');

View File

@@ -5,7 +5,7 @@ import { ILocalUser } from '../../../../../models/user';
/**
* Show a file
*/
module.exports = async (params: any, user: ILocalUser) => {
export default async (params: any, user: ILocalUser) => {
// Get 'fileId' parameter
const [fileId, fileIdErr] = $.type(ID).get(params.fileId);
if (fileIdErr) throw 'invalid fileId param';

View File

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

View File

@@ -9,7 +9,7 @@ import { ILocalUser } from '../../../../../models/user';
/**
* Create a file from a URL
*/
module.exports = async (params: any, user: ILocalUser): Promise<any> => {
export default async (params: any, user: ILocalUser): Promise<any> => {
// Get 'url' parameter
// TODO: Validate this url
const [url, urlErr] = $.str.get(params.url);

View File

@@ -5,7 +5,7 @@ import { ILocalUser } from '../../../../models/user';
/**
* Get drive folders
*/
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

@@ -6,7 +6,7 @@ import { ILocalUser } from '../../../../../models/user';
/**
* Create drive folder
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'name' parameter
const [name = '無題のフォルダー', nameErr] = $.str.optional.pipe(isValidFolderName).get(params.name);
if (nameErr) return rej('invalid name param');

View File

@@ -5,7 +5,7 @@ import { ILocalUser } from '../../../../../models/user';
/**
* Find a folder(s)
*/
module.exports = (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
export default (params: any, user: ILocalUser) => new Promise(async (res, rej) => {
// Get 'name' parameter
const [name, nameErr] = $.str.get(params.name);
if (nameErr) return rej('invalid name param');

View File

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

View File

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

View File

@@ -5,7 +5,7 @@ import { ILocalUser } from '../../../../models/user';
/**
* Get drive stream
*/
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');