implement soft 'deleted' field
This commit is contained in:
parent
b1391f9b43
commit
7105bb046f
|
@ -16,7 +16,7 @@ const __dirname = path.dirname(__filename);
|
||||||
// })
|
// })
|
||||||
export default pino(
|
export default pino(
|
||||||
{
|
{
|
||||||
level: 'error',
|
level: 'trace',
|
||||||
formatters: {
|
formatters: {
|
||||||
level: (label) => {
|
level: (label) => {
|
||||||
return { level: label.toUpperCase() };
|
return { level: label.toUpperCase() };
|
||||||
|
|
|
@ -18,7 +18,7 @@ export class Data {
|
||||||
}
|
}
|
||||||
async getStories() {
|
async getStories() {
|
||||||
return this.#db('stories')
|
return this.#db('stories')
|
||||||
.select('id','title','word_count')
|
.select('id','title','word_count','deleted')
|
||||||
}
|
}
|
||||||
async getPublications() {
|
async getPublications() {
|
||||||
return this.#db('pubs')
|
return this.#db('pubs')
|
||||||
|
|
|
@ -42,10 +42,10 @@ export const postEndpoints = (db,data) => {
|
||||||
const router = express.Router()
|
const router = express.Router()
|
||||||
endpoint(router,Story,'create','insert',db,data)
|
endpoint(router,Story,'create','insert',db,data)
|
||||||
endpoint(router,Story,'edit','update',db,data)
|
endpoint(router,Story,'edit','update',db,data)
|
||||||
endpoint(router,Story,'delete','del',db,data)
|
endpoint(router,Story,'delete','update',db,data)
|
||||||
endpoint(router,Submission,'create','insert',db,data)
|
endpoint(router,Submission,'create','insert',db,data)
|
||||||
endpoint(router,Submission,'edit','update',db,data)
|
endpoint(router,Submission,'edit','update',db,data)
|
||||||
endpoint(router,Submission,'delete','del',db,data)
|
endpoint(router,Submission,'delete','update',db,data)
|
||||||
endpoint(router,Publication,'create','insert',db,data)
|
endpoint(router,Publication,'create','insert',db,data)
|
||||||
endpoint(router,Publication,'edit','update',db,data)
|
endpoint(router,Publication,'edit','update',db,data)
|
||||||
endpoint(router,Publication,'delete','del',db,data)
|
endpoint(router,Publication,'delete','del',db,data)
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import Title from "./Title.mjs"
|
import Title from "./Title.mjs"
|
||||||
|
import logger from "../logger.mjs"
|
||||||
export default class Story extends Title{
|
export default class Story extends Title{
|
||||||
set _word_count(prop){
|
set _word_count(prop){
|
||||||
if(prop){
|
if(prop){
|
||||||
|
@ -13,5 +14,6 @@ export default class Story extends Title{
|
||||||
constructor(data){
|
constructor(data){
|
||||||
super(data)
|
super(data)
|
||||||
this._word_count=data?.word_count
|
this._word_count=data?.word_count
|
||||||
|
logger.trace(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,10 +14,18 @@ export default class Title extends Entity{
|
||||||
this.genres=prop
|
this.genres=prop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
set _deleted(prop){
|
||||||
|
if(prop){
|
||||||
|
if(prop===1 || prop===0){
|
||||||
|
this.deleted=prop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
constructor(data){
|
constructor(data){
|
||||||
super(data)
|
super(data)
|
||||||
this._title = data?.title
|
this._title = data?.title
|
||||||
this._genres = data?.genres
|
this._genres = data?.genres
|
||||||
|
this._deleted = data?.deleted
|
||||||
}
|
}
|
||||||
}
|
}
|
BIN
submissions
BIN
submissions
Binary file not shown.
Loading…
Reference in New Issue