Skip to content

Commit

Permalink
Removed unnecessary code
Browse files Browse the repository at this point in the history
  • Loading branch information
MKHenson committed Apr 27, 2016
1 parent 355ce7c commit 82dd8f3
Show file tree
Hide file tree
Showing 20 changed files with 28 additions and 162 deletions.
15 changes: 5 additions & 10 deletions server/dist/src/models/schema-items/schema-bool.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,18 +33,13 @@ var SchemaBool = (function (_super) {
* @returns {boolean | string} Returns true if successful or an error message string if unsuccessful
*/
SchemaBool.prototype.validate = function () {
var val = _super.prototype.validate.call(this);
if (!val)
return false;
var val = this.value;
if (val === undefined)
return this.name + " cannot be undefined";
if (val === null)
return this.name + " cannot be null";
return true;
};
/**
* Gets the value of this item
* @returns {boolean}
*/
SchemaBool.prototype.getValue = function () {
return this.value;
};
return SchemaBool;
}(schema_item_1.SchemaItem));
exports.SchemaBool = SchemaBool;
7 changes: 4 additions & 3 deletions server/dist/src/models/schema-items/schema-date.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ var SchemaDate = (function (_super) {
};
/**
* Gets the value of this item
* @returns {SchemaValue}
* @param {ISchemaOptions} options [Optional] A set of options that can be passed to control how the data must be returned
* @returns {number}
*/
SchemaDate.prototype.getValue = function () {
return (this.value !== undefined && this.value !== null ? this.value : Date.now());
SchemaDate.prototype.getValue = function (options) {
return (this.value !== undefined && this.value !== null ? this.value : null);
};
return SchemaDate;
}(schema_item_1.SchemaItem));
Expand Down
7 changes: 0 additions & 7 deletions server/dist/src/models/schema-items/schema-html.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,6 @@ var SchemaHtml = (function (_super) {
return true;
};
/**
* Gets the value of this item
* @returns {SchemaValue}
*/
SchemaHtml.prototype.getValue = function () {
return this.value;
};
/**
* The default tags allowed
* includes: h3, h4, h5, h6, blockquote, p, a, ul, ol,
* nl, li, b, i, strong, em, strike, code, hr, br, div,
Expand Down
7 changes: 0 additions & 7 deletions server/dist/src/models/schema-items/schema-id-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,6 @@ var SchemaIdArray = (function (_super) {
return "You have selected too many items for " + this.name + ", please only use up to " + this.maxItems;
return true;
};
/**
* Gets the value of this item
* @returns {Array<string|ObjectID>}
*/
SchemaIdArray.prototype.getValue = function () {
return this.value;
};
return SchemaIdArray;
}(schema_item_1.SchemaItem));
exports.SchemaIdArray = SchemaIdArray;
10 changes: 0 additions & 10 deletions server/dist/src/models/schema-items/schema-id.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,6 @@ var SchemaId = (function (_super) {
}
return true;
};
/**
* Gets the value of this item
* @returns {SchemaValue}
*/
SchemaId.prototype.getValue = function () {
if (!this.value)
return null;
else
return this.value;
};
return SchemaId;
}(schema_item_1.SchemaItem));
exports.SchemaId = SchemaId;
7 changes: 0 additions & 7 deletions server/dist/src/models/schema-items/schema-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,6 @@ var SchemaJSON = (function (_super) {
this.value = null;
return true;
};
/**
* Gets the value of this item
* @returns {SchemaValue}
*/
SchemaJSON.prototype.getValue = function () {
return this.value;
};
return SchemaJSON;
}(schema_item_1.SchemaItem));
exports.SchemaJSON = SchemaJSON;
7 changes: 0 additions & 7 deletions server/dist/src/models/schema-items/schema-num-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,6 @@ var SchemaNumArray = (function (_super) {
return "You have selected too many items for " + this.name + ", please only use up to " + this.maxItems;
return true;
};
/**
* Gets the value of this item
* @returns {Array<number>}
*/
SchemaNumArray.prototype.getValue = function () {
return this.value;
};
return SchemaNumArray;
}(schema_item_1.SchemaItem));
exports.SchemaNumArray = SchemaNumArray;
7 changes: 0 additions & 7 deletions server/dist/src/models/schema-items/schema-number.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,6 @@ var SchemaNumber = (function (_super) {
else
return "The value of " + this.name + " is not within the range of " + this.min + " and " + this.max;
};
/**
* Gets the value of this item
* @returns {SchemaValue}
*/
SchemaNumber.prototype.getValue = function () {
return this.value;
};
return SchemaNumber;
}(schema_item_1.SchemaItem));
exports.SchemaNumber = SchemaNumber;
7 changes: 0 additions & 7 deletions server/dist/src/models/schema-items/schema-text-array.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,6 @@ var SchemaTextArray = (function (_super) {
}
return true;
};
/**
* Gets the value of this item
* @returns {Array<string>}
*/
SchemaTextArray.prototype.getValue = function () {
return this.value;
};
return SchemaTextArray;
}(schema_item_1.SchemaItem));
exports.SchemaTextArray = SchemaTextArray;
7 changes: 0 additions & 7 deletions server/dist/src/models/schema-items/schema-text.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@ var SchemaText = (function (_super) {
else
return true;
};
/**
* Gets the value of this item
* @returns {SchemaValue}
*/
SchemaText.prototype.getValue = function () {
return this.value;
};
return SchemaText;
}(schema_item_1.SchemaItem));
exports.SchemaText = SchemaText;
18 changes: 6 additions & 12 deletions server/src/models/schema-items/schema-bool.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {SchemaItem} from "./schema-item";
import {ISchemaOptions} from "modepress-api";

