From 66d5b3d533222c2d6e2c38f69798f93b1caf2597 Mon Sep 17 00:00:00 2001 From: Bilal Date: Wed, 27 Mar 2024 22:25:55 +0100 Subject: [PATCH] $ --- src/api/index.js | 1 + src/api/items.js | 20 + src/components/AddBtn/AddBtn.jsx | 11 + src/components/AddBtn/AddBtn.scss | 19 + src/pages/room/Room.jsx | 149 +- src/pages/room/Room.scss | 147 ++ test.json | 2355 +++++++++++++++++++++++++++++ 7 files changed, 2690 insertions(+), 12 deletions(-) create mode 100644 src/api/items.js create mode 100644 src/components/AddBtn/AddBtn.jsx create mode 100644 src/components/AddBtn/AddBtn.scss create mode 100644 test.json diff --git a/src/api/index.js b/src/api/index.js index 5576b75..c346bc7 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,3 +1,4 @@ export * from "./authentication"; export * from "./user"; export * from "./rooms"; +export * from "./items"; diff --git a/src/api/items.js b/src/api/items.js new file mode 100644 index 0000000..8b85f4f --- /dev/null +++ b/src/api/items.js @@ -0,0 +1,20 @@ +import axios from "axios"; + +export const createItem = async (settings) => { + console.log(settings); + + const formData = new FormData(); + formData.append("room", settings.room); + formData.append("brand", settings.brand); + formData.append("model", settings.model); + formData.append("price", settings.price); + formData.append("purchaseDate", settings.purchaseDate); + formData.append("link", settings.link); + formData.append("description", settings.description); + formData.append("image", settings.image); + formData.append("invoice", settings.invoice); + + const response = await axios.post("/item", formData); + + return response.data; +}; diff --git a/src/components/AddBtn/AddBtn.jsx b/src/components/AddBtn/AddBtn.jsx new file mode 100644 index 0000000..a62dd4e --- /dev/null +++ b/src/components/AddBtn/AddBtn.jsx @@ -0,0 +1,11 @@ +import "./AddBtn.scss"; + +export default function AddBtn({ handle }) { + return ( +
+ +
+ ); +} diff --git a/src/components/AddBtn/AddBtn.scss b/src/components/AddBtn/AddBtn.scss new file mode 100644 index 0000000..4739087 --- /dev/null +++ b/src/components/AddBtn/AddBtn.scss @@ -0,0 +1,19 @@ +.add-btn-container { + display: flex; + position: absolute; + bottom: 20px; + right: 20px; + width: 45px; + height: 45px; + + .add-btn { + width: 100%; + height: 100%; + border-radius: 50px; + border: none; + background: rgb(123, 106, 156); + color: white; + font-weight: bold; + font-size: 15px; + } +} diff --git a/src/pages/room/Room.jsx b/src/pages/room/Room.jsx index 65b1705..7b5bbe1 100644 --- a/src/pages/room/Room.jsx +++ b/src/pages/room/Room.jsx @@ -1,21 +1,146 @@ import { useParams } from "react-router-dom"; import { useState, useEffect } from "react"; import { getRoom } from "../../api"; +import "./Room.scss"; +import AddBtn from "../../components/AddBtn/AddBtn"; +import { createItem } from "../../api/"; export default function Room() { - const { id } = useParams(); - const [data, setData] = useState(); + const { id } = useParams(); + const [data, setData] = useState({}); + const [isInForm, setInForm] = useState(false); - useEffect(() => { - getRoom(id).then((res) => { - setData(res); - console.log(res); - }); - }, []); + useEffect(() => { + getRoom(id).then((res) => { + console.log(res); + setData(res); + }); + }, []); - return ( -
- Piece n{id} + const handleForm = () => { + setInForm(!isInForm); + }; + + const handleSubmit = (e) => { + try { + const settings = {}; + settings.brand = e.target[0].value; + settings.model = e.target[1].value; + settings.price = e.target[2].value; + settings.purchaseDate = e.target[3].value; + settings.link = e.target[4].value; + settings.description = e.target[5].value; + settings.room = id; + settings.image = e.target[6].files[0]; + settings.invoice = e.target[7].files[0]; + + createItem(settings).then((res) => { + console.log(res); + }); + + handleForm(); + } catch (err) { + alert("Quelque chose cloche avec le formulaire ..."); + console.log(err); + } + }; + + return ( +
+ {data.name ? ( +
+ + {data.name} +
- ); + ) : null} + + {data.items && data.items.length > 0 ? ( +
+ {data.items.map((e, i) => ( +
+
+ Marque  + + {e.brand} + +
+ +
+ Modele  + + {e.model} + +
+ + {e.image ? ( +
+ coucou +
+ ) : ( + Pas d'Image + )} + +
+ Description +  {e.description} +
+ +
+ Montant +  {e.price}$ +
+ +
+ Date d'achat + + {new Date(e.purchaseDate).toDateString()} + +
+
+ ))} +
+ ) : ( +
+ Cette piece ne contient pas d'objet. +
+ )} + + {isInForm && ( +
+ Creation d'item + +
+ +
+ +
+ + + + + + + + + +
+ + +
+
+
+ )} + + +
+ ); } diff --git a/src/pages/room/Room.scss b/src/pages/room/Room.scss index e69de29..0294fd3 100644 --- a/src/pages/room/Room.scss +++ b/src/pages/room/Room.scss @@ -0,0 +1,147 @@ +#room-container { + display: flex; + flex-direction: column; + width: 100%; + height: 100%; + + #items-container { + margin-top: 20px; + width: 100%; + height: 100%; + display: flex; + flex-direction: row; + flex-wrap: wrap; + gap: 20px; + justify-content: center; + align-items: center; + + .item-container { + padding: 10px; + gap: 10px; + border: 1px dashed rgb(54, 54, 54); + width: 340px; + height: 340px; + display: flex; + flex-direction: column; + overflow: auto; + + .item-brand-container { + text-align: center; + .item-brand { + color: black; + font-weight: bold; + } + } + + .item-model-container { + text-align: center; + gap: 5px; + + .item-model { + color: black; + font-weight: bold; + } + } + + .item-image-container { + width: 200px; + height: auto; + .item-image { + width: 100%; + } + } + + .item-no-img { + } + + .item-description-container { + display: flex; + width: 100%; + gap: 5px; + + .item-description { + color: black; + font-weight: bold; + } + } + + .item-price-container { + display: flex; + width: 100%; + gap: 5px; + + .item-price { + font-weight: bold; + } + } + + .item-buy-date-container { + display: flex; + width: 100%; + gap: 5px; + + .item-buy-date { + font-weight: bold; + } + } + } + } + + #form-container { + border: 1px solid black; + width: 300px; + height: 400px; + display: flex; + flex-direction: column; + position: relative; + gap: 20px; + padding: 20px; + + #form-closure-container { + position: absolute; + top: 0px; + right: 0; + width: 20px; + height: 20px; + + #form-closure { + width: 100%; + height: 100%; + border: none; + + &:hover { + background: red; + cursor: pointer; + color: white; + font-weight: bold; + } + } + } + + #form { + display: flex; + flex-direction: column; + gap: 15px; + + #actions { + display: flex; + flex-direction: row; + flex-wrap: wrap; + gap: 10px; + justify-content: center; + align-items: center; + + .actions-btn { + } + } + } + } + + #room-title-container { + margin-top: 20px; + text-align: center; + + #room-title { + } + } +} diff --git a/test.json b/test.json new file mode 100644 index 0000000..dabbfab --- /dev/null +++ b/test.json @@ -0,0 +1,2355 @@ +bilal +bilaaaaaaaaaal +Ne pas déranger +dans:#documents +GODMICHELLE DE L'INTELLIGENCE — 17/10/2022 22: 50 +Tout +Lion Mentality — 17/10/2022 22: 51 +sauf les threads +GODMICHELLE DE L'INTELLIGENCE — 17/10/2022 23: 00 +Sauf Simon, le prof a dit qu’il devait réviser tout depuis l’année dernière (je cite) : « Ce gros fdp de Simon qui se permet de voler la place de ses camarades innocents durant les longues sessions de CM chiante sa mère seras interrogé sur tous ses cours de SCR depuis son entrée a l’IUT Sénart Fontainebleau (campus Fontainebleau), soit tout ce qui a été vu depuis l’année dernière » +Mr Sim — 17/10/2022 23: 04 +ok merci +mais quand je sais même plus ce qu'on a foutu l'année dernière ça part mal x) +je sais just qu'il y a le globbing à réviser +il a pas une diapo avec les trucs à réviser sur son git ? je cherche mais j'ai pas trouvé +j'avais pas pris de photo en pensant pouvoir la retrouver justement +Théo — 18/10/2022 06: 15 +https: //dwarves.iut-fbleau.fr/gitiut/monnerat/BUTFI2-R3.05/src/branch/master/cours +Gitea: Git with a cup of tea +BUTFI2-R3.05 +Progammation système +Image +ça ? +Virus — 08/11/2022 19: 37 +des recherches sur leboncoin ? +Mr Sim — 08/11/2022 21: 32 +askip +Mr Sim — 27/02/2024 14: 31 +@FelixLgr +FelixLgr — 27/02/2024 14: 31 +Type de fichier joint : acrobat +Introduction_JS.pdf +672.90 KB +FelixLgr — 27/02/2024 14: 43 +const pizzas = [ + {name: "queen", ingredients: [ + "🐷", + "🍄", + "🍅", + "🧀" + ] + }, + {name: "cheese", ingredients: [ + "🧀", + "🍅" + ] + }, + {name: "oriental", ingredients: [ + "🍅", + "🐑", + "🍄", + "🌶" + ] + }, + {name: "royal", ingredients: [ + "🍅", + "🌵", + "🍄" + ] + }, + {name: "hawaïenne", ingredients: [ + "🍍", + "🍅", + "🐷", + "🧀" + ] + } +]; +const prices = new Map([ + [ + "🍅", + 1 + ], + [ + "🐷", + 2 + ], + [ + "🌶", + 2 + ], + [ + "🍄", + 5 + ], + [ + "🧀", + 5 + ], + [ + "🐑", + 2 + ], + [ + "🌵", + 10 + ] +]); +Type de fichier joint : acrobat +Intro.pdf +653.89 KB +FelixLgr — 28/02/2024 14: 27 +Type de fichier joint : acrobat +Introduction_React.pdf +950.40 KB +Mr Sim — 29/02/2024 14: 59 +@Maxime +Maxime — 29/02/2024 15: 19 +Type de fichier joint : acrobat +cours1.pdf +134.33 KB +FelixLgr — 02/03/2024 21: 07 +Voici le WeTransfer avec les corrections des exercices vus en cours mardi et mercredi: https: //we.tl/t-x6qRvXTQKQ. Bonne fin de weekend +Grimortel — 07/03/2024 09: 28 +Merci +FelixLgr — 07/03/2024 09: 32 +Type de fichier joint : acrobat +04-introduction-react.pdf +319.39 KB +{ + "info": { + "_postman_id": "b40f6440-9ac1-47c7-ab36-d67fd439b7ef", + "name": "ProjetBut3", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "11504690" + }, + "item": [ + { + "name": "Auth", + "item": [ + { + "name": "Is Logged in", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}/authenticate", + "host": [ + "{{url}}" + ], + "path": [ + "authenticate" + ] + } + }, + "response": [ + { + "name": "Success", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}/authenticate", + "host": [ + "{{url}}" + ], + "path": [ + "authenticate" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Set-Cookie", + "value": "auth-token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MWRkZTc0OTRiOWVhMjRhZjc3NjE0Y2IiLCJ1c2VybmFtZSI6Ikx1Y2FzU3RibnIiLCJwZXJtaXNzaW9uIjoxLCJjcmVhdGVEYXRlIjoiMTY0MTkzMjQ4Nzc1MCIsIl9fdiI6MCwiaWF0IjoxNjY0NDc2ODYzfQ.8vLLLmXaHoXNKwm-pQtxJAPm6JG_8a_lyx8UlGYxM1w; Max-Age=2678400; Path=/; Expires=Sun, 30 Oct 2022 18:42:27 GMT" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "422" + }, + { + "key": "ETag", + "value": "W/\"1a6-u+66Y2/w0F1cFWHGkAcFdIfR3pY\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:42:27 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": true,\n \"data\": {\n \"user\": {\n \"_id\": \"61dde7494b9ea24af77614cb\",\n \"username\": \"LucasStbnr\",\n \"permission\": 1,\n \"createDate\": \"1641932487750\",\n \"__v\": 0,\n \"iat\": 1664476863,\n \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MWRkZTc0OTRiOWVhMjRhZjc3NjE0Y2IiLCJ1c2VybmFtZSI6Ikx1Y2FzU3RibnIiLCJwZXJtaXNzaW9uIjoxLCJjcmVhdGVEYXRlIjoiMTY0MTkzMjQ4Nzc1MCIsIl9fdiI6MCwiaWF0IjoxNjY0NDc2ODYzfQ.8vLLLmXaHoXNKwm-pQtxJAPm6JG_8a_lyx8UlGYxM1w\"\n }\n }\n}" + }, + { + "name": "Invalid token", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}/authenticate", + "host": [ + "{{url}}" + ],... (29 Ko restants) +Réduire +ProjetBut3.postman_collection.json +79 Ko +Mr Sim — 07/03/2024 09: 41 +Merci beaucoup ! +FelixLgr — 07/03/2024 12: 14 +mongodb+srv: //legrellefbleau:XF0W9UDXuDTydjhZ@cluster0.vjph7wn.mongodb.net/2024-project +FelixLgr — 07/03/2024 13: 25 +Maxime aura un peu de retard +Grimortel — 07/03/2024 13: 45 +Ok merci pour +L'info +Maxime — 07/03/2024 14: 29 +Type de fichier joint : acrobat +playwright.pdf +73.46 KB +Mr Sim — 07/03/2024 14: 30 +merci +Grimortel — 07/03/2024 14: 35 +Merci +Théo — 07/03/2024 16: 40 +@BUT 3 EXPLICATIONS PROJET dans moins de 3 minutes +Gunchap — 07/03/2024 16: 41 +Merci +Théo — 07/03/2024 16: 42 +dr man +FelixLgr — 14/03/2024 17: 54 +Bonjour @BUT 3 (désolé du tag), je vous avais dit que je vous montrerais comment lancer votre projet en local (j'avais oublié). Soit vous regardez la vidéo, soit vous suivez les étapes suivantes : + +Allez dans votre dépôt de projet. +Lancez npm i pour installer les dépendances (si ce n'est pas déjà fait). +Copiez les variables d'environnement avec cp .env.example .env. +Mettez https: //but-3-dev-project-back.onrender.com/api dans VITE_API_URL. +Lancez votre projet avec npm run dev. +Have fun! +meuh — 14/03/2024 18: 06 +Merce +Mr Sim — 14/03/2024 18: 07 +Merci ! +Sky — 15/03/2024 13: 27 +Normalement c’est censé s’afficher oui @Guy 3 lettres +FelixLgr — 15/03/2024 18: 38 +2 styles différents, mais vous pouvez faire comme vous avez envie +Image +Image +Image +Image +Image +Image +FelixLgr — 15/03/2024 18: 39 +n'hésite pas a faire un console.log de user pour voir ce qu'il contient. Peut être qu'il faut faire user.user 👀 +FelixLgr — 25/03/2024 17: 31 +Bonjour, ayant un imprévu demain le cours de demain matin sera à distance (https: //calendar.app.google/nN1LbK7Afe9fNoU17) et le cours de demain après midi est décalé a mercredi matin +Dev 6.1 mardi 26 • Tuesday, March 26 • 3: 45 – 7: 15 AM • View detail... +Image +Théo — 25/03/2024 18: 35 +@BUT 3 +FelixLgr — Hier à 08: 59 +Séance projet ce matin @BUT 3 . Je reste disponible sur Google Meet si vous avez des questions ou besoin d'aide. Demain, nous essayerons de dev ensemble la partie concernant la modification d'un utilisateur avec du TDD. +FelixLgr — Hier à 09: 23 +création d'un item avec une image et un pdf +Image +FelixLgr — Aujourd’hui à 08: 03 +J’aurai 5 minutes de retard, ceux qui arrivent à l’heure, merci de regarder si la salle est ouverte. Sinon est-ce que vous pouvez demander de l’ouvrir + +{ + "info": { + "_postman_id": "b40f6440-9ac1-47c7-ab36-d67fd439b7ef", + "name": "ProjetBut3", + "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", + "_exporter_id": "11504690" + }, + "item": [ + { + "name": "Auth", + "item": [ + { + "name": "Is Logged in", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}/authenticate", + "host": [ + "{{url}}" + ], + "path": [ + "authenticate" + ] + } + }, + "response": [ + { + "name": "Success", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}/authenticate", + "host": [ + "{{url}}" + ], + "path": [ + "authenticate" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Set-Cookie", + "value": "auth-token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MWRkZTc0OTRiOWVhMjRhZjc3NjE0Y2IiLCJ1c2VybmFtZSI6Ikx1Y2FzU3RibnIiLCJwZXJtaXNzaW9uIjoxLCJjcmVhdGVEYXRlIjoiMTY0MTkzMjQ4Nzc1MCIsIl9fdiI6MCwiaWF0IjoxNjY0NDc2ODYzfQ.8vLLLmXaHoXNKwm-pQtxJAPm6JG_8a_lyx8UlGYxM1w; Max-Age=2678400; Path=/; Expires=Sun, 30 Oct 2022 18:42:27 GMT" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "422" + }, + { + "key": "ETag", + "value": "W/\"1a6-u+66Y2/w0F1cFWHGkAcFdIfR3pY\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:42:27 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": true,\n \"data\": {\n \"user\": {\n \"_id\": \"61dde7494b9ea24af77614cb\",\n \"username\": \"LucasStbnr\",\n \"permission\": 1,\n \"createDate\": \"1641932487750\",\n \"__v\": 0,\n \"iat\": 1664476863,\n \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MWRkZTc0OTRiOWVhMjRhZjc3NjE0Y2IiLCJ1c2VybmFtZSI6Ikx1Y2FzU3RibnIiLCJwZXJtaXNzaW9uIjoxLCJjcmVhdGVEYXRlIjoiMTY0MTkzMjQ4Nzc1MCIsIl9fdiI6MCwiaWF0IjoxNjY0NDc2ODYzfQ.8vLLLmXaHoXNKwm-pQtxJAPm6JG_8a_lyx8UlGYxM1w\"\n }\n }\n}" + }, + { + "name": "Invalid token", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}/authenticate", + "host": [ + "{{url}}" + ], + "path": [ + "authenticate" + ] + } + }, + "status": "Bad Request", + "code": 400, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "41" + }, + { + "key": "ETag", + "value": "W/\"29-k0YzYkgwBJyjAUq/gPAxv4/BSno\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:39:39 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"error\": \"Invalid token\"\n}" + } + ] + }, + { + "name": "Login", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}\",\n \"password\": \"{{password}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/authenticate", + "host": [ + "{{url}}" + ], + "path": [ + "authenticate" + ] + } + }, + "response": [ + { + "name": "Success", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}\",\n \"password\": \"{{password}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/authenticate", + "host": [ + "{{url}}" + ], + "path": [ + "authenticate" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Set-Cookie", + "value": "auth-token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MWRkZTc0OTRiOWVhMjRhZjc3NjE0Y2IiLCJ1c2VybmFtZSI6Ikx1Y2FzU3RibnIiLCJwZXJtaXNzaW9uIjoxLCJjcmVhdGVEYXRlIjoiMTY0MTkzMjQ4Nzc1MCIsIl9fdiI6MCwiaWF0IjoxNjY0NDc2ODYzfQ.8vLLLmXaHoXNKwm-pQtxJAPm6JG_8a_lyx8UlGYxM1w; Max-Age=2678400; Path=/; Expires=Sun, 30 Oct 2022 18:41:03 GMT" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "405" + }, + { + "key": "ETag", + "value": "W/\"195-fRMX8gcPzq54EhuK8H9mI0wE4L4\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:41:03 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": true,\n \"data\": {\n \"user\": {\n \"_id\": \"61dde7494b9ea24af77614cb\",\n \"username\": \"LucasStbnr\",\n \"permission\": 1,\n \"createDate\": \"1641932487750\",\n \"__v\": 0,\n \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MWRkZTc0OTRiOWVhMjRhZjc3NjE0Y2IiLCJ1c2VybmFtZSI6Ikx1Y2FzU3RibnIiLCJwZXJtaXNzaW9uIjoxLCJjcmVhdGVEYXRlIjoiMTY0MTkzMjQ4Nzc1MCIsIl9fdiI6MCwiaWF0IjoxNjY0NDc2ODYzfQ.8vLLLmXaHoXNKwm-pQtxJAPm6JG_8a_lyx8UlGYxM1w\"\n }\n }\n}" + }, + { + "name": "Some data is missing", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/authenticate", + "host": [ + "{{url}}" + ], + "path": [ + "authenticate" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "48" + }, + { + "key": "ETag", + "value": "W/\"30-nNyV/zh7KoZJ/YQEL1n2BAYYegg\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:40:27 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"error\": \"Some data is missing\"\n}" + }, + { + "name": "Username or password incorrect", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}\",\n \"password\": \"{{password}}a\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/authenticate", + "host": [ + "{{url}}" + ], + "path": [ + "authenticate" + ] + } + }, + "status": "Unauthorized", + "code": 401, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "58" + }, + { + "key": "ETag", + "value": "W/\"3a-sSlZVKZumQTe4aHOCHN+oeI/mfI\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:40:45 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"error\": \"Username or password incorrect\"\n}" + } + ] + }, + { + "name": "Logout", + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{url}}/authenticate", + "host": [ + "{{url}}" + ], + "path": [ + "authenticate" + ] + } + }, + "response": [ + { + "name": "Success", + "originalRequest": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{url}}/authenticate", + "host": [ + "{{url}}" + ], + "path": [ + "authenticate" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Set-Cookie", + "value": "auth-token=; Max-Age=-1; Path=/; Expires=Thu, 29 Sep 2022 18:42:52 GMT" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "16" + }, + { + "key": "ETag", + "value": "W/\"10-oV4hJxRVSENxc/wX8+mA4/Pe4tA\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:42:52 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": true\n}" + }, + { + "name": "Access denied", + "originalRequest": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{url}}/authenticate", + "host": [ + "{{url}}" + ], + "path": [ + "authenticate" + ] + } + }, + "status": "Unauthorized", + "code": 401, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "41" + }, + { + "key": "ETag", + "value": "W/\"29-61tmotkmnTwCcsouQR5Cq0D5ggA\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:43:03 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"error\": \"Access denied\"\n}" + } + ] + } + ] + }, + { + "name": "User", + "item": [ + { + "name": "Get user", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}/user", + "host": [ + "{{url}}" + ], + "path": [ + "user" + ], + "query": [ + { + "key": "_id", + "value": "61dde7494b9ea24af77614ca", + "disabled": true + }, + { + "key": "username", + "value": "", + "disabled": true + }, + { + "key": "permission", + "value": "", + "disabled": true + } + ] + } + }, + "response": [ + { + "name": "Success", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}/user", + "host": [ + "{{url}}" + ], + "path": [ + "user" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "146" + }, + { + "key": "ETag", + "value": "W/\"92-wRAzofKjhlngUs0uju+BzbVbcBY\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:44:02 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": true,\n \"data\": {\n \"users\": [\n {\n \"_id\": \"61dde7494b9ea24af77614cb\",\n \"username\": \"LucasStbnr\",\n \"permission\": 1,\n \"createDate\": \"1641932487750\",\n \"__v\": 0\n }\n ]\n }\n}" + } + ] + }, + { + "name": "Create user", + "request": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}a\",\n \"password\": \"{{password}}\",\n \"confirmation\": \"{{password}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/user", + "host": [ + "{{url}}" + ], + "path": [ + "user" + ] + } + }, + "response": [ + { + "name": "Success", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}a\",\n \"password\": \"{{password}}\",\n \"confirmation\": \"{{password}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/user", + "host": [ + "{{url}}" + ], + "path": [ + "user" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "193" + }, + { + "key": "ETag", + "value": "W/\"c1-l8ljmPi3lCLKQGE5UXfTfXfixi8\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:58:54 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": true,\n \"data\": {\n \"user\": {\n \"username\": \"LucasStbnra\",\n \"permission\": 1,\n \"_id\": \"6335eaee8f3b06674271d339\",\n \"createdAt\": \"2022-09-29T18:58:54.889Z\",\n \"updatedAt\": \"2022-09-29T18:58:54.889Z\",\n \"__v\": 0\n }\n }\n}" + }, + { + "name": "Confirmation is required", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}a\",\n \"password\": \"{{password}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/user", + "host": [ + "{{url}}" + ], + "path": [ + "user" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "52" + }, + { + "key": "ETag", + "value": "W/\"34-ISFLhc+RA+4RnUhRemN/oOat1WQ\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:49:32 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"error\": \"Confirmation is required\"\n}" + }, + { + "name": "Confirmation is required", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"password\": \"{{password}}\",\n \"confirmation\": \"{{password}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/user", + "host": [ + "{{url}}" + ], + "path": [ + "user" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "48" + }, + { + "key": "ETag", + "value": "W/\"30-nNyV/zh7KoZJ/YQEL1n2BAYYegg\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:49:48 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"error\": \"Some data is missing\"\n}" + }, + { + "name": "Username must be at least 3 characters long", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"a\",\n \"password\": \"{{password}}\",\n \"confirmation\": \"{{password}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/user", + "host": [ + "{{url}}" + ], + "path": [ + "user" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "71" + }, + { + "key": "ETag", + "value": "W/\"47-b4xW6pcg7zN48d2wMItD+EZWl84\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:50:14 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"error\": \"Username must be at least 3 characters long\"\n}" + }, + { + "name": "Password must be at least 8 characters long", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}a\",\n \"password\": \"aa\",\n \"confirmation\": \"aa\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/user", + "host": [ + "{{url}}" + ], + "path": [ + "user" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "71" + }, + { + "key": "ETag", + "value": "W/\"47-2VS7vMPZZen3sG2LUKvETZhy5Ew\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:51:22 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"error\": \"Password must be at least 8 characters long\"\n}" + }, + { + "name": "Password must contain at least one uppercase letter", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}a\",\n \"password\": \"aaaaaaaa\",\n \"confirmation\": \"aaaaaaaa\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/user", + "host": [ + "{{url}}" + ], + "path": [ + "user" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "79" + }, + { + "key": "ETag", + "value": "W/\"4f-9Ih/9Oph6iuOqfFkcC47GsqLDI8\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:51:52 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"error\": \"Password must contain at least one uppercase letter\"\n}" + }, + { + "name": "Password must contain at least one lowercase letter", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}a\",\n \"password\": \"AAAAAAAA\",\n \"confirmation\": \"AAAAAAAA\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/user", + "host": [ + "{{url}}" + ], + "path": [ + "user" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "79" + }, + { + "key": "ETag", + "value": "W/\"4f-NQXMn3KFPYQvfpir6+nXyuj/zgo\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:52:11 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"error\": \"Password must contain at least one lowercase letter\"\n}" + }, + { + "name": "Create user", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}a\",\n \"password\": \"AAAAAAAAa\",\n \"confirmation\": \"AAAAAAAAa\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/user", + "host": [ + "{{url}}" + ], + "path": [ + "user" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "69" + }, + { + "key": "ETag", + "value": "W/\"45-TVtKnuR1p1dHrZWqrz8QJGjUIvc\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:52:30 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"error\": \"Password must contain at least one number\"\n}" + }, + { + "name": "Password must contain at least one special character", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}a\",\n \"password\": \"AAAAAAAAa0\",\n \"confirmation\": \"AAAAAAAAa0\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/user", + "host": [ + "{{url}}" + ], + "path": [ + "user" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "80" + }, + { + "key": "ETag", + "value": "W/\"50-ZMJ3FDMRhHMf8SMY4wW29zbRBTI\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:52:44 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"error\": \"Password must contain at least one special character\"\n}" + }, + { + "name": "Data already exists", + "originalRequest": { + "method": "POST", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}a\",\n \"password\": \"{{password}}\",\n \"confirmation\": \"{{password}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/user", + "host": [ + "{{url}}" + ], + "path": [ + "user" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "47" + }, + { + "key": "ETag", + "value": "W/\"2f-teRGqWb5583WuThzKV7uBkWQkkg\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:56:39 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"error\": \"Data already exists\"\n}" + } + ] + }, + { + "name": "Update user", + "request": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}a\",\n \"password\": \"{{password}}\",\n \"confirmation\": \"{{password}}\",\n \"old_password\": \"{{password}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/user/:_id", + "host": [ + "{{url}}" + ], + "path": [ + "user", + ":_id" + ], + "variable": [ + { + "key": "_id", + "value": "6335eb118f3b06674271d33d" + } + ] + } + }, + "response": [ + { + "name": "Success", + "originalRequest": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}a\",\n \"password\": \"{{password}}\",\n \"confirmation\": \"{{password}}\",\n \"old_password\": \"{{password}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/user/:_id", + "host": [ + "{{url}}" + ], + "path": [ + "user", + ":_id" + ], + "variable": [ + { + "key": "_id", + "value": "6335eb118f3b06674271d33d" + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "555" + }, + { + "key": "ETag", + "value": "W/\"22b-9CFiTx2Eeu0f2g1iVxRZNAhmimM\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 19:05:24 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": true,\n \"data\": {\n \"user\": {\n \"_id\": \"6335eb118f3b06674271d33d\",\n \"username\": \"LucasStbnra\",\n \"permission\": 1,\n \"createdAt\": \"2022-09-29T18:59:29.364Z\",\n \"updatedAt\": \"2022-09-29T19:05:24.447Z\",\n \"__v\": 0\n },\n \"token\": {\n \"success\": true,\n \"data\": {\n \"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI2MzM1ZWIxMThmM2IwNjY3NDI3MWQzM2QiLCJ1c2VybmFtZSI6Ikx1Y2FzU3RibnJhIiwicGVybWlzc2lvbiI6MSwiY3JlYXRlZEF0IjoiMjAyMi0wOS0yOVQxODo1OToyOS4zNjRaIiwidXBkYXRlZEF0IjoiMjAyMi0wOS0yOVQxOTowNToyNC40NDdaIiwiX192IjowLCJpYXQiOjE2NjQ0NzgzMjR9.vO70i6EhgWAejo3uG8rC0NVzDrF3K8GgOVxV08ACRss\"\n }\n }\n }\n}" + }, + { + "name": "Unauthorized", + "originalRequest": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}\",\n \"password\": \"{{password}}\",\n \"confirmation\": \"{{password}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/user/:_id", + "host": [ + "{{url}}" + ], + "path": [ + "user", + ":_id" + ], + "variable": [ + { + "key": "_id", + "value": "6335eb118f3b06674271d33a" + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "40" + }, + { + "key": "ETag", + "value": "W/\"28-FUA6V4JbfRf7Mh4r5bmwNPsixTA\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 19:00:06 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"error\": \"Unauthorized\"\n}" + }, + { + "name": "User not found", + "originalRequest": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}\",\n \"password\": \"{{password}}\",\n \"confirmation\": \"{{password}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/user/:_id", + "host": [ + "{{url}}" + ], + "path": [ + "user", + ":_id" + ], + "variable": [ + { + "key": "_id", + "value": "6335eb118f3b06674271d33a" + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "42" + }, + { + "key": "ETag", + "value": "W/\"2a-FQG5794dbhTyRwgytQ7rokul7mM\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 19:01:18 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"error\": \"User not found\"\n}" + }, + { + "name": "Password confirmation is required", + "originalRequest": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}\",\n \"password\": \"{{password}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/user/:_id", + "host": [ + "{{url}}" + ], + "path": [ + "user", + ":_id" + ], + "variable": [ + { + "key": "_id", + "value": "6335eb118f3b06674271d33d" + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "61" + }, + { + "key": "ETag", + "value": "W/\"3d-gZjZ0Rkie0ILkHNeFtaF36LZVE8\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 19:02:02 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"error\": \"Password confirmation is required\"\n}" + }, + { + "name": "Old password is required", + "originalRequest": { + "method": "PUT", + "header": [], + "body": { + "mode": "raw", + "raw": "{\n \"username\": \"{{username}}\",\n \"password\": \"{{password}}\",\n \"confirmation\": \"{{password}}\"\n}", + "options": { + "raw": { + "language": "json" + } + } + }, + "url": { + "raw": "{{url}}/user/:_id", + "host": [ + "{{url}}" + ], + "path": [ + "user", + ":_id" + ], + "variable": [ + { + "key": "_id", + "value": "6335eb118f3b06674271d33d" + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "52" + }, + { + "key": "ETag", + "value": "W/\"34-LEyLNJlXGwAoAgSHQtV0EYkOQJ8\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 19:03:59 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"error\": \"Old password is required\"\n}" + } + ] + }, + { + "name": "Delete user", + "request": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{url}}/user/:_id", + "host": [ + "{{url}}" + ], + "path": [ + "user", + ":_id" + ], + "variable": [ + { + "key": "_id", + "value": "6335eaee8f3b06674271d339" + } + ] + } + }, + "response": [ + { + "name": "Success", + "originalRequest": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{url}}/user/:_id", + "host": [ + "{{url}}" + ], + "path": [ + "user", + ":_id" + ], + "variable": [ + { + "key": "_id", + "value": "6335eaee8f3b06674271d339" + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "16" + }, + { + "key": "ETag", + "value": "W/\"10-oV4hJxRVSENxc/wX8+mA4/Pe4tA\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:59:16 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": true\n}" + }, + { + "name": "User not found", + "originalRequest": { + "method": "DELETE", + "header": [], + "url": { + "raw": "{{url}}/user/:_id", + "host": [ + "{{url}}" + ], + "path": [ + "user", + ":_id" + ], + "variable": [ + { + "key": "_id", + "value": "6335e9a521727b13d5a7bcfa" + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "42" + }, + { + "key": "ETag", + "value": "W/\"2a-FQG5794dbhTyRwgytQ7rokul7mM\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 18:58:00 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": false,\n \"error\": \"User not found\"\n}" + } + ] + } + ] + }, + { + "name": "Room", + "item": [ + { + "name": "Get rooms", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}/room", + "host": [ + "{{url}}" + ], + "path": [ + "room" + ] + } + }, + "response": [ + { + "name": "Success", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}/room", + "host": [ + "{{url}}" + ], + "path": [ + "room" + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "158" + }, + { + "key": "ETag", + "value": "W/\"9e-b/pvDY2y4bDQ3ODm/PxMn0dppnA\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 19:13:51 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": true,\n \"data\": {\n \"rooms\": [\n {\n \"_id\": \"61e06d9f6a061e810904d932\",\n \"name\": \"Chambre\",\n \"user\": \"61dde7494b9ea24af77614cb\",\n \"createDate\": \"1642095622100\",\n \"__v\": 0\n }\n ]\n }\n}" + } + ] + }, + { + "name": "Get room", + "request": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}/room/:_id", + "host": [ + "{{url}}" + ], + "path": [ + "room", + ":_id" + ], + "variable": [ + { + "key": "_id", + "value": "61e06d9f6a061e810904d932" + } + ] + } + }, + "response": [ + { + "name": "Success", + "originalRequest": { + "method": "GET", + "header": [], + "url": { + "raw": "{{url}}/room/:_id", + "host": [ + "{{url}}" + ], + "path": [ + "room", + ":_id" + ], + "variable": [ + { + "key": "_id", + "value": "61e06d9f6a061e810904d932" + } + ] + } + }, + "status": "OK", + "code": 200, + "_postman_previewlanguage": "json", + "header": [ + { + "key": "X-Powered-By", + "value": "Express" + }, + { + "key": "Vary", + "value": "Origin" + }, + { + "key": "Access-Control-Allow-Credentials", + "value": "true" + }, + { + "key": "Content-Type", + "value": "application/json; charset=utf-8" + }, + { + "key": "Content-Length", + "value": "1691" + }, + { + "key": "ETag", + "value": "W/\"69b-vN1tu15JCWyKJQIshZbc8L7yFIw\"" + }, + { + "key": "Date", + "value": "Thu, 29 Sep 2022 19:14:26 GMT" + }, + { + "key": "Connection", + "value": "keep-alive" + }, + { + "key": "Keep-Alive", + "value": "timeout=5" + } + ], + "cookie": [], + "body": "{\n \"success\": true,\n \"data\": {\n \"room\": {\n \"_id\": \"61e06d9f6a061e810904d932\",\n \"name\": \"Chambre\",\n \"user\": \"61dde7494b9ea24af77614cb\",\n \"createDate\": \"1642095622100\",\n \"__v\": 0,\n \"items\": [\n ... (29 Ko restants) +ProjetBut3.postman_collection.json +79 Ko + } \ No newline at end of file