From 13d04234d14187580e6ad6b0c6de6b1277837410 Mon Sep 17 00:00:00 2001 From: Henintsoa Date: Mon, 15 Nov 2021 11:52:30 +0300 Subject: [PATCH] Integration debat sur carte --- src/main/webapp/assets/js/service/aren.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main/webapp/assets/js/service/aren.js b/src/main/webapp/assets/js/service/aren.js index 8d464ad..676889c 100644 --- a/src/main/webapp/assets/js/service/aren.js +++ b/src/main/webapp/assets/js/service/aren.js @@ -15,6 +15,15 @@ const Authority = { }, }; +const DebateType = { + BASIC: "BASIC", + CARTO: "CARTO", + _value: { + BASIC: 0, + CARTO: 1, + } +} + const Opinion = { FOR: "FOR", NEUTRAL: "NEUTRAL", @@ -128,6 +137,7 @@ Category.prototype.debates = function () { function Document(obj = {}) { Entity.call(this, obj); + this.type = DebateType.BASIC; } Document.prototype.attrs = { id: Number, @@ -137,6 +147,10 @@ Document.prototype.attrs = { content: String, debatesCount: Number, lastCommentDate: Date, + type: String, + meshLine: Number, + meshColumn: Number, + mapLink: String, }; Document.prototype.oneToMany = { debates: [Debate, "document"], @@ -145,8 +159,13 @@ Document.prototype.manyToOne = { category: [Category, "documents"], }; +Document.prototype.is = function (type) { + return DebateType._value[this.type] == DebateType._value[type]; +} + function Debate(obj = {}) { Entity.call(this, obj); + this.type = DebateType.BASIC; } Debate.prototype.attrs = { id: Number, @@ -162,6 +181,7 @@ Debate.prototype.attrs = { reformulationCheck: Boolean, idfixLink: Boolean, openPublic: Boolean, + type: String, }; Debate.prototype.oneToMany = { comments: [Comment, "debate"], @@ -181,6 +201,9 @@ Debate.prototype.deepSortComments = function (sortFunction) { this.comments[i].deepSortComments(sortFunction); } }; +Debate.prototype.is = function (type) { + return DebateType._value[this.type] == DebateType._value[type]; +} function Comment(obj = {}) { Entity.call(this, obj);