generated from azures04/Base-REST-API
Refactored productsFilesService to productsService
This commit is contained in:
parent
1ddcf1eaf2
commit
5eaca1e948
@ -1,11 +1,11 @@
|
|||||||
const express = require("express")
|
const express = require("express")
|
||||||
const productsFileService = require("../../../../services/productsFileService")
|
const productsService = require("../../../../services/productsService")
|
||||||
const router = express.Router({ mergeParams: true })
|
const router = express.Router({ mergeParams: true })
|
||||||
|
|
||||||
router.get(/.*/, async (req, res, next) => {
|
router.get(/.*/, async (req, res, next) => {
|
||||||
const { productName, productPlatform } = req.params
|
const { productName, productPlatform } = req.params
|
||||||
await productsFileService.canAccess(productName)
|
await productsService.canAccess(productName)
|
||||||
const file = await productsFileService.getFile(req.url, productName, productPlatform)
|
const file = await productsService.getFile(req.url, productName, productPlatform)
|
||||||
return res.status(200).download(file.path)
|
return res.status(200).download(file.path)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
const express = require("express")
|
const express = require("express")
|
||||||
const productsFileService = require("../../../../services/productsFileService")
|
const productsService = require("../../../../services/productsService")
|
||||||
const router = express.Router({ mergeParams: true })
|
const router = express.Router({ mergeParams: true })
|
||||||
|
|
||||||
router.get("/", async (req, res) => {
|
router.get("/", async (req, res) => {
|
||||||
const { productName, productPlatform } = req.params
|
const { productName, productPlatform } = req.params
|
||||||
await productsFileService.canAccess(productName)
|
await productsService.canAccess(productName)
|
||||||
const files = await productsFileService.getProductFiles(productName, productPlatform)
|
const files = await productsService.getProductFiles(productName, productPlatform)
|
||||||
return res.status(200).json(files)
|
return res.status(200).json(files)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
const express = require("express")
|
const express = require("express")
|
||||||
const productsFileService = require("../../../../services/productsFileService")
|
const productsService = require("../../../../services/productsService")
|
||||||
const router = express.Router({ mergeParams: true })
|
const router = express.Router({ mergeParams: true })
|
||||||
|
|
||||||
router.get("/", async (req, res) => {
|
router.get("/", async (req, res) => {
|
||||||
const { productName, productPlatform } = req.params
|
const { productName, productPlatform } = req.params
|
||||||
await productsFileService.canAccess(productName)
|
await productsService.canAccess(productName)
|
||||||
const files = await productsFileService.getRequirementsForPlatform(productName, productPlatform)
|
const files = await productsService.getRequirementsForPlatform(productName, productPlatform)
|
||||||
return res.status(200).json(files)
|
return res.status(200).json(files)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
const express = require("express")
|
const express = require("express")
|
||||||
const productsFileService = require("../../../services/productsFileService")
|
const productsService = require("../../../services/productsService")
|
||||||
const router = express.Router({ mergeParams: true })
|
const router = express.Router({ mergeParams: true })
|
||||||
|
|
||||||
router.get("/", async (req, res) => {
|
router.get("/", async (req, res) => {
|
||||||
const { productName } = req.params
|
const { productName } = req.params
|
||||||
await productsFileService.canAccess(productName)
|
await productsService.canAccess(productName)
|
||||||
const files = await productsFileService.getInstallerResources(productName)
|
const files = await productsService.getInstallerResources(productName)
|
||||||
return res.status(200).json(files)
|
return res.status(200).json(files)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
const express = require("express")
|
const express = require("express")
|
||||||
const router = express.Router({ mergeParams: false })
|
const router = express.Router({ mergeParams: false })
|
||||||
const productsFileService = require("../../services/productsFileService")
|
const productsService = require("../../services/productsService")
|
||||||
|
|
||||||
router.get("/", async (req, res) => {
|
router.get("/", async (req, res) => {
|
||||||
const products = await productsFileService.getProducts()
|
const products = await productsService.getProducts()
|
||||||
return res.status(200).json(products)
|
return res.status(200).json(products)
|
||||||
})
|
})
|
||||||
|
|
||||||
router.get("/product/:productName", async (req, res) => {
|
router.get("/product/:productName", async (req, res) => {
|
||||||
const product = await productsFileService.getProduct(req.params.productName)
|
const product = await productsService.getProduct(req.params.productName)
|
||||||
return res.status(200).json(product)
|
return res.status(200).json(product)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user