Skip to content

Commit

Permalink
Merge pull request #23 from philippebeck/dev
Browse files Browse the repository at this point in the history
Release 0.17.0
  • Loading branch information
philippebeck authored Feb 8, 2023
2 parents 4e07847 + de4a374 commit 7544ece
Show file tree
Hide file tree
Showing 15 changed files with 199 additions and 38 deletions.
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright {yyyy} {name of copyright owner}
Copyright 2023 Philippe Beck

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
8 changes: 4 additions & 4 deletions api/controller/LinkCtrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ exports.createLink = (req, res, next) => {
return;
}

if (!nem.checkUrl(fields.url)) {
/*if (!nem.checkUrl(fields.url)) {
return res.status(401).json({ message: process.env.LINK_URL });
}
}*/

let link = new LinkModel(fields);

Expand All @@ -66,9 +66,9 @@ exports.updateLink = (req, res, next) => {
return;
}

if (!nem.checkUrl(fields.url)) {
/*if (!nem.checkUrl(fields.url)) {
return res.status(401).json({ message: process.env.LINK_URL });
}
}*/

LinkModel
.updateOne({ _id: req.params.id }, { ...fields, _id: req.params.id })
Expand Down
15 changes: 11 additions & 4 deletions constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ export default {

/* VESAN */

CAT_ARTICLE: "News",
CAT_LINK: "HTML5",
CAT_PRODUCT: "Home",

CATS_ARTICLE : [
"Transportation",
"Business",
Expand Down Expand Up @@ -70,13 +74,16 @@ export default {
"Sports",
],

CHECK_AVAILABLE : " is not available !",
CHECK_REFERENCE : " is already referenced !",

FORGOT_CONFIRM : "Do you confirm sending a new password ?",
FORGOT_SUBJECT : "New Password",
FORGOT_TEXT : "This is your new Password, keep it safe : ",

ROLES_USER : [
"admin",
"author",
"user"
],

FORGOT_CONFIRM : "Do you confirm sending a new password ?",
FORGOT_SUBJECT : "New Password",
FORGOT_TEXT : "This is your new Password, keep it safe : ",
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vesan",
"version": "0.16.0",
"version": "0.17.0",
"description": "CMS with Vue-Elt, Servidio, Animadio & NemJS",
"keywords": [
"cms",
Expand Down
6 changes: 4 additions & 2 deletions src/components/connectors/SignUp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@
</template>

<script>
import constants from "/constants";
export default {
name: "CreateUser",
Expand Down Expand Up @@ -123,12 +125,12 @@ export default {
for (let i = 0; i < users.length; i++) {
if (users[i].name === this.name) {
alert(this.name + " is not available !");
alert(this.name + constants.CHECK_AVAILABLE);
isReferenced = true;
}
if (users[i].email === this.email) {
alert(this.email + " is already referenced !");
alert(this.email + constants.CHECK_REFERENCE);
isReferenced = true;
}
}
Expand Down
11 changes: 7 additions & 4 deletions src/components/creators/CreateArticle.vue
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
Category
</template>
<template #label>

Choose the article category
</template>
</FieldElt>
</template>
Expand Down Expand Up @@ -133,8 +133,11 @@ export default {
*/
validateNewArticle() {
if (this.$serve.checkName(this.title)) {
if (typeof document.getElementById('article-image').files[0] !== "undefined") {
if (this.cat === "") {
this.cat = constants.CAT_ARTICLE;
}
this.checkNewArticle();
} else {
Expand All @@ -154,12 +157,12 @@ export default {
for (let i = 0; i < articles.length; i++) {
if (articles[i].title === this.title) {
alert(this.title + " is not available !");
alert(this.title + constants.CHECK_AVAILABLE);
isReferenced = true;
}
if (articles[i].text === this.text) {
alert(this.text + " is already referenced !");
alert(this.text + constants.CHECK_REFERENCE);
isReferenced = true;
}
}
Expand Down
16 changes: 9 additions & 7 deletions src/components/creators/CreateLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
Category
</template>
<template #label>
Choose Dev if others are not suitable
Choose the link category
</template>
</FieldElt>
</template>
Expand Down Expand Up @@ -91,36 +91,38 @@ export default {
* VALIDATE NEW LINK IF DATA ARE VALID
*/
validateNewLink() {
if (this.$serve.checkName(this.name) &&
this.$serve.checkUrl(this.url)) {
if (this.$serve.checkName(this.name) /*&&
this.$serve.checkUrl(this.url)*/) {
if (this.cat === "") {
this.cat = "HTML5";
this.cat = constants.CAT_LINK;
}
this.checkNewLink();
}
},
/**
* CHECK NEW LINK IF NAME | URL ARE REFERENCED
*/
checkNewLink() {
this.$serve.getData("/api/links")
.then((links) => {
let isReferenced = false;
this.url = this.url.split("//")[1];
for (let i = 0; i < links.length; i++) {
if (links[i].name === this.name) {
alert(this.name + " is not available !");
alert(this.name + constants.CHECK_AVAILABLE);
isReferenced = true;
}
if (links[i].url === this.url) {
alert(this.url + " is already referenced !");
alert(this.url + constants.CHECK_REFERENCE);
isReferenced = true;
}
}
this.createLink(isReferenced);
})
.catch(err => { console.log(err) });
},
/**
* CREATE LINK IF NO INFO IS REFERENCED
* @param {boolean} isReferenced
Expand Down
11 changes: 7 additions & 4 deletions src/components/creators/CreateProduct.vue
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@
Category
</template>
<template #label>

Choose the product category
</template>
</FieldElt>
</template>
Expand Down Expand Up @@ -169,8 +169,11 @@ export default {
*/
validateNewProduct() {
if (this.$serve.checkName(this.name)) {
if (typeof document.getElementById('product-image').files[0] !== "undefined") {
if (this.cat === "") {
this.cat = constants.CAT_PRODUCT;
}
this.checkNewProduct();
} else {
Expand All @@ -190,12 +193,12 @@ export default {
for (let i = 0; i < products.length; i++) {
if (products[i].name === this.name) {
alert(this.name + " is not available !");
alert(this.name + constants.CHECK_AVAILABLE);
isReferenced = true;
}
if (products[i].description === this.description) {
alert(this.description + " is already referenced !");
alert(this.description + constants.CHECK_REFERENCE);
isReferenced = true;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/managers/ListArticles.vue
Original file line number Diff line number Diff line change
Expand Up @@ -182,12 +182,12 @@ export default {
}
if (articles[j] && articles[j].title === this.articles[i].title) {
alert(this.articles[i].title + " is not available !");
alert(this.articles[i].title + constants.CHECK_AVAILABLE);
isReferenced = true;
}
if (articles[j] && articles[j].text === this.articles[i].text) {
alert(this.articles[i].text+ " is already referenced !");
alert(this.articles[i].text+ constants.CHECK_REFERENCE);
isReferenced = true;
}
}
Expand Down Expand Up @@ -244,7 +244,7 @@ export default {
articleTitle = this.articles[i].title;
}
}
if (confirm(`Delete ${articleTitle} ?`) === true) {
this.$serve.deleteData(`/api/articles/${id}`)
.then(() => {
Expand Down
1 change: 1 addition & 0 deletions src/components/managers/ListComments.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ export default {
*/
deleteComment(id) {
if (confirm(`Delete comment #${id} ?`) === true) {
this.$serve.deleteData(`/api/comments/${id}`)
.then(() => {
alert(`Comment #${id} deleted !`);
Expand Down
9 changes: 7 additions & 2 deletions src/components/managers/ListLinks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ export default {
validateUpdatedLink(id) {
for (let i = 0; i < this.links.length; i++ ) {
if (this.links[i]._id === id) {
if (this.$serve.checkName(this.links[i].name) &&
this.$serve.checkUrl(`https://${this.links[i].url}`)) {
this.checkUpdatedLink(i);
Expand All @@ -119,16 +120,19 @@ export default {
this.$serve.getData("/api/links")
.then((links) => {
let isReferenced = false;
for (let j = 0; j < links.length; j++) {
if (links[j]._id === this.links[i]._id) {
links.splice(j, 1);
}
if (links[j] && links[j].name === this.links[i].name) {
alert(this.links[i].name + " is not available !");
alert(this.links[i].name + constants.CHECK_AVAILABLE);
isReferenced = true;
}
if (links[j] && links[j].url === this.links[i].url) {
alert(this.links[i].url+ " is already referenced !");
alert(this.links[i].url+ constants.CHECK_REFERENCE);
isReferenced = true;
}
}
Expand Down Expand Up @@ -170,6 +174,7 @@ export default {
linkName = this.links[i].name;
}
}
if (confirm(`Delete ${linkName} ?`) === true) {
this.$serve.deleteData(`/api/links/${id}`)
.then(() => {
Expand Down
1 change: 1 addition & 0 deletions src/components/managers/ListOrders.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ export default {
*/
deleteOrder(id) {
if (confirm(`Delete order #${id} ?`) === true) {
this.$serve.deleteData(`/api/orders/${id}`)
.then(() => {
alert(`Order #${id} deleted !`);
Expand Down
4 changes: 2 additions & 2 deletions src/components/managers/ListProducts.vue
Original file line number Diff line number Diff line change
Expand Up @@ -190,12 +190,12 @@ export default {
}
if (products[j] && products[j].name === this.products[i].name) {
alert(this.products[i].name + " is not available !");
alert(this.products[i].name + constants.CHECK_AVAILABLE);
isReferenced = true;
}
if (products[j] && products[j].description === this.products[i].description) {
alert(this.products[i].description+ " is already referenced !");
alert(this.products[i].description+ constants.CHECK_REFERENCE);
isReferenced = true;
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/managers/ListUsers.vue
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ export default {
}
if (users[j] && users[j].name === this.users[i].name) {
alert(this.users[i].name + " is not available !");
alert(this.users[i].name + constants.CHECK_AVAILABLE);
isReferenced = true;
}
if (users[j] && users[j].email === this.users[i].email) {
alert(this.users[i].email+ " is already referenced !");
alert(this.users[i].email+ constants.CHECK_REFERENCE);
isReferenced = true;
}
}
Expand Down Expand Up @@ -237,7 +237,7 @@ export default {
userName = this.users[i].name;
}
}
if (confirm(`Delete ${userName} ?`) === true) {
this.$serve.deleteData(`/api/users/${id}`)
.then(() => {
Expand Down
Loading

0 comments on commit 7544ece

Please sign in to comment.