DONE AGAIN

This commit is contained in:
2021-10-15 02:15:38 +03:00
parent ade92e0493
commit 32d7e45670
4 changed files with 23 additions and 42 deletions

View File

@@ -89,15 +89,6 @@
"created_at": "2021-09-15T10:43:02.014Z",
"updated_at": "2021-08-07T07:06:51.050Z"
},
{
"id": 11,
"title": "Western carpet python",
"category": "quote",
"archive": false,
"content": "I'll parse the online AI firewall, that should bandwidth the USB alarm!",
"created_at": "2021-09-10T15:30:21.732Z",
"updated_at": "2021-10-14T22:37:50.128Z"
},
{
"id": 12,
"title": "Indian python",
@@ -277,14 +268,5 @@
"content": "If we hack the bus, we can get to the TCP capacitor through the 1080p CSS transmitter!",
"created_at": "2021-08-17T12:04:24.277Z",
"updated_at": null
},
{
"id": 32,
"title": "Cat snake",
"category": "task",
"archive": false,
"content": "bypassing the system won't do anything, we need to quantify the open-source RAM matrix!",
"created_at": "2021-10-14T13:03:11.921Z",
"updated_at": null
}
]

View File

@@ -1,4 +1,4 @@
import { setResp403, setResp500 } from '../../helpers/http.js'
import { setResp500 } from '../../helpers/http.js'
import NotesService from '../../services/NotesService.js'
/**
@@ -7,17 +7,6 @@ import NotesService from '../../services/NotesService.js'
*/
const db = new NotesService()
/**
*
* @param req
* @param res
* @returns {Promise<void>}
*/
export const setForbidden = async (req, res) => {
const ip = req.headers['x-real-ip'] || req.connection.remoteAddress
res.status(403).json(setResp403(`You are not allowed to access the resource. Your IP is ${ip}`))
}
/**
*
* @param req

View File

@@ -1,10 +1,22 @@
import { Router } from 'express'
import { addNote } from './methods/post.js'
import { getAllNotes, getSingleNote, getStats, setForbidden } from './methods/get.js'
import { getAllNotes, getSingleNote, getStats } from './methods/get.js'
import { editNote } from './methods/patch.js'
import { deleteNote } from './methods/delete.js'
import { id as validate } from '../services/ValidationService.js'
import { idOnlySchema, newNoteSchema, updateNoteSchema } from '../repositories/schema.js'
import { setResp403 } from '../helpers/http.js'
/**
*
* @param req
* @param res
* @returns {Promise<void>}
*/
export const setForbidden = async (req, res) => {
const ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress
res.status(403).json(setResp403(`You are not allowed to access the resource. Your IP is ${ip}`))
}
const router = new Router()

View File

@@ -1,4 +1,3 @@
//const data = require('../repositories/data.json')
import * as path from 'path'
import * as fs from 'fs'
@@ -127,7 +126,6 @@ class NotesService {
return this._composeResponse([], `UPDATED WHERE id = ${data.id}`)
}
/**