Integration debat sur carte

This commit is contained in:
Henintsoa 2021-11-15 11:52:30 +03:00
parent 0dc22beb0d
commit 13d04234d1

View file

@ -15,6 +15,15 @@ const Authority = {
}, },
}; };
const DebateType = {
BASIC: "BASIC",
CARTO: "CARTO",
_value: {
BASIC: 0,
CARTO: 1,
}
}
const Opinion = { const Opinion = {
FOR: "FOR", FOR: "FOR",
NEUTRAL: "NEUTRAL", NEUTRAL: "NEUTRAL",
@ -128,6 +137,7 @@ Category.prototype.debates = function () {
function Document(obj = {}) { function Document(obj = {}) {
Entity.call(this, obj); Entity.call(this, obj);
this.type = DebateType.BASIC;
} }
Document.prototype.attrs = { Document.prototype.attrs = {
id: Number, id: Number,
@ -137,6 +147,10 @@ Document.prototype.attrs = {
content: String, content: String,
debatesCount: Number, debatesCount: Number,
lastCommentDate: Date, lastCommentDate: Date,
type: String,
meshLine: Number,
meshColumn: Number,
mapLink: String,
}; };
Document.prototype.oneToMany = { Document.prototype.oneToMany = {
debates: [Debate, "document"], debates: [Debate, "document"],
@ -145,8 +159,13 @@ Document.prototype.manyToOne = {
category: [Category, "documents"], category: [Category, "documents"],
}; };
Document.prototype.is = function (type) {
return DebateType._value[this.type] == DebateType._value[type];
}
function Debate(obj = {}) { function Debate(obj = {}) {
Entity.call(this, obj); Entity.call(this, obj);
this.type = DebateType.BASIC;
} }
Debate.prototype.attrs = { Debate.prototype.attrs = {
id: Number, id: Number,
@ -162,6 +181,7 @@ Debate.prototype.attrs = {
reformulationCheck: Boolean, reformulationCheck: Boolean,
idfixLink: Boolean, idfixLink: Boolean,
openPublic: Boolean, openPublic: Boolean,
type: String,
}; };
Debate.prototype.oneToMany = { Debate.prototype.oneToMany = {
comments: [Comment, "debate"], comments: [Comment, "debate"],
@ -181,6 +201,9 @@ Debate.prototype.deepSortComments = function (sortFunction) {
this.comments[i].deepSortComments(sortFunction); this.comments[i].deepSortComments(sortFunction);
} }
}; };
Debate.prototype.is = function (type) {
return DebateType._value[this.type] == DebateType._value[type];
}
function Comment(obj = {}) { function Comment(obj = {}) {
Entity.call(this, obj); Entity.call(this, obj);