-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from AiriAPI/staging
Added bunch of action endpoints
- Loading branch information
Showing
130 changed files
with
2,533 additions
and
3 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const createError = require('http-errors') | ||
const requestIp = require('request-ip') | ||
const moment = require('moment') | ||
const Angry = require('../../models/schemas/Angry') | ||
|
||
// Get random Anime Angry | ||
module.exports = async function getRandomAngry(req, res, next) { | ||
try { | ||
const [result] = await Angry.aggregate([ | ||
// Select a random document from the results | ||
{ $sample: { size: 1 } }, | ||
{ $project: { __v: 0, _id: 0 } }, | ||
]) | ||
|
||
if (!result) { | ||
return next(createError(404, 'Could not find any Angry Gif')) | ||
} | ||
|
||
res.status(200).json(result) | ||
console.log( | ||
`${req.method} | ${moment(Date.now()).format()} ${requestIp.getClientIp( | ||
req | ||
)} to ${req.path} - ${JSON.stringify(req.query)}` | ||
) | ||
} catch (error) { | ||
return next(error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const createError = require('http-errors') | ||
const requestIp = require('request-ip') | ||
const moment = require('moment') | ||
const Bite = require('../../models/schemas/Bite') | ||
|
||
// Get random Anime Bite | ||
module.exports = async function getRandomBite(req, res, next) { | ||
try { | ||
const [result] = await Bite.aggregate([ | ||
// Select a random document from the results | ||
{ $sample: { size: 1 } }, | ||
{ $project: { __v: 0, _id: 0 } }, | ||
]) | ||
|
||
if (!result) { | ||
return next(createError(404, 'Could not find any Bite Gif')) | ||
} | ||
|
||
res.status(200).json(result) | ||
console.log( | ||
`${req.method} | ${moment(Date.now()).format()} ${requestIp.getClientIp( | ||
req | ||
)} to ${req.path} - ${JSON.stringify(req.query)}` | ||
) | ||
} catch (error) { | ||
return next(error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const createError = require('http-errors') | ||
const requestIp = require('request-ip') | ||
const moment = require('moment') | ||
const Blush = require('../../models/schemas/Blush') | ||
|
||
// Get random Anime Blush | ||
module.exports = async function getRandomBlush(req, res, next) { | ||
try { | ||
const [result] = await Blush.aggregate([ | ||
// Select a random document from the results | ||
{ $sample: { size: 1 } }, | ||
{ $project: { __v: 0, _id: 0 } }, | ||
]) | ||
|
||
if (!result) { | ||
return next(createError(404, 'Could not find any Blush Gif')) | ||
} | ||
|
||
res.status(200).json(result) | ||
console.log( | ||
`${req.method} | ${moment(Date.now()).format()} ${requestIp.getClientIp( | ||
req | ||
)} to ${req.path} - ${JSON.stringify(req.query)}` | ||
) | ||
} catch (error) { | ||
return next(error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const createError = require('http-errors') | ||
const requestIp = require('request-ip') | ||
const moment = require('moment') | ||
const Bonk = require('../../models/schemas/Bonk') | ||
|
||
// Get random Anime Bonk | ||
module.exports = async function getRandomBonk(req, res, next) { | ||
try { | ||
const [result] = await Bonk.aggregate([ | ||
// Select a random document from the results | ||
{ $sample: { size: 1 } }, | ||
{ $project: { __v: 0, _id: 0 } }, | ||
]) | ||
|
||
if (!result) { | ||
return next(createError(404, 'Could not find any Bonk Gif')) | ||
} | ||
|
||
res.status(200).json(result) | ||
console.log( | ||
`${req.method} | ${moment(Date.now()).format()} ${requestIp.getClientIp( | ||
req | ||
)} to ${req.path} - ${JSON.stringify(req.query)}` | ||
) | ||
} catch (error) { | ||
return next(error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const createError = require('http-errors') | ||
const requestIp = require('request-ip') | ||
const moment = require('moment') | ||
const Bored = require('../../models/schemas/Bored') | ||
|
||
// Get random Anime Bored | ||
module.exports = async function getRandomBored(req, res, next) { | ||
try { | ||
const [result] = await Bored.aggregate([ | ||
// Select a random document from the results | ||
{ $sample: { size: 1 } }, | ||
{ $project: { __v: 0, _id: 0 } }, | ||
]) | ||
|
||
if (!result) { | ||
return next(createError(404, 'Could not find any Bored Gif')) | ||
} | ||
|
||
res.status(200).json(result) | ||
console.log( | ||
`${req.method} | ${moment(Date.now()).format()} ${requestIp.getClientIp( | ||
req | ||
)} to ${req.path} - ${JSON.stringify(req.query)}` | ||
) | ||
} catch (error) { | ||
return next(error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const createError = require('http-errors') | ||
const requestIp = require('request-ip') | ||
const moment = require('moment') | ||
const Bully = require('../../models/schemas/Bully') | ||
|
||
// Get random Anime Bully | ||
module.exports = async function getRandomBully(req, res, next) { | ||
try { | ||
const [result] = await Bully.aggregate([ | ||
// Select a random document from the results | ||
{ $sample: { size: 1 } }, | ||
{ $project: { __v: 0, _id: 0 } }, | ||
]) | ||
|
||
if (!result) { | ||
return next(createError(404, 'Could not find any Bully Gif')) | ||
} | ||
|
||
res.status(200).json(result) | ||
console.log( | ||
`${req.method} | ${moment(Date.now()).format()} ${requestIp.getClientIp( | ||
req | ||
)} to ${req.path} - ${JSON.stringify(req.query)}` | ||
) | ||
} catch (error) { | ||
return next(error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const createError = require('http-errors') | ||
const requestIp = require('request-ip') | ||
const moment = require('moment') | ||
const Bye = require('../../models/schemas/Bye') | ||
|
||
// Get random Anime Bye | ||
module.exports = async function getRandomBye(req, res, next) { | ||
try { | ||
const [result] = await Bye.aggregate([ | ||
// Select a random document from the results | ||
{ $sample: { size: 1 } }, | ||
{ $project: { __v: 0, _id: 0 } }, | ||
]) | ||
|
||
if (!result) { | ||
return next(createError(404, 'Could not find any Bye Gif')) | ||
} | ||
|
||
res.status(200).json(result) | ||
console.log( | ||
`${req.method} | ${moment(Date.now()).format()} ${requestIp.getClientIp( | ||
req | ||
)} to ${req.path} - ${JSON.stringify(req.query)}` | ||
) | ||
} catch (error) { | ||
return next(error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const createError = require('http-errors') | ||
const requestIp = require('request-ip') | ||
const moment = require('moment') | ||
const Chase = require('../../models/schemas/Chase') | ||
|
||
// Get random Anime Chase | ||
module.exports = async function getRandomChase(req, res, next) { | ||
try { | ||
const [result] = await Chase.aggregate([ | ||
// Select a random document from the results | ||
{ $sample: { size: 1 } }, | ||
{ $project: { __v: 0, _id: 0 } }, | ||
]) | ||
|
||
if (!result) { | ||
return next(createError(404, 'Could not find any Chase Gif')) | ||
} | ||
|
||
res.status(200).json(result) | ||
console.log( | ||
`${req.method} | ${moment(Date.now()).format()} ${requestIp.getClientIp( | ||
req | ||
)} to ${req.path} - ${JSON.stringify(req.query)}` | ||
) | ||
} catch (error) { | ||
return next(error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const createError = require('http-errors') | ||
const requestIp = require('request-ip') | ||
const moment = require('moment') | ||
const Cheer = require('../../models/schemas/Cheer') | ||
|
||
// Get random Anime Cheer | ||
module.exports = async function getRandomCheer(req, res, next) { | ||
try { | ||
const [result] = await Cheer.aggregate([ | ||
// Select a random document from the results | ||
{ $sample: { size: 1 } }, | ||
{ $project: { __v: 0, _id: 0 } }, | ||
]) | ||
|
||
if (!result) { | ||
return next(createError(404, 'Could not find any Cheer Gif')) | ||
} | ||
|
||
res.status(200).json(result) | ||
console.log( | ||
`${req.method} | ${moment(Date.now()).format()} ${requestIp.getClientIp( | ||
req | ||
)} to ${req.path} - ${JSON.stringify(req.query)}` | ||
) | ||
} catch (error) { | ||
return next(error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const createError = require('http-errors') | ||
const requestIp = require('request-ip') | ||
const moment = require('moment') | ||
const Cringe = require('../../models/schemas/Cringe') | ||
|
||
// Get random Anime Cringe | ||
module.exports = async function getRandomCringe(req, res, next) { | ||
try { | ||
const [result] = await Cringe.aggregate([ | ||
// Select a random document from the results | ||
{ $sample: { size: 1 } }, | ||
{ $project: { __v: 0, _id: 0 } }, | ||
]) | ||
|
||
if (!result) { | ||
return next(createError(404, 'Could not find any Cringe Gif')) | ||
} | ||
|
||
res.status(200).json(result) | ||
console.log( | ||
`${req.method} | ${moment(Date.now()).format()} ${requestIp.getClientIp( | ||
req | ||
)} to ${req.path} - ${JSON.stringify(req.query)}` | ||
) | ||
} catch (error) { | ||
return next(error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const createError = require('http-errors') | ||
const requestIp = require('request-ip') | ||
const moment = require('moment') | ||
const Cry = require('../../models/schemas/Cry') | ||
|
||
// Get random Anime Cry | ||
module.exports = async function getRandomCry(req, res, next) { | ||
try { | ||
const [result] = await Cry.aggregate([ | ||
// Select a random document from the results | ||
{ $sample: { size: 1 } }, | ||
{ $project: { __v: 0, _id: 0 } }, | ||
]) | ||
|
||
if (!result) { | ||
return next(createError(404, 'Could not find any Cry Gif')) | ||
} | ||
|
||
res.status(200).json(result) | ||
console.log( | ||
`${req.method} | ${moment(Date.now()).format()} ${requestIp.getClientIp( | ||
req | ||
)} to ${req.path} - ${JSON.stringify(req.query)}` | ||
) | ||
} catch (error) { | ||
return next(error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const createError = require('http-errors') | ||
const requestIp = require('request-ip') | ||
const moment = require('moment') | ||
const Cuddle = require('../../models/schemas/Cuddle') | ||
|
||
// Get random Anime Cuddle | ||
module.exports = async function getRandomCuddle(req, res, next) { | ||
try { | ||
const [result] = await Cuddle.aggregate([ | ||
// Select a random document from the results | ||
{ $sample: { size: 1 } }, | ||
{ $project: { __v: 0, _id: 0 } }, | ||
]) | ||
|
||
if (!result) { | ||
return next(createError(404, 'Could not find any Cuddle Gif')) | ||
} | ||
|
||
res.status(200).json(result) | ||
console.log( | ||
`${req.method} | ${moment(Date.now()).format()} ${requestIp.getClientIp( | ||
req | ||
)} to ${req.path} - ${JSON.stringify(req.query)}` | ||
) | ||
} catch (error) { | ||
return next(error) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const createError = require('http-errors') | ||
const requestIp = require('request-ip') | ||
const moment = require('moment') | ||
const Dab = require('../../models/schemas/Dab') | ||
|
||
// Get random Anime Dab | ||
module.exports = async function getRandomDab(req, res, next) { | ||
try { | ||
const [result] = await Dab.aggregate([ | ||
// Select a random document from the results | ||
{ $sample: { size: 1 } }, | ||
{ $project: { __v: 0, _id: 0 } }, | ||
]) | ||
|
||
if (!result) { | ||
return next(createError(404, 'Could not find any Dab Gif')) | ||
} | ||
|
||
res.status(200).json(result) | ||
console.log( | ||
`${req.method} | ${moment(Date.now()).format()} ${requestIp.getClientIp( | ||
req | ||
)} to ${req.path} - ${JSON.stringify(req.query)}` | ||
) | ||
} catch (error) { | ||
return next(error) | ||
} | ||
} |
Oops, something went wrong.