Update server side structure
This commit is contained in:
@@ -1,19 +1,26 @@
|
||||
'use strict'
|
||||
|
||||
// Depedencies
|
||||
let diff = require( 'diff' )
|
||||
let diff = require( 'diff' ),
|
||||
paths = require( '../utils/paths.class.js' ),
|
||||
ids = require( '../utils/ids.class.js' )
|
||||
|
||||
class File
|
||||
{
|
||||
constructor( _name, _content )
|
||||
constructor( _options )
|
||||
{
|
||||
// Set up
|
||||
this.name = _name
|
||||
this.versions = []
|
||||
this.id = ids.get_id()
|
||||
this.name = _options.name
|
||||
this.path = {}
|
||||
this.path.directory = _options.path
|
||||
this.path.full = this.path.directory + '/' + this.name
|
||||
this.path.parts = this.path.full.split( paths.separator )
|
||||
this.versions = []
|
||||
|
||||
// Create first version
|
||||
if( typeof _content !== 'undefined' )
|
||||
this.create_version( _content )
|
||||
if( typeof _options.content !== 'undefined' )
|
||||
this.create_version( _options.content )
|
||||
}
|
||||
|
||||
create_version( content )
|
||||
@@ -38,9 +45,21 @@ class File
|
||||
return this.versions[ this.versions.length - 1 ]
|
||||
}
|
||||
|
||||
describe()
|
||||
{
|
||||
// Set up
|
||||
let result = {}
|
||||
result.id = this.id
|
||||
result.name = this.name
|
||||
result.path = this.path
|
||||
result.versions = this.versions
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
destructor()
|
||||
{
|
||||
console.log( 'destruct' )
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user