removed Utils import and added individual method import instead

Signed-off-by: Philip Molares <philip.molares@udo.edu>
Signed-off-by: David Mehren <dmehren1@gmail.com>
This commit is contained in:
Philip Molares 2020-04-12 21:02:41 +02:00 committed by David Mehren
parent 3b36e2e0e6
commit c49039c48c
No known key found for this signature in database
GPG key ID: 6017AF117F9756CB
2 changed files with 14 additions and 14 deletions

View file

@ -16,7 +16,7 @@ import {
import { generate as shortIdGenerate, isValid as shortIdIsValid } from 'shortid' import { generate as shortIdGenerate, isValid as shortIdIsValid } from 'shortid'
import { Author, Revision, User } from './index' import { Author, Revision, User } from './index'
import { Utils } from '../utils' import { processData, stripNullByte } from '../utils'
import Sequelize from 'sequelize' import Sequelize from 'sequelize'
import fs from 'fs' import fs from 'fs'
import path from 'path' import path from 'path'
@ -113,25 +113,25 @@ export class Note extends Model<Note> {
@Column(DataType.TEXT) @Column(DataType.TEXT)
get title (): string { get title (): string {
return Utils.processData(this.getDataValue('title'), '') return processData(this.getDataValue('title'), '')
} }
set title (value: string) { set title (value: string) {
this.setDataValue('title', Utils.stripNullByte(value)) this.setDataValue('title', stripNullByte(value))
} }
@Column(DataType.TEXT({ length: 'long' })) @Column(DataType.TEXT({ length: 'long' }))
get content (): string { get content (): string {
return Utils.processData(this.getDataValue('content'), '') return processData(this.getDataValue('content'), '')
} }
set content (value: string) { set content (value: string) {
this.setDataValue('content', Utils.stripNullByte(value)) this.setDataValue('content', stripNullByte(value))
} }
@Column(DataType.TEXT({ length: 'long' })) @Column(DataType.TEXT({ length: 'long' }))
get authorship (): string { get authorship (): string {
return Utils.processData(this.getDataValue('authorship'), [], JSON.parse) return processData(this.getDataValue('authorship'), [], JSON.parse)
} }
set authorship (value: string) { set authorship (value: string) {

View file

@ -1,7 +1,7 @@
import { BelongsTo, Column, DataType, ForeignKey, IsUUID, Model, PrimaryKey, Table } from 'sequelize-typescript' import { BelongsTo, Column, DataType, ForeignKey, IsUUID, Model, PrimaryKey, Table } from 'sequelize-typescript'
import { ChildProcess } from 'child_process' import { ChildProcess } from 'child_process'
import { Note } from './note' import { Note } from './note'
import { Utils } from '../utils' import { processData, stripNullByte } from '../utils'
import Sequelize from 'sequelize' import Sequelize from 'sequelize'
// core // core
@ -81,34 +81,34 @@ export class Revision extends Model<Revision> {
@Column(DataType.TEXT({ length: 'long' })) @Column(DataType.TEXT({ length: 'long' }))
get patch (): string { get patch (): string {
return Utils.processData(this.getDataValue('patch'), '') return processData(this.getDataValue('patch'), '')
} }
set patch (value: string) { set patch (value: string) {
this.setDataValue('patch', Utils.stripNullByte(value)) this.setDataValue('patch', stripNullByte(value))
} }
@Column(DataType.TEXT({ length: 'long' })) @Column(DataType.TEXT({ length: 'long' }))
get lastContent (): string { get lastContent (): string {
return Utils.processData(this.getDataValue('lastContent'), '') return processData(this.getDataValue('lastContent'), '')
} }
set lastContent (value: string) { set lastContent (value: string) {
this.setDataValue('lastContent', Utils.stripNullByte(value)) this.setDataValue('lastContent', stripNullByte(value))
} }
@Column(DataType.TEXT({ length: 'long' })) @Column(DataType.TEXT({ length: 'long' }))
get content (): string { get content (): string {
return Utils.processData(this.getDataValue('content'), '') return processData(this.getDataValue('content'), '')
} }
set content (value: string) { set content (value: string) {
this.setDataValue('content', Utils.stripNullByte(value)) this.setDataValue('content', stripNullByte(value))
} }
@Column(DataType.TEXT({ length: 'long' })) @Column(DataType.TEXT({ length: 'long' }))
get authorship (): string { get authorship (): string {
return Utils.processData(this.getDataValue('authorship'), [], JSON.parse) return processData(this.getDataValue('authorship'), [], JSON.parse)
} }
set authorship (value: string) { set authorship (value: string) {