2016-08-01 20:36:10 +00:00
|
|
|
import { authWithHeaders } from '../../middlewares/auth';
|
2019-10-08 14:57:10 +00:00
|
|
|
import common from '../../../common';
|
2019-10-03 15:24:17 +00:00
|
|
|
|
2019-10-08 14:57:10 +00:00
|
|
|
const { shops } = common;
|
2016-07-26 19:36:55 +00:00
|
|
|
|
2019-10-08 14:57:10 +00:00
|
|
|
const api = {};
|
2016-07-26 19:36:55 +00:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @apiIgnore
|
|
|
|
|
* @api {get} /api/v3/shops/market get the available items for the market
|
|
|
|
|
* @apiName GetMarketItems
|
|
|
|
|
* @apiGroup Shops
|
|
|
|
|
*
|
2016-11-24 01:34:09 +00:00
|
|
|
* @apiSuccess {Object} data List of available items
|
2016-07-26 19:36:55 +00:00
|
|
|
* @apiSuccess {string} message Success message
|
|
|
|
|
*/
|
|
|
|
|
api.getMarketItems = {
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '/shops/market',
|
2018-09-21 13:12:20 +00:00
|
|
|
middlewares: [authWithHeaders()],
|
2016-07-26 19:36:55 +00:00
|
|
|
async handler (req, res) {
|
2019-10-08 14:57:10 +00:00
|
|
|
const { user } = res.locals;
|
2016-07-26 19:36:55 +00:00
|
|
|
|
2019-10-08 14:57:10 +00:00
|
|
|
const resObject = shops.getMarketShop(user, req.language);
|
2016-07-26 19:36:55 +00:00
|
|
|
|
|
|
|
|
res.respond(200, resObject);
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2017-08-24 05:16:18 +00:00
|
|
|
/**
|
|
|
|
|
* @apiIgnore
|
|
|
|
|
* @api {get} /api/v3/shops/market-gear get the available gear for the market
|
|
|
|
|
* @apiName GetMarketGear
|
|
|
|
|
* @apiGroup Shops
|
|
|
|
|
*
|
|
|
|
|
* @apiSuccess {Object} data List of available gear
|
|
|
|
|
*/
|
|
|
|
|
api.getMarketGear = {
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '/shops/market-gear',
|
2018-09-21 13:12:20 +00:00
|
|
|
middlewares: [authWithHeaders()],
|
2017-08-24 05:16:18 +00:00
|
|
|
async handler (req, res) {
|
2019-10-08 14:57:10 +00:00
|
|
|
const { user } = res.locals;
|
2017-08-24 05:16:18 +00:00
|
|
|
|
2019-10-08 14:57:10 +00:00
|
|
|
const resObject = {
|
2017-08-24 05:16:18 +00:00
|
|
|
categories: shops.getMarketGearCategories(user, req.language),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
res.respond(200, resObject);
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2016-07-26 19:36:55 +00:00
|
|
|
/**
|
|
|
|
|
* @apiIgnore
|
|
|
|
|
* @api {get} /api/v3/shops/quests get the available items for the quests shop
|
|
|
|
|
* @apiName GetQuestShopItems
|
|
|
|
|
* @apiGroup Shops
|
|
|
|
|
*
|
2016-11-24 01:34:09 +00:00
|
|
|
* @apiSuccess {Object} data List of available quests
|
2016-07-26 19:36:55 +00:00
|
|
|
* @apiSuccess {string} message Success message
|
|
|
|
|
*/
|
|
|
|
|
api.getQuestShopItems = {
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '/shops/quests',
|
2018-09-21 13:12:20 +00:00
|
|
|
middlewares: [authWithHeaders()],
|
2016-07-26 19:36:55 +00:00
|
|
|
async handler (req, res) {
|
2019-10-08 14:57:10 +00:00
|
|
|
const { user } = res.locals;
|
2016-07-26 19:36:55 +00:00
|
|
|
|
2019-10-08 14:57:10 +00:00
|
|
|
const resObject = shops.getQuestShop(user, req.language);
|
2016-07-26 19:36:55 +00:00
|
|
|
|
|
|
|
|
res.respond(200, resObject);
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @apiIgnore
|
|
|
|
|
* @api {get} /api/v3/shops/time-travelers get the available items for the time travelers shop
|
|
|
|
|
* @apiName GetTimeTravelersShopItems
|
|
|
|
|
* @apiGroup Shops
|
|
|
|
|
*
|
2016-11-24 01:34:09 +00:00
|
|
|
* @apiSuccess {Object} data List of available items
|
2016-07-26 19:36:55 +00:00
|
|
|
* @apiSuccess {string} message Success message
|
|
|
|
|
*/
|
|
|
|
|
api.getTimeTravelerShopItems = {
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '/shops/time-travelers',
|
2018-09-21 13:12:20 +00:00
|
|
|
middlewares: [authWithHeaders()],
|
2016-07-26 19:36:55 +00:00
|
|
|
async handler (req, res) {
|
2019-10-08 14:57:10 +00:00
|
|
|
const { user } = res.locals;
|
2016-07-26 19:36:55 +00:00
|
|
|
|
2019-10-08 14:57:10 +00:00
|
|
|
const resObject = shops.getTimeTravelersShop(user, req.language);
|
2016-07-26 19:36:55 +00:00
|
|
|
|
|
|
|
|
res.respond(200, resObject);
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @apiIgnore
|
|
|
|
|
* @api {get} /api/v3/shops/seasonal get the available items for the seasonal shop
|
|
|
|
|
* @apiName GetSeasonalShopItems
|
|
|
|
|
* @apiGroup Shops
|
|
|
|
|
*
|
2016-11-24 01:34:09 +00:00
|
|
|
* @apiSuccess {Object} data List of available items
|
2016-07-26 19:36:55 +00:00
|
|
|
* @apiSuccess {string} message Success message
|
|
|
|
|
*/
|
|
|
|
|
api.getSeasonalShopItems = {
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '/shops/seasonal',
|
2018-09-21 13:12:20 +00:00
|
|
|
middlewares: [authWithHeaders()],
|
2016-07-26 19:36:55 +00:00
|
|
|
async handler (req, res) {
|
2019-10-08 14:57:10 +00:00
|
|
|
const { user } = res.locals;
|
2016-07-26 19:36:55 +00:00
|
|
|
|
2019-10-08 14:57:10 +00:00
|
|
|
const resObject = shops.getSeasonalShop(user, req.language);
|
2016-07-26 19:36:55 +00:00
|
|
|
|
|
|
|
|
res.respond(200, resObject);
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2016-11-24 01:34:09 +00:00
|
|
|
/**
|
|
|
|
|
* @apiIgnore
|
|
|
|
|
* @api {get} /api/v3/shops/backgrounds get the available items for the backgrounds shop
|
|
|
|
|
* @apiName GetBackgroundsShopItems
|
|
|
|
|
* @apiGroup Shops
|
|
|
|
|
*
|
|
|
|
|
* @apiSuccess {Object} data List of available backgrounds
|
|
|
|
|
* @apiSuccess {string} message Success message
|
|
|
|
|
*/
|
|
|
|
|
api.getBackgroundShopItems = {
|
|
|
|
|
method: 'GET',
|
|
|
|
|
url: '/shops/backgrounds',
|
2018-09-21 13:12:20 +00:00
|
|
|
middlewares: [authWithHeaders()],
|
2016-11-24 01:34:09 +00:00
|
|
|
async handler (req, res) {
|
2019-10-08 14:57:10 +00:00
|
|
|
const { user } = res.locals;
|
2016-11-24 01:34:09 +00:00
|
|
|
|
2019-10-08 14:57:10 +00:00
|
|
|
const resObject = {
|
2016-11-24 01:34:09 +00:00
|
|
|
identifier: 'backgroundShop',
|
|
|
|
|
text: res.t('backgroundShop'),
|
2021-11-04 21:33:08 +00:00
|
|
|
notes: res.t('backgroundShop'),
|
2016-11-24 01:34:09 +00:00
|
|
|
imageName: 'background_shop',
|
|
|
|
|
sets: shops.getBackgroundShopSets(user, req.language),
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
res.respond(200, resObject);
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2024-02-01 14:06:32 +00:00
|
|
|
/**
|
|
|
|
|
* @apiIgnore
|
2024-04-02 15:07:28 +00:00
|
|
|
* @api {get} /api/v3/shops/customizations get the available items for the customizations shop
|
2024-02-01 14:06:32 +00:00
|
|
|
* @apiName GetCustomizationShopItems
|
|
|
|
|
* @apiGroup Shops
|
|
|
|
|
*
|
2024-04-20 01:11:17 +00:00
|
|
|
* @apiSuccess {Object} data List of available avatar customizations
|
2024-02-01 14:06:32 +00:00
|
|
|
* @apiSuccess {string} message Success message
|
|
|
|
|
*/
|
2024-04-02 15:07:28 +00:00
|
|
|
api.getCustomizationsShop = {
|
2024-02-01 14:06:32 +00:00
|
|
|
method: 'GET',
|
|
|
|
|
url: '/shops/customizations',
|
|
|
|
|
middlewares: [authWithHeaders()],
|
|
|
|
|
async handler (req, res) {
|
|
|
|
|
const { user } = res.locals;
|
|
|
|
|
|
2024-04-02 15:07:28 +00:00
|
|
|
const resObject = shops.getCustomizationsShop(user, req.language);
|
2024-02-01 14:06:32 +00:00
|
|
|
|
|
|
|
|
res.respond(200, resObject);
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2019-10-02 17:45:27 +00:00
|
|
|
export default api;
|