Compare commits
1 Commits
feature/dr
...
b70ac7c183
| Author | SHA1 | Date | |
|---|---|---|---|
| b70ac7c183 |
@@ -49,7 +49,6 @@ app.use('/kazan-explore', require('./routers/kazan-explore'))
|
|||||||
app.use('/edateam', require('./routers/edateam-legacy'))
|
app.use('/edateam', require('./routers/edateam-legacy'))
|
||||||
app.use('/dry-wash', require('./routers/dry-wash'))
|
app.use('/dry-wash', require('./routers/dry-wash'))
|
||||||
app.use('/freetracker', require('./routers/freetracker'))
|
app.use('/freetracker', require('./routers/freetracker'))
|
||||||
app.use('/dhs-testing', require('./routers/dhs-testing'))
|
|
||||||
|
|
||||||
app.use(require('./error'))
|
app.use(require('./error'))
|
||||||
|
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
const router = require('express').Router()
|
|
||||||
const {MasterModel} = require('./model/master')
|
|
||||||
|
|
||||||
router.post('/master', async (req, res,next) => {
|
|
||||||
|
|
||||||
const {name, phone} = req.body
|
|
||||||
|
|
||||||
if (!name || !phone ){
|
|
||||||
throw new Error('Enter name and phone')
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
const master = await MasterModel.create({name, phone})
|
|
||||||
res.status(200).send({success: true, body: master})
|
|
||||||
} catch (error) {
|
|
||||||
next(error)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
router.get('/masters', async (req, res,next) => {
|
|
||||||
try {
|
|
||||||
const master = await MasterModel.find({})
|
|
||||||
res.status(200).send({success: true, body: master})
|
|
||||||
} catch (error) {
|
|
||||||
next(error)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
router.get('/orders', (req, res) => {
|
|
||||||
res
|
|
||||||
.status(200)
|
|
||||||
.send(require(`./json/arm-orders/success.json`))
|
|
||||||
})
|
|
||||||
|
|
||||||
module.exports = router
|
|
||||||
@@ -1,8 +1,15 @@
|
|||||||
const router = require('express').Router()
|
const router = require('express').Router()
|
||||||
const armRouter = require('./arm')
|
|
||||||
|
|
||||||
|
router.get('/arm/masters', (req, res) => {
|
||||||
|
res
|
||||||
|
.status(200)
|
||||||
|
.send(require("./json/arm-masters/success.json"))
|
||||||
|
})
|
||||||
|
|
||||||
router.use('/arm', armRouter)
|
router.get('/arm/orders', (req, res) => {
|
||||||
|
res
|
||||||
|
.status(200)
|
||||||
|
.send(require(`./json/arm-orders/success.json`))
|
||||||
|
})
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
const { Schema, model } = require('mongoose')
|
|
||||||
|
|
||||||
const schema = new Schema({
|
|
||||||
name: {type: String, required: true},
|
|
||||||
phone: {type: String, required: true,unique: true,},
|
|
||||||
created: {
|
|
||||||
type: Date, default: () => new Date().toISOString(),
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
schema.set('toJSON', {
|
|
||||||
virtuals: true,
|
|
||||||
versionKey: false,
|
|
||||||
})
|
|
||||||
|
|
||||||
schema.virtual('id').get(function () {
|
|
||||||
return this._id.toHexString()
|
|
||||||
})
|
|
||||||
|
|
||||||
exports.MasterModel = model('dry-wash-master', schema)
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
const { Schema, model } = require('mongoose')
|
|
||||||
|
|
||||||
const schema = new Schema({
|
|
||||||
startWashTime: {type: String, required: true},
|
|
||||||
endWashTime: {type: String, required: true},
|
|
||||||
orderDate: {type: String, required: true},
|
|
||||||
location: {type: String, required: true},
|
|
||||||
phone: {type: String, required: true},
|
|
||||||
status: {type: String, required: true},
|
|
||||||
carNumber: {type: String, required: true},
|
|
||||||
created: {
|
|
||||||
type: Date, default: () => new Date().toISOString(),
|
|
||||||
},
|
|
||||||
updated: {
|
|
||||||
type: Date, default: () => new Date().toISOString(),
|
|
||||||
},
|
|
||||||
master: {type: Schema.Types.ObjectId, ref: 'dry-wash-master'},
|
|
||||||
notes: String,
|
|
||||||
})
|
|
||||||
|
|
||||||
schema.set('toJSON', {
|
|
||||||
virtuals: true,
|
|
||||||
versionKey: false,
|
|
||||||
})
|
|
||||||
|
|
||||||
schema.virtual('id').get(function () {
|
|
||||||
return this._id.toHexString()
|
|
||||||
})
|
|
||||||
|
|
||||||
exports.OrderModel = model('dry-wash-order', schema)
|
|
||||||
@@ -1,60 +0,0 @@
|
|||||||
{
|
|
||||||
"info": {
|
|
||||||
"_postman_id": "e91fbcf7-3c7b-420d-a49e-4dbb6199c14a",
|
|
||||||
"name": "dry-wash",
|
|
||||||
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json",
|
|
||||||
"_exporter_id": "27705820"
|
|
||||||
},
|
|
||||||
"item": [
|
|
||||||
{
|
|
||||||
"name": "arm",
|
|
||||||
"item": [
|
|
||||||
{
|
|
||||||
"name": "create master",
|
|
||||||
"request": {
|
|
||||||
"method": "POST",
|
|
||||||
"header": [],
|
|
||||||
"body": {
|
|
||||||
"mode": "raw",
|
|
||||||
"raw": "{\n \"name\":\"Anton\",\n \"phone\": \"89172420577\"\n}",
|
|
||||||
"options": {
|
|
||||||
"raw": {
|
|
||||||
"language": "json"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"url": {
|
|
||||||
"raw": "{{host}}/arm/master",
|
|
||||||
"host": [
|
|
||||||
"{{host}}"
|
|
||||||
],
|
|
||||||
"path": [
|
|
||||||
"arm",
|
|
||||||
"master"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"response": []
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "get masters",
|
|
||||||
"request": {
|
|
||||||
"method": "GET",
|
|
||||||
"header": [],
|
|
||||||
"url": {
|
|
||||||
"raw": "{{host}}/arm/masters",
|
|
||||||
"host": [
|
|
||||||
"{{host}}"
|
|
||||||
],
|
|
||||||
"path": [
|
|
||||||
"arm",
|
|
||||||
"masters"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"response": []
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
24
server/routers/freetracker/auth/index.js
Normal file
24
server/routers/freetracker/auth/index.js
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
const Router = require('express').Router
|
||||||
|
|
||||||
|
const router = Router()
|
||||||
|
|
||||||
|
router.post('/auth/login', (req, res) => {
|
||||||
|
if (req.body.email === 'qwerty@mail.ru') {
|
||||||
|
res.status(200).send(require('./json/login/login-success.json'))
|
||||||
|
} else {
|
||||||
|
res.status(401).send(require('./json/login/login-error.json'));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
router.post('/auth/register', (req, res) => {
|
||||||
|
res.status(400).send(require('./json/registration/registration-error.json'))
|
||||||
|
// res.status(201).send(require('./json/registration/registration-error.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
router.post('/auth/reset-password', (req, res) => {
|
||||||
|
res.status(200).send(require('./json/reset-password/reset-password-success.json'))
|
||||||
|
// res.status(404).send(require('./json/reset-password/reset-password-error.json'))
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = router;
|
||||||
11
server/routers/freetracker/auth/json/login/login-error.json
Normal file
11
server/routers/freetracker/auth/json/login/login-error.json
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"body": null,
|
||||||
|
"errors": [
|
||||||
|
{
|
||||||
|
"code": "AUTH_INVALID_CREDENTIALS",
|
||||||
|
"message": "Неверное имя пользователя или пароль"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"body": {
|
||||||
|
"token": "AUTH_TOKEN"
|
||||||
|
},
|
||||||
|
"errors": [],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"body": null,
|
||||||
|
"errors": [
|
||||||
|
{
|
||||||
|
"code": "REGISTRATION_EMAIL_TAKEN",
|
||||||
|
"message": "Электронная почта уже используется"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"body": {
|
||||||
|
"userId": "12345",
|
||||||
|
"token": "AUTH_TOKEN"
|
||||||
|
},
|
||||||
|
"errors": [],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"success": false,
|
||||||
|
"body": null,
|
||||||
|
"errors": [
|
||||||
|
{
|
||||||
|
"code": "RESET_PASSWORD_EMAIL_NOT_FOUND",
|
||||||
|
"message": "Адрес электронной почты не зарегистрирован"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"body": {
|
||||||
|
"message": "Отправлено электронное письмо для сброса пароля"
|
||||||
|
},
|
||||||
|
"errors": [],
|
||||||
|
"warnings": []
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
const router = require('express').Router();
|
const router = require('express').Router();
|
||||||
|
|
||||||
router.use('/performer', require('./dashboard-performer'))
|
router.use('/performer', require('./dashboard-performer'))
|
||||||
|
router.use('/auth', require('./auth'))
|
||||||
|
|
||||||
module.exports = router;
|
module.exports = router;
|
||||||
|
|||||||
Reference in New Issue
Block a user