/**
* A bool scheme item for use in Models
Expand Down Expand Up @@ -33,19 +34,12 @@ export class SchemaBool extends SchemaItem<boolean>
*/
public validate(): boolean | string
{
var val = super.validate();
if (!val)
return false;
var val = this.value;
if (val === undefined)
return `${this.name} cannot be undefined`;
if (val === null)
return `${this.name} cannot be null`;

return true;
}

/**
* Gets the value of this item
* @returns {boolean}
*/
public getValue(): boolean
{
return this.value;
}
}
8 changes: 5 additions & 3 deletions server/src/models/schema-items/schema-date.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {SchemaItem} from "./schema-item";
import {ISchemaOptions} from "modepress-api";

/**
* A date scheme item for use in Models
Expand Down Expand Up @@ -46,10 +47,11 @@ export class SchemaDate extends SchemaItem<number>

/**
* Gets the value of this item
* @returns {SchemaValue}
* @param {ISchemaOptions} options [Optional] A set of options that can be passed to control how the data must be returned
* @returns {number}
*/
public getValue(): number
public getValue(options? : ISchemaOptions): number
{
return (this.value !== undefined && this.value !== null ? this.value : Date.now() );
return (this.value !== undefined && this.value !== null ? this.value : null );
}
}
10 changes: 1 addition & 9 deletions server/src/models/schema-items/schema-html.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {SchemaItem} from "./schema-item";
import {ISchemaOptions} from "modepress-api";
import sanitizeHtml = require("sanitize-html");

/**
Expand Down Expand Up @@ -94,13 +95,4 @@ export class SchemaHtml extends SchemaItem<string>
this.value = sanitizedHTML;
return true;
}

/**
* Gets the value of this item
* @returns {SchemaValue}
*/
public getValue(): string
{
return this.value;
}
}
10 changes: 1 addition & 9 deletions server/src/models/schema-items/schema-id-array.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {SchemaItem} from "./schema-item";
import {ISchemaOptions} from "modepress-api";
import sanitizeHtml = require("sanitize-html");
import {ObjectID} from "mongodb";
import {Utils} from "../../utils"
Expand Down Expand Up @@ -68,13 +69,4 @@ export class SchemaIdArray extends SchemaItem<Array<string | ObjectID>>

return true;
}

/**
* Gets the value of this item
* @returns {Array<string|ObjectID>}
*/
public getValue(): Array<string|ObjectID>
{
return this.value;
}
}
13 changes: 1 addition & 12 deletions server/src/models/schema-items/schema-id.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {SchemaItem} from "./schema-item";
import {ISchemaOptions} from "modepress-api";
import {ObjectID} from "mongodb";
import {Utils} from "../../utils"

Expand Down Expand Up @@ -55,16 +56,4 @@ export class SchemaId extends SchemaItem<ObjectID | string>

return true;
}

/**
* Gets the value of this item
* @returns {SchemaValue}
*/
public getValue(): ObjectID
{
if (!this.value)
return null;
else
return <ObjectID>this.value;
}
}
10 changes: 1 addition & 9 deletions server/src/models/schema-items/schema-json.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {SchemaItem} from "./schema-item";
import {ISchemaOptions} from "modepress-api";
import sanitizeHtml = require("sanitize-html");

/**
Expand Down Expand Up @@ -39,13 +40,4 @@ export class SchemaJSON extends SchemaItem<any>

return true;
}

/**
* Gets the value of this item
* @returns {SchemaValue}
*/
public getValue(): any
{
return this.value;
}
}
10 changes: 1 addition & 9 deletions server/src/models/schema-items/schema-num-array.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {SchemaItem} from "./schema-item";
import {ISchemaOptions} from "modepress-api";
import {NumberType} from "./schema-number";

/**
Expand Down Expand Up @@ -92,13 +93,4 @@ export class SchemaNumArray extends SchemaItem<Array<number>>

return true;
}

/**
* Gets the value of this item
* @returns {Array<number>}
*/
public getValue(): Array<number>
{
return this.value;
}
}
10 changes: 1 addition & 9 deletions server/src/models/schema-items/schema-number.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {SchemaItem} from "./schema-item";
import {ISchemaOptions} from "modepress-api";

/**
* Describes the type of number to store
Expand Down Expand Up @@ -80,13 +81,4 @@ export class SchemaNumber extends SchemaItem<number>
else
return `The value of ${this.name} is not within the range of ${this.min} and ${this.max}`;
}

/**
* Gets the value of this item
* @returns {SchemaValue}
*/
public getValue(): number
{
return this.value;
}
}
10 changes: 1 addition & 9 deletions server/src/models/schema-items/schema-text-array.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {SchemaItem} from "./schema-item";
import {ISchemaOptions} from "modepress-api";
import sanitizeHtml = require("sanitize-html");

/**
Expand Down Expand Up @@ -86,13 +87,4 @@ export class SchemaTextArray extends SchemaItem<Array<string>>

return true;
}

/**
* Gets the value of this item
* @returns {Array<string>}
*/
public getValue(): Array<string>
{
return this.value;
}
}
10 changes: 1 addition & 9 deletions server/src/models/schema-items/schema-text.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {SchemaItem} from "./schema-item";
import {ISchemaOptions} from "modepress-api";
import sanitizeHtml = require("sanitize-html");

/**
Expand Down Expand Up @@ -69,13 +70,4 @@ export class SchemaText extends SchemaItem<string>
else
return true;
}

/**
* Gets the value of this item
* @returns {SchemaValue}
*/
public getValue(): string
{
return this.value;
}
}

0 comments on commit 82dd8f3

Please sign in to comment.