diff --git a/api/controllers/users.js b/api/controllers/users.js index 80b8747..df08d58 100644 --- a/api/controllers/users.js +++ b/api/controllers/users.js @@ -14,6 +14,7 @@ const Favorites = require('.. const Functions = require('../models/functions'); const Categories = require('../models/categories'); const Comments = require('../models/comments'); +const Quotes = require('../models/quotes'); const deleteFilesNameStartWith = require('../assets/utils/deleteFilesNameStartWith'); async function handleEditUser(res, { name, email, biography, isPublicEmail }, userId, logoName) { @@ -221,16 +222,18 @@ exports.getUserInfo = async (req, res, next) => { where: { userId: user.id }, include: [ { model: Functions, attributes: { exclude: ["updatedAt", "utilizationForm", "article", "isOnline"] }, include: { model: Categories, attributes: ["name", "color"] } } - ] + ], + order: [['createdAt', 'DESC']], + limit: 5 }); const favoritesArray = favorites.map((favorite) => favorite.function); const comments = await Comments.findAll({ - limit: 10, where: { userId: user.id }, include: [ { model: Functions, attributes: { exclude: ["updatedAt", "utilizationForm", "article", "isOnline"] } } ], - order: [['createdAt', 'DESC']] + order: [['createdAt', 'DESC']], + limit: 5 }); const commentsArray = comments.map((commentObject) => { return { @@ -240,6 +243,14 @@ exports.getUserInfo = async (req, res, next) => { function: commentObject.function.dataValues }; }); + const quotesArray = await Quotes.findAll({ + where: { userId: user.id }, + attributes: { + exclude: ["updatedAt", "createdAt", "isValidated", "userId", "id"] + }, + order: [['createdAt', 'DESC']], + limit: 5, + }); const userObject = { // Si Public Email ... (user.isPublicEmail) && { email: user.email }, @@ -249,7 +260,8 @@ exports.getUserInfo = async (req, res, next) => { logo: user.logo, createdAt: user.createdAt, favoritesArray, - commentsArray + commentsArray, + quotesArray }; return res.status(200).json(userObject); } catch (error) { diff --git a/website/components/FunctionCard/FunctionCard.js b/website/components/FunctionCard/FunctionCard.js index b3575e5..2856bce 100644 --- a/website/components/FunctionCard/FunctionCard.js +++ b/website/components/FunctionCard/FunctionCard.js @@ -39,7 +39,7 @@ const FunctionCard = forwardRef((props, ref) => {
{props.description}
+{props.description}
{props.categorie.name}
diff --git a/website/pages/admin/manageCategories.js b/website/pages/admin/manageCategories.js index 6e01c84..4d535fd 100644 --- a/website/pages/admin/manageCategories.js +++ b/website/pages/admin/manageCategories.js @@ -135,28 +135,28 @@ const manageCategories = (props) => {id | -name | -color | -createdAt | -updatedAt | -Modifier | -Supprimer | +id | +name | +color | +createdAt | +updatedAt | +Modifier | +Supprimer | |||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
{category.id} | -{category.name} | -{category.color} | -{date.format(new Date(category.createdAt), 'DD/MM/YYYY à HH:mm', true)} | -{date.format(new Date(category.updatedAt), 'DD/MM/YYYY à HH:mm', true)} | +{category.id} | +{category.name} | +{category.color} | +{date.format(new Date(category.createdAt), 'DD/MM/YYYY à HH:mm', true)} | +{date.format(new Date(category.updatedAt), 'DD/MM/YYYY à HH:mm', true)} | handleEditCategory({ name: category.name, color: category.color, id: category.id })}>
|
diff --git a/website/pages/admin/manageQuotes.js b/website/pages/admin/manageQuotes.js
index 997998d..5b8aefd 100644
--- a/website/pages/admin/manageQuotes.js
+++ b/website/pages/admin/manageQuotes.js
@@ -67,32 +67,32 @@ const manageQuotes = (props) => {
Citation/Proverbe | -Auteur | -Proposée par | -Valider | -Supprimer | +Citation/Proverbe | +Auteur | +Proposée par | +Valider | +Supprimer | {currentQuote.quote} | -{currentQuote.author} | -+ | {currentQuote.quote} | +{currentQuote.author} | +{currentQuote.user.name} | -handleValidationQuote(currentQuote.id, true)} className="Admin__table-row text-center" style={{ cursor: 'pointer' }}> + | handleValidationQuote(currentQuote.id, true)} className="table-row text-center" style={{ cursor: 'pointer' }}>
|
- handleValidationQuote(currentQuote.id, false)} className="Admin__table-row text-center" style={{ cursor: 'pointer' }}> + | handleValidationQuote(currentQuote.id, false)} className="table-row text-center" style={{ cursor: 'pointer' }}>
|
---|
Citation/Proverbe | +Auteur | +
---|---|
{currentQuote.quote} | +{currentQuote.author} | +