From 19b94a3bde568058c5406573b3bee19d930fb9f6 Mon Sep 17 00:00:00 2001 From: jmpuntas Date: Wed, 19 Feb 2025 19:00:30 +0100 Subject: [PATCH] Cambios del lab 1 --- endpoints/auto/badwords.json | 58 ++++++++++ endpoints/auto/comments.json | 64 +++++++++++ endpoints/auto/commentswithusers.json | 12 ++ endpoints/auto/photos.json | 68 +++++++++++ endpoints/auto/photostags.json | 60 ++++++++++ endpoints/auto/photoswithusers.json | 12 ++ endpoints/auto/tags.json | 58 ++++++++++ endpoints/auto/users.json | 70 ++++++++++++ endpoints/auto/usersfollows.json | 60 ++++++++++ endpoints/auto/votes.json | 64 +++++++++++ tests/auto/badwords.http | 127 +++++++++++++++++++++ tests/auto/comments.http | 142 +++++++++++++++++++++++ tests/auto/photos.http | 152 +++++++++++++++++++++++++ tests/auto/photostags.http | 132 ++++++++++++++++++++++ tests/auto/tags.http | 127 +++++++++++++++++++++ tests/auto/users.http | 157 ++++++++++++++++++++++++++ tests/auto/usersfollows.http | 132 ++++++++++++++++++++++ tests/auto/votes.http | 142 +++++++++++++++++++++++ web/index.html | 24 ++++ web/js/api/_auth.js | 29 +++++ web/js/api/_badwords.js | 47 ++++++++ web/js/api/_comments.js | 47 ++++++++ web/js/api/_commentswithusers.js | 23 ++++ web/js/api/_photos.js | 47 ++++++++ web/js/api/_photostags.js | 47 ++++++++ web/js/api/_photoswithusers.js | 23 ++++ web/js/api/_tags.js | 47 ++++++++ web/js/api/_users.js | 47 ++++++++ web/js/api/_usersfollows.js | 47 ++++++++ web/js/api/_votes.js | 47 ++++++++ web/register.html | 20 ++++ 31 files changed, 2132 insertions(+) create mode 100644 endpoints/auto/badwords.json create mode 100644 endpoints/auto/comments.json create mode 100644 endpoints/auto/commentswithusers.json create mode 100644 endpoints/auto/photos.json create mode 100644 endpoints/auto/photostags.json create mode 100644 endpoints/auto/photoswithusers.json create mode 100644 endpoints/auto/tags.json create mode 100644 endpoints/auto/users.json create mode 100644 endpoints/auto/usersfollows.json create mode 100644 endpoints/auto/votes.json create mode 100644 tests/auto/badwords.http create mode 100644 tests/auto/comments.http create mode 100644 tests/auto/photos.http create mode 100644 tests/auto/photostags.http create mode 100644 tests/auto/tags.http create mode 100644 tests/auto/users.http create mode 100644 tests/auto/usersfollows.http create mode 100644 tests/auto/votes.http create mode 100644 web/js/api/_auth.js create mode 100644 web/js/api/_badwords.js create mode 100644 web/js/api/_comments.js create mode 100644 web/js/api/_commentswithusers.js create mode 100644 web/js/api/_photos.js create mode 100644 web/js/api/_photostags.js create mode 100644 web/js/api/_photoswithusers.js create mode 100644 web/js/api/_tags.js create mode 100644 web/js/api/_users.js create mode 100644 web/js/api/_usersfollows.js create mode 100644 web/js/api/_votes.js create mode 100644 web/register.html diff --git a/endpoints/auto/badwords.json b/endpoints/auto/badwords.json new file mode 100644 index 00000000..048cbade --- /dev/null +++ b/endpoints/auto/badwords.json @@ -0,0 +1,58 @@ +{ + "getAll": { + "description": "Gets all entries from 'badwords'", + "route": "/badwords", + "method": "GET", + "sql": "SELECT * FROM badwords", + "auth_required": false, + "allowed_roles": [ + "*" + ] + }, + "getById": { + "description": "Gets an entry from 'badwords' by its primary key", + "route": "/badwords/$wordId", + "method": "GET", + "sql": "SELECT * FROM badwords WHERE wordId = $wordId", + "auth_required": false, + "allowed_roles": [ + "*" + ] + }, + "create": { + "description": "Creates a new entry in 'badwords'", + "route": "/badwords", + "method": "POST", + "sql": "INSERT INTO badwords (word) VALUES ($word)", + "request_body_params": [ + "word" + ], + "auth_required": true, + "allowed_roles": [ + "*" + ] + }, + "update": { + "description": "Updates an existing entry in 'badwords' by its primary key", + "route": "/badwords/$wordId", + "method": "PUT", + "sql": "UPDATE badwords SET word = $word WHERE wordId = $wordId", + "request_body_params": [ + "word" + ], + "auth_required": true, + "allowed_roles": [ + "*" + ] + }, + "delete": { + "description": "Deletes an existing entry in 'badwords' by its primary key", + "route": "/badwords/$wordId", + "method": "DELETE", + "sql": "DELETE FROM badwords WHERE wordId = $wordId", + "auth_required": true, + "allowed_roles": [ + "*" + ] + } +} \ No newline at end of file diff --git a/endpoints/auto/comments.json b/endpoints/auto/comments.json new file mode 100644 index 00000000..beda508c --- /dev/null +++ b/endpoints/auto/comments.json @@ -0,0 +1,64 @@ +{ + "getAll": { + "description": "Gets all entries from 'comments'", + "route": "/comments", + "method": "GET", + "sql": "SELECT * FROM comments", + "auth_required": false, + "allowed_roles": [ + "*" + ] + }, + "getById": { + "description": "Gets an entry from 'comments' by its primary key", + "route": "/comments/$commentId", + "method": "GET", + "sql": "SELECT * FROM comments WHERE commentId = $commentId", + "auth_required": false, + "allowed_roles": [ + "*" + ] + }, + "create": { + "description": "Creates a new entry in 'comments'", + "route": "/comments", + "method": "POST", + "sql": "INSERT INTO comments (text, date, userId, photoId) VALUES ($text, $date, $userId, $photoId)", + "request_body_params": [ + "text", + "date", + "userId", + "photoId" + ], + "auth_required": true, + "allowed_roles": [ + "*" + ] + }, + "update": { + "description": "Updates an existing entry in 'comments' by its primary key", + "route": "/comments/$commentId", + "method": "PUT", + "sql": "UPDATE comments SET text = $text, date = $date, userId = $userId, photoId = $photoId WHERE commentId = $commentId", + "request_body_params": [ + "text", + "date", + "userId", + "photoId" + ], + "auth_required": true, + "allowed_roles": [ + "*" + ] + }, + "delete": { + "description": "Deletes an existing entry in 'comments' by its primary key", + "route": "/comments/$commentId", + "method": "DELETE", + "sql": "DELETE FROM comments WHERE commentId = $commentId", + "auth_required": true, + "allowed_roles": [ + "*" + ] + } +} \ No newline at end of file diff --git a/endpoints/auto/commentswithusers.json b/endpoints/auto/commentswithusers.json new file mode 100644 index 00000000..0006d0ec --- /dev/null +++ b/endpoints/auto/commentswithusers.json @@ -0,0 +1,12 @@ +{ + "getAll": { + "description": "Gets all entries from 'commentswithusers'", + "route": "/commentswithusers", + "method": "GET", + "sql": "SELECT * FROM commentswithusers", + "auth_required": false, + "allowed_roles": [ + "*" + ] + } +} \ No newline at end of file diff --git a/endpoints/auto/photos.json b/endpoints/auto/photos.json new file mode 100644 index 00000000..4209538d --- /dev/null +++ b/endpoints/auto/photos.json @@ -0,0 +1,68 @@ +{ + "getAll": { + "description": "Gets all entries from 'photos'", + "route": "/photos", + "method": "GET", + "sql": "SELECT * FROM photos", + "auth_required": false, + "allowed_roles": [ + "*" + ] + }, + "getById": { + "description": "Gets an entry from 'photos' by its primary key", + "route": "/photos/$photoId", + "method": "GET", + "sql": "SELECT * FROM photos WHERE photoId = $photoId", + "auth_required": false, + "allowed_roles": [ + "*" + ] + }, + "create": { + "description": "Creates a new entry in 'photos'", + "route": "/photos", + "method": "POST", + "sql": "INSERT INTO photos (title, description, date, url, visibility, userId) VALUES ($title, $description, $date, $url, $visibility, $userId)", + "request_body_params": [ + "title", + "description", + "date", + "url", + "visibility", + "userId" + ], + "auth_required": true, + "allowed_roles": [ + "*" + ] + }, + "update": { + "description": "Updates an existing entry in 'photos' by its primary key", + "route": "/photos/$photoId", + "method": "PUT", + "sql": "UPDATE photos SET title = $title, description = $description, date = $date, url = $url, visibility = $visibility, userId = $userId WHERE photoId = $photoId", + "request_body_params": [ + "title", + "description", + "date", + "url", + "visibility", + "userId" + ], + "auth_required": true, + "allowed_roles": [ + "*" + ] + }, + "delete": { + "description": "Deletes an existing entry in 'photos' by its primary key", + "route": "/photos/$photoId", + "method": "DELETE", + "sql": "DELETE FROM photos WHERE photoId = $photoId", + "auth_required": true, + "allowed_roles": [ + "*" + ] + } +} \ No newline at end of file diff --git a/endpoints/auto/photostags.json b/endpoints/auto/photostags.json new file mode 100644 index 00000000..59d1aa7e --- /dev/null +++ b/endpoints/auto/photostags.json @@ -0,0 +1,60 @@ +{ + "getAll": { + "description": "Gets all entries from 'photostags'", + "route": "/photostags", + "method": "GET", + "sql": "SELECT * FROM photostags", + "auth_required": false, + "allowed_roles": [ + "*" + ] + }, + "getById": { + "description": "Gets an entry from 'photostags' by its primary key", + "route": "/photostags/$photoTagId", + "method": "GET", + "sql": "SELECT * FROM photostags WHERE photoTagId = $photoTagId", + "auth_required": false, + "allowed_roles": [ + "*" + ] + }, + "create": { + "description": "Creates a new entry in 'photostags'", + "route": "/photostags", + "method": "POST", + "sql": "INSERT INTO photostags (photoId, tagId) VALUES ($photoId, $tagId)", + "request_body_params": [ + "photoId", + "tagId" + ], + "auth_required": true, + "allowed_roles": [ + "*" + ] + }, + "update": { + "description": "Updates an existing entry in 'photostags' by its primary key", + "route": "/photostags/$photoTagId", + "method": "PUT", + "sql": "UPDATE photostags SET photoId = $photoId, tagId = $tagId WHERE photoTagId = $photoTagId", + "request_body_params": [ + "photoId", + "tagId" + ], + "auth_required": true, + "allowed_roles": [ + "*" + ] + }, + "delete": { + "description": "Deletes an existing entry in 'photostags' by its primary key", + "route": "/photostags/$photoTagId", + "method": "DELETE", + "sql": "DELETE FROM photostags WHERE photoTagId = $photoTagId", + "auth_required": true, + "allowed_roles": [ + "*" + ] + } +} \ No newline at end of file diff --git a/endpoints/auto/photoswithusers.json b/endpoints/auto/photoswithusers.json new file mode 100644 index 00000000..c1a97969 --- /dev/null +++ b/endpoints/auto/photoswithusers.json @@ -0,0 +1,12 @@ +{ + "getAll": { + "description": "Gets all entries from 'photoswithusers'", + "route": "/photoswithusers", + "method": "GET", + "sql": "SELECT * FROM photoswithusers", + "auth_required": false, + "allowed_roles": [ + "*" + ] + } +} \ No newline at end of file diff --git a/endpoints/auto/tags.json b/endpoints/auto/tags.json new file mode 100644 index 00000000..0083da53 --- /dev/null +++ b/endpoints/auto/tags.json @@ -0,0 +1,58 @@ +{ + "getAll": { + "description": "Gets all entries from 'tags'", + "route": "/tags", + "method": "GET", + "sql": "SELECT * FROM tags", + "auth_required": false, + "allowed_roles": [ + "*" + ] + }, + "getById": { + "description": "Gets an entry from 'tags' by its primary key", + "route": "/tags/$tagId", + "method": "GET", + "sql": "SELECT * FROM tags WHERE tagId = $tagId", + "auth_required": false, + "allowed_roles": [ + "*" + ] + }, + "create": { + "description": "Creates a new entry in 'tags'", + "route": "/tags", + "method": "POST", + "sql": "INSERT INTO tags (name) VALUES ($name)", + "request_body_params": [ + "name" + ], + "auth_required": true, + "allowed_roles": [ + "*" + ] + }, + "update": { + "description": "Updates an existing entry in 'tags' by its primary key", + "route": "/tags/$tagId", + "method": "PUT", + "sql": "UPDATE tags SET name = $name WHERE tagId = $tagId", + "request_body_params": [ + "name" + ], + "auth_required": true, + "allowed_roles": [ + "*" + ] + }, + "delete": { + "description": "Deletes an existing entry in 'tags' by its primary key", + "route": "/tags/$tagId", + "method": "DELETE", + "sql": "DELETE FROM tags WHERE tagId = $tagId", + "auth_required": true, + "allowed_roles": [ + "*" + ] + } +} \ No newline at end of file diff --git a/endpoints/auto/users.json b/endpoints/auto/users.json new file mode 100644 index 00000000..ecd89c90 --- /dev/null +++ b/endpoints/auto/users.json @@ -0,0 +1,70 @@ +{ + "getAll": { + "description": "Gets all entries from 'users'", + "route": "/users", + "method": "GET", + "sql": "SELECT * FROM users", + "auth_required": false, + "allowed_roles": [ + "*" + ] + }, + "getById": { + "description": "Gets an entry from 'users' by its primary key", + "route": "/users/$userId", + "method": "GET", + "sql": "SELECT * FROM users WHERE userId = $userId", + "auth_required": false, + "allowed_roles": [ + "*" + ] + }, + "create": { + "description": "Creates a new entry in 'users'", + "route": "/users", + "method": "POST", + "sql": "INSERT INTO users (firstName, lastName, telephone, email, username, password, avatarUrl) VALUES ($firstName, $lastName, $telephone, $email, $username, $password, $avatarUrl)", + "request_body_params": [ + "firstName", + "lastName", + "telephone", + "email", + "username", + "password", + "avatarUrl" + ], + "auth_required": true, + "allowed_roles": [ + "*" + ] + }, + "update": { + "description": "Updates an existing entry in 'users' by its primary key", + "route": "/users/$userId", + "method": "PUT", + "sql": "UPDATE users SET firstName = $firstName, lastName = $lastName, telephone = $telephone, email = $email, username = $username, password = $password, avatarUrl = $avatarUrl WHERE userId = $userId", + "request_body_params": [ + "firstName", + "lastName", + "telephone", + "email", + "username", + "password", + "avatarUrl" + ], + "auth_required": true, + "allowed_roles": [ + "*" + ] + }, + "delete": { + "description": "Deletes an existing entry in 'users' by its primary key", + "route": "/users/$userId", + "method": "DELETE", + "sql": "DELETE FROM users WHERE userId = $userId", + "auth_required": true, + "allowed_roles": [ + "*" + ] + } +} \ No newline at end of file diff --git a/endpoints/auto/usersfollows.json b/endpoints/auto/usersfollows.json new file mode 100644 index 00000000..885e1480 --- /dev/null +++ b/endpoints/auto/usersfollows.json @@ -0,0 +1,60 @@ +{ + "getAll": { + "description": "Gets all entries from 'usersfollows'", + "route": "/usersfollows", + "method": "GET", + "sql": "SELECT * FROM usersfollows", + "auth_required": false, + "allowed_roles": [ + "*" + ] + }, + "getById": { + "description": "Gets an entry from 'usersfollows' by its primary key", + "route": "/usersfollows/$id", + "method": "GET", + "sql": "SELECT * FROM usersfollows WHERE id = $id", + "auth_required": false, + "allowed_roles": [ + "*" + ] + }, + "create": { + "description": "Creates a new entry in 'usersfollows'", + "route": "/usersfollows", + "method": "POST", + "sql": "INSERT INTO usersfollows (followerId, followedId) VALUES ($followerId, $followedId)", + "request_body_params": [ + "followerId", + "followedId" + ], + "auth_required": true, + "allowed_roles": [ + "*" + ] + }, + "update": { + "description": "Updates an existing entry in 'usersfollows' by its primary key", + "route": "/usersfollows/$id", + "method": "PUT", + "sql": "UPDATE usersfollows SET followerId = $followerId, followedId = $followedId WHERE id = $id", + "request_body_params": [ + "followerId", + "followedId" + ], + "auth_required": true, + "allowed_roles": [ + "*" + ] + }, + "delete": { + "description": "Deletes an existing entry in 'usersfollows' by its primary key", + "route": "/usersfollows/$id", + "method": "DELETE", + "sql": "DELETE FROM usersfollows WHERE id = $id", + "auth_required": true, + "allowed_roles": [ + "*" + ] + } +} \ No newline at end of file diff --git a/endpoints/auto/votes.json b/endpoints/auto/votes.json new file mode 100644 index 00000000..74e3844b --- /dev/null +++ b/endpoints/auto/votes.json @@ -0,0 +1,64 @@ +{ + "getAll": { + "description": "Gets all entries from 'votes'", + "route": "/votes", + "method": "GET", + "sql": "SELECT * FROM votes", + "auth_required": false, + "allowed_roles": [ + "*" + ] + }, + "getById": { + "description": "Gets an entry from 'votes' by its primary key", + "route": "/votes/$voteId", + "method": "GET", + "sql": "SELECT * FROM votes WHERE voteId = $voteId", + "auth_required": false, + "allowed_roles": [ + "*" + ] + }, + "create": { + "description": "Creates a new entry in 'votes'", + "route": "/votes", + "method": "POST", + "sql": "INSERT INTO votes (value, date, userId, photoId) VALUES ($value, $date, $userId, $photoId)", + "request_body_params": [ + "value", + "date", + "userId", + "photoId" + ], + "auth_required": true, + "allowed_roles": [ + "*" + ] + }, + "update": { + "description": "Updates an existing entry in 'votes' by its primary key", + "route": "/votes/$voteId", + "method": "PUT", + "sql": "UPDATE votes SET value = $value, date = $date, userId = $userId, photoId = $photoId WHERE voteId = $voteId", + "request_body_params": [ + "value", + "date", + "userId", + "photoId" + ], + "auth_required": true, + "allowed_roles": [ + "*" + ] + }, + "delete": { + "description": "Deletes an existing entry in 'votes' by its primary key", + "route": "/votes/$voteId", + "method": "DELETE", + "sql": "DELETE FROM votes WHERE voteId = $voteId", + "auth_required": true, + "allowed_roles": [ + "*" + ] + } +} \ No newline at end of file diff --git a/tests/auto/badwords.http b/tests/auto/badwords.http new file mode 100644 index 00000000..9a4a5de0 --- /dev/null +++ b/tests/auto/badwords.http @@ -0,0 +1,127 @@ + +### This is an auto-generated test suite, it needs to be completed with valid data. +### These are not all tests you need, more of them should be created to evaluate the functional +### requirements of your project. These tests only test the CRUD endpoints of the entity. +### Silence is a DEAL research team project, more info about us in https://deal.us.es +@BASE = http://127.0.0.1:8080/api/v1 + +### Auxiliary query +### Positive test +### Test 00: Get all existing badwords +### This query is used in several of the below tests it should be executed first. +# @name badwords +GET {{BASE}}/badwords + +### Login a(n) users and save the generated token +### This token is used in several of the below tests it should be executed second. +# @name login +POST {{BASE}}/login +Content-Type: application/json + +{ + "username": ###REPLACE###, + "password": ###REPLACE### +} + +### +@token = {{login.response.body.sessionToken}} + + +### TESTS BEGIN + +### Test 01: Get one existing badwords by its id. +### positive test +@badId = {{badwords.response.body.0.wordId}} +GET {{BASE}}/badwords/{{badId}} +Content-Type: application/json + + +### Test 02: Try get one existing badwords by its nonexistent id. +### negative test +GET {{BASE}}/badwords/999999999 +Content-Type: application/json + + +### Test 03: Add a new badwords successfully +### Positive test +### We assume that the token has been aquired by the login request. +# @name newbadwords +POST {{BASE}}/badwords +Content-Type: application/json +Token: {{token}} + +{ + "word": ###REPLACE### +} + +### Check the created badwords + +@newbadwordsid = {{newbadwords.response.body.lastId}} +GET {{BASE}}/badwords/{{newbadwordsid}} +Content-Type: application/json + +### Test 04: Add a new badwords without a session token +### Negative test +POST {{BASE}}/badwords +Content-Type: application/json + +{ + "word": ###REPLACE### +} + +### Test 05: Modify an existing badwords +### Positive test +@badId = {{badwords.response.body.0.wordId}} +PUT {{BASE}}/badwords/{{badId}} +Content-Type: application/json +Token: {{token}} + +{ + "word": ###REPLACE### +} + +### Check the modified badwords + +GET {{BASE}}/badwords/{{newbadwordsid}} +Content-Type: application/json + +### Test 06: Try to modify an existing badwords without a session token +### Negative test +@badId = {{badwords.response.body.0.wordId}} +PUT {{BASE}}/badwords/{{badId}} +Content-Type: application/json + +{ + "word": ###REPLACE### +} + +### Test 07: Delete an existing badwords +### Positive test + +### Create a new badwords, which we will delete +# @name createdbadToDelete +POST {{BASE}}/badwords +Content-Type: application/json +Token: {{token}} + +{ + "word": ###REPLACE### +} + +### Check the created badwords +@baddelId = {{createdbadToDelete.response.body.lastId}} +GET {{BASE}}/badwords/{{baddelId}} +Content-Type: application/json + +### Delete the badwords +DELETE {{BASE}}/badwords/{{baddelId}} +Token: {{token}} + +### Check the deleted badwords +GET {{BASE}}/badwords/{{baddelId}} +Content-Type: application/json + +### Test 08: Try to delete a badwords without a session token +### Negative test +DELETE {{BASE}}/badwords/{{badId}} + diff --git a/tests/auto/comments.http b/tests/auto/comments.http new file mode 100644 index 00000000..c0377d30 --- /dev/null +++ b/tests/auto/comments.http @@ -0,0 +1,142 @@ + +### This is an auto-generated test suite, it needs to be completed with valid data. +### These are not all tests you need, more of them should be created to evaluate the functional +### requirements of your project. These tests only test the CRUD endpoints of the entity. +### Silence is a DEAL research team project, more info about us in https://deal.us.es +@BASE = http://127.0.0.1:8080/api/v1 + +### Auxiliary query +### Positive test +### Test 00: Get all existing comments +### This query is used in several of the below tests it should be executed first. +# @name comments +GET {{BASE}}/comments + +### Login a(n) users and save the generated token +### This token is used in several of the below tests it should be executed second. +# @name login +POST {{BASE}}/login +Content-Type: application/json + +{ + "username": ###REPLACE###, + "password": ###REPLACE### +} + +### +@token = {{login.response.body.sessionToken}} + + +### TESTS BEGIN + +### Test 01: Get one existing comments by its id. +### positive test +@comId = {{comments.response.body.0.commentId}} +GET {{BASE}}/comments/{{comId}} +Content-Type: application/json + + +### Test 02: Try get one existing comments by its nonexistent id. +### negative test +GET {{BASE}}/comments/999999999 +Content-Type: application/json + + +### Test 03: Add a new comments successfully +### Positive test +### We assume that the token has been aquired by the login request. +# @name newcomments +POST {{BASE}}/comments +Content-Type: application/json +Token: {{token}} + +{ + "text": ###REPLACE###, + "date": ###REPLACE###, + "userId": ###REPLACE###, + "photoId": ###REPLACE### +} + +### Check the created comments + +@newcommentsid = {{newcomments.response.body.lastId}} +GET {{BASE}}/comments/{{newcommentsid}} +Content-Type: application/json + +### Test 04: Add a new comments without a session token +### Negative test +POST {{BASE}}/comments +Content-Type: application/json + +{ + "text": ###REPLACE###, + "date": ###REPLACE###, + "userId": ###REPLACE###, + "photoId": ###REPLACE### +} + +### Test 05: Modify an existing comments +### Positive test +@comId = {{comments.response.body.0.commentId}} +PUT {{BASE}}/comments/{{comId}} +Content-Type: application/json +Token: {{token}} + +{ + "text": ###REPLACE###, + "date": ###REPLACE###, + "userId": ###REPLACE###, + "photoId": ###REPLACE### +} + +### Check the modified comments + +GET {{BASE}}/comments/{{newcommentsid}} +Content-Type: application/json + +### Test 06: Try to modify an existing comments without a session token +### Negative test +@comId = {{comments.response.body.0.commentId}} +PUT {{BASE}}/comments/{{comId}} +Content-Type: application/json + +{ + "text": ###REPLACE###, + "date": ###REPLACE###, + "userId": ###REPLACE###, + "photoId": ###REPLACE### +} + +### Test 07: Delete an existing comments +### Positive test + +### Create a new comments, which we will delete +# @name createdcomToDelete +POST {{BASE}}/comments +Content-Type: application/json +Token: {{token}} + +{ + "text": ###REPLACE###, + "date": ###REPLACE###, + "userId": ###REPLACE###, + "photoId": ###REPLACE### +} + +### Check the created comments +@comdelId = {{createdcomToDelete.response.body.lastId}} +GET {{BASE}}/comments/{{comdelId}} +Content-Type: application/json + +### Delete the comments +DELETE {{BASE}}/comments/{{comdelId}} +Token: {{token}} + +### Check the deleted comments +GET {{BASE}}/comments/{{comdelId}} +Content-Type: application/json + +### Test 08: Try to delete a comments without a session token +### Negative test +DELETE {{BASE}}/comments/{{comId}} + diff --git a/tests/auto/photos.http b/tests/auto/photos.http new file mode 100644 index 00000000..f649fa21 --- /dev/null +++ b/tests/auto/photos.http @@ -0,0 +1,152 @@ + +### This is an auto-generated test suite, it needs to be completed with valid data. +### These are not all tests you need, more of them should be created to evaluate the functional +### requirements of your project. These tests only test the CRUD endpoints of the entity. +### Silence is a DEAL research team project, more info about us in https://deal.us.es +@BASE = http://127.0.0.1:8080/api/v1 + +### Auxiliary query +### Positive test +### Test 00: Get all existing photos +### This query is used in several of the below tests it should be executed first. +# @name photos +GET {{BASE}}/photos + +### Login a(n) users and save the generated token +### This token is used in several of the below tests it should be executed second. +# @name login +POST {{BASE}}/login +Content-Type: application/json + +{ + "username": ###REPLACE###, + "password": ###REPLACE### +} + +### +@token = {{login.response.body.sessionToken}} + + +### TESTS BEGIN + +### Test 01: Get one existing photos by its id. +### positive test +@phoId = {{photos.response.body.0.photoId}} +GET {{BASE}}/photos/{{phoId}} +Content-Type: application/json + + +### Test 02: Try get one existing photos by its nonexistent id. +### negative test +GET {{BASE}}/photos/999999999 +Content-Type: application/json + + +### Test 03: Add a new photos successfully +### Positive test +### We assume that the token has been aquired by the login request. +# @name newphotos +POST {{BASE}}/photos +Content-Type: application/json +Token: {{token}} + +{ + "title": ###REPLACE###, + "description": ###REPLACE###, + "date": ###REPLACE###, + "url": ###REPLACE###, + "visibility": ###REPLACE###, + "userId": ###REPLACE### +} + +### Check the created photos + +@newphotosid = {{newphotos.response.body.lastId}} +GET {{BASE}}/photos/{{newphotosid}} +Content-Type: application/json + +### Test 04: Add a new photos without a session token +### Negative test +POST {{BASE}}/photos +Content-Type: application/json + +{ + "title": ###REPLACE###, + "description": ###REPLACE###, + "date": ###REPLACE###, + "url": ###REPLACE###, + "visibility": ###REPLACE###, + "userId": ###REPLACE### +} + +### Test 05: Modify an existing photos +### Positive test +@phoId = {{photos.response.body.0.photoId}} +PUT {{BASE}}/photos/{{phoId}} +Content-Type: application/json +Token: {{token}} + +{ + "title": ###REPLACE###, + "description": ###REPLACE###, + "date": ###REPLACE###, + "url": ###REPLACE###, + "visibility": ###REPLACE###, + "userId": ###REPLACE### +} + +### Check the modified photos + +GET {{BASE}}/photos/{{newphotosid}} +Content-Type: application/json + +### Test 06: Try to modify an existing photos without a session token +### Negative test +@phoId = {{photos.response.body.0.photoId}} +PUT {{BASE}}/photos/{{phoId}} +Content-Type: application/json + +{ + "title": ###REPLACE###, + "description": ###REPLACE###, + "date": ###REPLACE###, + "url": ###REPLACE###, + "visibility": ###REPLACE###, + "userId": ###REPLACE### +} + +### Test 07: Delete an existing photos +### Positive test + +### Create a new photos, which we will delete +# @name createdphoToDelete +POST {{BASE}}/photos +Content-Type: application/json +Token: {{token}} + +{ + "title": ###REPLACE###, + "description": ###REPLACE###, + "date": ###REPLACE###, + "url": ###REPLACE###, + "visibility": ###REPLACE###, + "userId": ###REPLACE### +} + +### Check the created photos +@phodelId = {{createdphoToDelete.response.body.lastId}} +GET {{BASE}}/photos/{{phodelId}} +Content-Type: application/json + +### Delete the photos +DELETE {{BASE}}/photos/{{phodelId}} +Token: {{token}} + +### Check the deleted photos +GET {{BASE}}/photos/{{phodelId}} +Content-Type: application/json + +### Test 08: Try to delete a photos without a session token +### Negative test +DELETE {{BASE}}/photos/{{phoId}} + diff --git a/tests/auto/photostags.http b/tests/auto/photostags.http new file mode 100644 index 00000000..a562e04a --- /dev/null +++ b/tests/auto/photostags.http @@ -0,0 +1,132 @@ + +### This is an auto-generated test suite, it needs to be completed with valid data. +### These are not all tests you need, more of them should be created to evaluate the functional +### requirements of your project. These tests only test the CRUD endpoints of the entity. +### Silence is a DEAL research team project, more info about us in https://deal.us.es +@BASE = http://127.0.0.1:8080/api/v1 + +### Auxiliary query +### Positive test +### Test 00: Get all existing photostags +### This query is used in several of the below tests it should be executed first. +# @name photostags +GET {{BASE}}/photostags + +### Login a(n) users and save the generated token +### This token is used in several of the below tests it should be executed second. +# @name login +POST {{BASE}}/login +Content-Type: application/json + +{ + "username": ###REPLACE###, + "password": ###REPLACE### +} + +### +@token = {{login.response.body.sessionToken}} + + +### TESTS BEGIN + +### Test 01: Get one existing photostags by its id. +### positive test +@phoId = {{photostags.response.body.0.photoTagId}} +GET {{BASE}}/photostags/{{phoId}} +Content-Type: application/json + + +### Test 02: Try get one existing photostags by its nonexistent id. +### negative test +GET {{BASE}}/photostags/999999999 +Content-Type: application/json + + +### Test 03: Add a new photostags successfully +### Positive test +### We assume that the token has been aquired by the login request. +# @name newphotostags +POST {{BASE}}/photostags +Content-Type: application/json +Token: {{token}} + +{ + "photoId": ###REPLACE###, + "tagId": ###REPLACE### +} + +### Check the created photostags + +@newphotostagsid = {{newphotostags.response.body.lastId}} +GET {{BASE}}/photostags/{{newphotostagsid}} +Content-Type: application/json + +### Test 04: Add a new photostags without a session token +### Negative test +POST {{BASE}}/photostags +Content-Type: application/json + +{ + "photoId": ###REPLACE###, + "tagId": ###REPLACE### +} + +### Test 05: Modify an existing photostags +### Positive test +@phoId = {{photostags.response.body.0.photoTagId}} +PUT {{BASE}}/photostags/{{phoId}} +Content-Type: application/json +Token: {{token}} + +{ + "photoId": ###REPLACE###, + "tagId": ###REPLACE### +} + +### Check the modified photostags + +GET {{BASE}}/photostags/{{newphotostagsid}} +Content-Type: application/json + +### Test 06: Try to modify an existing photostags without a session token +### Negative test +@phoId = {{photostags.response.body.0.photoTagId}} +PUT {{BASE}}/photostags/{{phoId}} +Content-Type: application/json + +{ + "photoId": ###REPLACE###, + "tagId": ###REPLACE### +} + +### Test 07: Delete an existing photostags +### Positive test + +### Create a new photostags, which we will delete +# @name createdphoToDelete +POST {{BASE}}/photostags +Content-Type: application/json +Token: {{token}} + +{ + "photoId": ###REPLACE###, + "tagId": ###REPLACE### +} + +### Check the created photostags +@phodelId = {{createdphoToDelete.response.body.lastId}} +GET {{BASE}}/photostags/{{phodelId}} +Content-Type: application/json + +### Delete the photostags +DELETE {{BASE}}/photostags/{{phodelId}} +Token: {{token}} + +### Check the deleted photostags +GET {{BASE}}/photostags/{{phodelId}} +Content-Type: application/json + +### Test 08: Try to delete a photostags without a session token +### Negative test +DELETE {{BASE}}/photostags/{{phoId}} + diff --git a/tests/auto/tags.http b/tests/auto/tags.http new file mode 100644 index 00000000..a184e421 --- /dev/null +++ b/tests/auto/tags.http @@ -0,0 +1,127 @@ + +### This is an auto-generated test suite, it needs to be completed with valid data. +### These are not all tests you need, more of them should be created to evaluate the functional +### requirements of your project. These tests only test the CRUD endpoints of the entity. +### Silence is a DEAL research team project, more info about us in https://deal.us.es +@BASE = http://127.0.0.1:8080/api/v1 + +### Auxiliary query +### Positive test +### Test 00: Get all existing tags +### This query is used in several of the below tests it should be executed first. +# @name tags +GET {{BASE}}/tags + +### Login a(n) users and save the generated token +### This token is used in several of the below tests it should be executed second. +# @name login +POST {{BASE}}/login +Content-Type: application/json + +{ + "username": ###REPLACE###, + "password": ###REPLACE### +} + +### +@token = {{login.response.body.sessionToken}} + + +### TESTS BEGIN + +### Test 01: Get one existing tags by its id. +### positive test +@tagId = {{tags.response.body.0.tagId}} +GET {{BASE}}/tags/{{tagId}} +Content-Type: application/json + + +### Test 02: Try get one existing tags by its nonexistent id. +### negative test +GET {{BASE}}/tags/999999999 +Content-Type: application/json + + +### Test 03: Add a new tags successfully +### Positive test +### We assume that the token has been aquired by the login request. +# @name newtags +POST {{BASE}}/tags +Content-Type: application/json +Token: {{token}} + +{ + "name": ###REPLACE### +} + +### Check the created tags + +@newtagsid = {{newtags.response.body.lastId}} +GET {{BASE}}/tags/{{newtagsid}} +Content-Type: application/json + +### Test 04: Add a new tags without a session token +### Negative test +POST {{BASE}}/tags +Content-Type: application/json + +{ + "name": ###REPLACE### +} + +### Test 05: Modify an existing tags +### Positive test +@tagId = {{tags.response.body.0.tagId}} +PUT {{BASE}}/tags/{{tagId}} +Content-Type: application/json +Token: {{token}} + +{ + "name": ###REPLACE### +} + +### Check the modified tags + +GET {{BASE}}/tags/{{newtagsid}} +Content-Type: application/json + +### Test 06: Try to modify an existing tags without a session token +### Negative test +@tagId = {{tags.response.body.0.tagId}} +PUT {{BASE}}/tags/{{tagId}} +Content-Type: application/json + +{ + "name": ###REPLACE### +} + +### Test 07: Delete an existing tags +### Positive test + +### Create a new tags, which we will delete +# @name createdtagToDelete +POST {{BASE}}/tags +Content-Type: application/json +Token: {{token}} + +{ + "name": ###REPLACE### +} + +### Check the created tags +@tagdelId = {{createdtagToDelete.response.body.lastId}} +GET {{BASE}}/tags/{{tagdelId}} +Content-Type: application/json + +### Delete the tags +DELETE {{BASE}}/tags/{{tagdelId}} +Token: {{token}} + +### Check the deleted tags +GET {{BASE}}/tags/{{tagdelId}} +Content-Type: application/json + +### Test 08: Try to delete a tags without a session token +### Negative test +DELETE {{BASE}}/tags/{{tagId}} + diff --git a/tests/auto/users.http b/tests/auto/users.http new file mode 100644 index 00000000..0ef8b051 --- /dev/null +++ b/tests/auto/users.http @@ -0,0 +1,157 @@ + +### This is an auto-generated test suite, it needs to be completed with valid data. +### These are not all tests you need, more of them should be created to evaluate the functional +### requirements of your project. These tests only test the CRUD endpoints of the entity. +### Silence is a DEAL research team project, more info about us in https://deal.us.es +@BASE = http://127.0.0.1:8080/api/v1 + +### Auxiliary query +### Positive test +### Test 00: Get all existing users +### This query is used in several of the below tests it should be executed first. +# @name users +GET {{BASE}}/users + +### Login a(n) users and save the generated token +### This token is used in several of the below tests it should be executed second. +# @name login +POST {{BASE}}/login +Content-Type: application/json + +{ + "username": ###REPLACE###, + "password": ###REPLACE### +} + +### +@token = {{login.response.body.sessionToken}} + + +### TESTS BEGIN + +### Test 01: Get one existing users by its id. +### positive test +@useId = {{users.response.body.0.userId}} +GET {{BASE}}/users/{{useId}} +Content-Type: application/json + + +### Test 02: Try get one existing users by its nonexistent id. +### negative test +GET {{BASE}}/users/999999999 +Content-Type: application/json + + +### Test 03: Add a new users successfully +### Positive test +### We assume that the token has been aquired by the login request. +# @name newusers +POST {{BASE}}/users +Content-Type: application/json +Token: {{token}} + +{ + "firstName": ###REPLACE###, + "lastName": ###REPLACE###, + "telephone": ###REPLACE###, + "email": ###REPLACE###, + "username": ###REPLACE###, + "password": ###REPLACE###, + "avatarUrl": ###REPLACE### +} + +### Check the created users + +@newusersid = {{newusers.response.body.lastId}} +GET {{BASE}}/users/{{newusersid}} +Content-Type: application/json + +### Test 04: Add a new users without a session token +### Negative test +POST {{BASE}}/users +Content-Type: application/json + +{ + "firstName": ###REPLACE###, + "lastName": ###REPLACE###, + "telephone": ###REPLACE###, + "email": ###REPLACE###, + "username": ###REPLACE###, + "password": ###REPLACE###, + "avatarUrl": ###REPLACE### +} + +### Test 05: Modify an existing users +### Positive test +@useId = {{users.response.body.0.userId}} +PUT {{BASE}}/users/{{useId}} +Content-Type: application/json +Token: {{token}} + +{ + "firstName": ###REPLACE###, + "lastName": ###REPLACE###, + "telephone": ###REPLACE###, + "email": ###REPLACE###, + "username": ###REPLACE###, + "password": ###REPLACE###, + "avatarUrl": ###REPLACE### +} + +### Check the modified users + +GET {{BASE}}/users/{{newusersid}} +Content-Type: application/json + +### Test 06: Try to modify an existing users without a session token +### Negative test +@useId = {{users.response.body.0.userId}} +PUT {{BASE}}/users/{{useId}} +Content-Type: application/json + +{ + "firstName": ###REPLACE###, + "lastName": ###REPLACE###, + "telephone": ###REPLACE###, + "email": ###REPLACE###, + "username": ###REPLACE###, + "password": ###REPLACE###, + "avatarUrl": ###REPLACE### +} + +### Test 07: Delete an existing users +### Positive test + +### Create a new users, which we will delete +# @name createduseToDelete +POST {{BASE}}/users +Content-Type: application/json +Token: {{token}} + +{ + "firstName": ###REPLACE###, + "lastName": ###REPLACE###, + "telephone": ###REPLACE###, + "email": ###REPLACE###, + "username": ###REPLACE###, + "password": ###REPLACE###, + "avatarUrl": ###REPLACE### +} + +### Check the created users +@usedelId = {{createduseToDelete.response.body.lastId}} +GET {{BASE}}/users/{{usedelId}} +Content-Type: application/json + +### Delete the users +DELETE {{BASE}}/users/{{usedelId}} +Token: {{token}} + +### Check the deleted users +GET {{BASE}}/users/{{usedelId}} +Content-Type: application/json + +### Test 08: Try to delete a users without a session token +### Negative test +DELETE {{BASE}}/users/{{useId}} + diff --git a/tests/auto/usersfollows.http b/tests/auto/usersfollows.http new file mode 100644 index 00000000..d87b8d75 --- /dev/null +++ b/tests/auto/usersfollows.http @@ -0,0 +1,132 @@ + +### This is an auto-generated test suite, it needs to be completed with valid data. +### These are not all tests you need, more of them should be created to evaluate the functional +### requirements of your project. These tests only test the CRUD endpoints of the entity. +### Silence is a DEAL research team project, more info about us in https://deal.us.es +@BASE = http://127.0.0.1:8080/api/v1 + +### Auxiliary query +### Positive test +### Test 00: Get all existing usersfollows +### This query is used in several of the below tests it should be executed first. +# @name usersfollows +GET {{BASE}}/usersfollows + +### Login a(n) users and save the generated token +### This token is used in several of the below tests it should be executed second. +# @name login +POST {{BASE}}/login +Content-Type: application/json + +{ + "username": ###REPLACE###, + "password": ###REPLACE### +} + +### +@token = {{login.response.body.sessionToken}} + + +### TESTS BEGIN + +### Test 01: Get one existing usersfollows by its id. +### positive test +@useId = {{usersfollows.response.body.0.id}} +GET {{BASE}}/usersfollows/{{useId}} +Content-Type: application/json + + +### Test 02: Try get one existing usersfollows by its nonexistent id. +### negative test +GET {{BASE}}/usersfollows/999999999 +Content-Type: application/json + + +### Test 03: Add a new usersfollows successfully +### Positive test +### We assume that the token has been aquired by the login request. +# @name newusersfollows +POST {{BASE}}/usersfollows +Content-Type: application/json +Token: {{token}} + +{ + "followerId": ###REPLACE###, + "followedId": ###REPLACE### +} + +### Check the created usersfollows + +@newusersfollowsid = {{newusersfollows.response.body.lastId}} +GET {{BASE}}/usersfollows/{{newusersfollowsid}} +Content-Type: application/json + +### Test 04: Add a new usersfollows without a session token +### Negative test +POST {{BASE}}/usersfollows +Content-Type: application/json + +{ + "followerId": ###REPLACE###, + "followedId": ###REPLACE### +} + +### Test 05: Modify an existing usersfollows +### Positive test +@useId = {{usersfollows.response.body.0.id}} +PUT {{BASE}}/usersfollows/{{useId}} +Content-Type: application/json +Token: {{token}} + +{ + "followerId": ###REPLACE###, + "followedId": ###REPLACE### +} + +### Check the modified usersfollows + +GET {{BASE}}/usersfollows/{{newusersfollowsid}} +Content-Type: application/json + +### Test 06: Try to modify an existing usersfollows without a session token +### Negative test +@useId = {{usersfollows.response.body.0.id}} +PUT {{BASE}}/usersfollows/{{useId}} +Content-Type: application/json + +{ + "followerId": ###REPLACE###, + "followedId": ###REPLACE### +} + +### Test 07: Delete an existing usersfollows +### Positive test + +### Create a new usersfollows, which we will delete +# @name createduseToDelete +POST {{BASE}}/usersfollows +Content-Type: application/json +Token: {{token}} + +{ + "followerId": ###REPLACE###, + "followedId": ###REPLACE### +} + +### Check the created usersfollows +@usedelId = {{createduseToDelete.response.body.lastId}} +GET {{BASE}}/usersfollows/{{usedelId}} +Content-Type: application/json + +### Delete the usersfollows +DELETE {{BASE}}/usersfollows/{{usedelId}} +Token: {{token}} + +### Check the deleted usersfollows +GET {{BASE}}/usersfollows/{{usedelId}} +Content-Type: application/json + +### Test 08: Try to delete a usersfollows without a session token +### Negative test +DELETE {{BASE}}/usersfollows/{{useId}} + diff --git a/tests/auto/votes.http b/tests/auto/votes.http new file mode 100644 index 00000000..4592fcab --- /dev/null +++ b/tests/auto/votes.http @@ -0,0 +1,142 @@ + +### This is an auto-generated test suite, it needs to be completed with valid data. +### These are not all tests you need, more of them should be created to evaluate the functional +### requirements of your project. These tests only test the CRUD endpoints of the entity. +### Silence is a DEAL research team project, more info about us in https://deal.us.es +@BASE = http://127.0.0.1:8080/api/v1 + +### Auxiliary query +### Positive test +### Test 00: Get all existing votes +### This query is used in several of the below tests it should be executed first. +# @name votes +GET {{BASE}}/votes + +### Login a(n) users and save the generated token +### This token is used in several of the below tests it should be executed second. +# @name login +POST {{BASE}}/login +Content-Type: application/json + +{ + "username": ###REPLACE###, + "password": ###REPLACE### +} + +### +@token = {{login.response.body.sessionToken}} + + +### TESTS BEGIN + +### Test 01: Get one existing votes by its id. +### positive test +@votId = {{votes.response.body.0.voteId}} +GET {{BASE}}/votes/{{votId}} +Content-Type: application/json + + +### Test 02: Try get one existing votes by its nonexistent id. +### negative test +GET {{BASE}}/votes/999999999 +Content-Type: application/json + + +### Test 03: Add a new votes successfully +### Positive test +### We assume that the token has been aquired by the login request. +# @name newvotes +POST {{BASE}}/votes +Content-Type: application/json +Token: {{token}} + +{ + "value": ###REPLACE###, + "date": ###REPLACE###, + "userId": ###REPLACE###, + "photoId": ###REPLACE### +} + +### Check the created votes + +@newvotesid = {{newvotes.response.body.lastId}} +GET {{BASE}}/votes/{{newvotesid}} +Content-Type: application/json + +### Test 04: Add a new votes without a session token +### Negative test +POST {{BASE}}/votes +Content-Type: application/json + +{ + "value": ###REPLACE###, + "date": ###REPLACE###, + "userId": ###REPLACE###, + "photoId": ###REPLACE### +} + +### Test 05: Modify an existing votes +### Positive test +@votId = {{votes.response.body.0.voteId}} +PUT {{BASE}}/votes/{{votId}} +Content-Type: application/json +Token: {{token}} + +{ + "value": ###REPLACE###, + "date": ###REPLACE###, + "userId": ###REPLACE###, + "photoId": ###REPLACE### +} + +### Check the modified votes + +GET {{BASE}}/votes/{{newvotesid}} +Content-Type: application/json + +### Test 06: Try to modify an existing votes without a session token +### Negative test +@votId = {{votes.response.body.0.voteId}} +PUT {{BASE}}/votes/{{votId}} +Content-Type: application/json + +{ + "value": ###REPLACE###, + "date": ###REPLACE###, + "userId": ###REPLACE###, + "photoId": ###REPLACE### +} + +### Test 07: Delete an existing votes +### Positive test + +### Create a new votes, which we will delete +# @name createdvotToDelete +POST {{BASE}}/votes +Content-Type: application/json +Token: {{token}} + +{ + "value": ###REPLACE###, + "date": ###REPLACE###, + "userId": ###REPLACE###, + "photoId": ###REPLACE### +} + +### Check the created votes +@votdelId = {{createdvotToDelete.response.body.lastId}} +GET {{BASE}}/votes/{{votdelId}} +Content-Type: application/json + +### Delete the votes +DELETE {{BASE}}/votes/{{votdelId}} +Token: {{token}} + +### Check the deleted votes +GET {{BASE}}/votes/{{votdelId}} +Content-Type: application/json + +### Test 08: Try to delete a votes without a session token +### Negative test +DELETE {{BASE}}/votes/{{votId}} + diff --git a/web/index.html b/web/index.html index e69de29b..a5d188ca 100644 --- a/web/index.html +++ b/web/index.html @@ -0,0 +1,24 @@ + + + + + + My first web + + + + + Go to register.html + +

La lista de la compra es:

+ + + Un lindo paisaje + + \ No newline at end of file diff --git a/web/js/api/_auth.js b/web/js/api/_auth.js new file mode 100644 index 00000000..c2ea02f9 --- /dev/null +++ b/web/js/api/_auth.js @@ -0,0 +1,29 @@ +/* + * DO NOT EDIT THIS FILE, it is auto-generated. It will be updated automatically. + * All changes done to this file will be lost upon re-running the 'silence createapi' command. + * If you want to create new API methods, define them in a new file. + * + * Silence is built and maintained by the DEAL research group at the University of Seville. + * You can find us at https://deal.us.es + */ + +"use strict"; + +import { BASE_URL, requestOptions } from './common.js'; + +const authAPI_auto = { + + /** Logs in using an identifier and password */ + login: async function(formData) { + let response = await axios.post(`${BASE_URL}/login`, formData, requestOptions); + return response.data; + }, + + /** Registers a new user and stores the password safely in the database */ + register: async function(formData) { + let response = await axios.post(`${BASE_URL}/register`, formData, requestOptions); + return response.data; + }, +}; + +export { authAPI_auto }; \ No newline at end of file diff --git a/web/js/api/_badwords.js b/web/js/api/_badwords.js new file mode 100644 index 00000000..e865b109 --- /dev/null +++ b/web/js/api/_badwords.js @@ -0,0 +1,47 @@ +/* + * DO NOT EDIT THIS FILE, it is auto-generated. It will be updated automatically. + * All changes done to this file will be lost upon re-running the 'silence createapi' command. + * If you want to create new API methods, define them in a new file. + * + * Silence is built and maintained by the DEAL research group at the University of Seville. + * You can find us at https://deal.us.es + */ + +"use strict"; + +import { BASE_URL, requestOptions } from './common.js'; + +const badwordsAPI_auto = { + + /** Gets all entries from 'badwords' */ + getAll: async function() { + let response = await axios.get(`${BASE_URL}/badwords`, requestOptions); + return response.data; + }, + + /** Gets an entry from 'badwords' by its primary key */ + getById: async function(wordId) { + let response = await axios.get(`${BASE_URL}/badwords/${wordId}`, requestOptions); + return response.data[0]; + }, + + /** Creates a new entry in 'badwords' */ + create: async function(formData) { + let response = await axios.post(`${BASE_URL}/badwords`, formData, requestOptions); + return response.data; + }, + + /** Updates an existing entry in 'badwords' by its primary key */ + update: async function(formData, wordId) { + let response = await axios.put(`${BASE_URL}/badwords/${wordId}`, formData, requestOptions); + return response.data; + }, + + /** Deletes an existing entry in 'badwords' by its primary key */ + delete: async function(wordId) { + let response = await axios.delete(`${BASE_URL}/badwords/${wordId}`, requestOptions); + return response.data; + }, +}; + +export { badwordsAPI_auto }; \ No newline at end of file diff --git a/web/js/api/_comments.js b/web/js/api/_comments.js new file mode 100644 index 00000000..81c62567 --- /dev/null +++ b/web/js/api/_comments.js @@ -0,0 +1,47 @@ +/* + * DO NOT EDIT THIS FILE, it is auto-generated. It will be updated automatically. + * All changes done to this file will be lost upon re-running the 'silence createapi' command. + * If you want to create new API methods, define them in a new file. + * + * Silence is built and maintained by the DEAL research group at the University of Seville. + * You can find us at https://deal.us.es + */ + +"use strict"; + +import { BASE_URL, requestOptions } from './common.js'; + +const commentsAPI_auto = { + + /** Gets all entries from 'comments' */ + getAll: async function() { + let response = await axios.get(`${BASE_URL}/comments`, requestOptions); + return response.data; + }, + + /** Gets an entry from 'comments' by its primary key */ + getById: async function(commentId) { + let response = await axios.get(`${BASE_URL}/comments/${commentId}`, requestOptions); + return response.data[0]; + }, + + /** Creates a new entry in 'comments' */ + create: async function(formData) { + let response = await axios.post(`${BASE_URL}/comments`, formData, requestOptions); + return response.data; + }, + + /** Updates an existing entry in 'comments' by its primary key */ + update: async function(formData, commentId) { + let response = await axios.put(`${BASE_URL}/comments/${commentId}`, formData, requestOptions); + return response.data; + }, + + /** Deletes an existing entry in 'comments' by its primary key */ + delete: async function(commentId) { + let response = await axios.delete(`${BASE_URL}/comments/${commentId}`, requestOptions); + return response.data; + }, +}; + +export { commentsAPI_auto }; \ No newline at end of file diff --git a/web/js/api/_commentswithusers.js b/web/js/api/_commentswithusers.js new file mode 100644 index 00000000..970d42aa --- /dev/null +++ b/web/js/api/_commentswithusers.js @@ -0,0 +1,23 @@ +/* + * DO NOT EDIT THIS FILE, it is auto-generated. It will be updated automatically. + * All changes done to this file will be lost upon re-running the 'silence createapi' command. + * If you want to create new API methods, define them in a new file. + * + * Silence is built and maintained by the DEAL research group at the University of Seville. + * You can find us at https://deal.us.es + */ + +"use strict"; + +import { BASE_URL, requestOptions } from './common.js'; + +const commentswithusersAPI_auto = { + + /** Gets all entries from 'commentswithusers' */ + getAll: async function() { + let response = await axios.get(`${BASE_URL}/commentswithusers`, requestOptions); + return response.data; + }, +}; + +export { commentswithusersAPI_auto }; \ No newline at end of file diff --git a/web/js/api/_photos.js b/web/js/api/_photos.js new file mode 100644 index 00000000..b598d2c2 --- /dev/null +++ b/web/js/api/_photos.js @@ -0,0 +1,47 @@ +/* + * DO NOT EDIT THIS FILE, it is auto-generated. It will be updated automatically. + * All changes done to this file will be lost upon re-running the 'silence createapi' command. + * If you want to create new API methods, define them in a new file. + * + * Silence is built and maintained by the DEAL research group at the University of Seville. + * You can find us at https://deal.us.es + */ + +"use strict"; + +import { BASE_URL, requestOptions } from './common.js'; + +const photosAPI_auto = { + + /** Gets all entries from 'photos' */ + getAll: async function() { + let response = await axios.get(`${BASE_URL}/photos`, requestOptions); + return response.data; + }, + + /** Gets an entry from 'photos' by its primary key */ + getById: async function(photoId) { + let response = await axios.get(`${BASE_URL}/photos/${photoId}`, requestOptions); + return response.data[0]; + }, + + /** Creates a new entry in 'photos' */ + create: async function(formData) { + let response = await axios.post(`${BASE_URL}/photos`, formData, requestOptions); + return response.data; + }, + + /** Updates an existing entry in 'photos' by its primary key */ + update: async function(formData, photoId) { + let response = await axios.put(`${BASE_URL}/photos/${photoId}`, formData, requestOptions); + return response.data; + }, + + /** Deletes an existing entry in 'photos' by its primary key */ + delete: async function(photoId) { + let response = await axios.delete(`${BASE_URL}/photos/${photoId}`, requestOptions); + return response.data; + }, +}; + +export { photosAPI_auto }; \ No newline at end of file diff --git a/web/js/api/_photostags.js b/web/js/api/_photostags.js new file mode 100644 index 00000000..23ac3528 --- /dev/null +++ b/web/js/api/_photostags.js @@ -0,0 +1,47 @@ +/* + * DO NOT EDIT THIS FILE, it is auto-generated. It will be updated automatically. + * All changes done to this file will be lost upon re-running the 'silence createapi' command. + * If you want to create new API methods, define them in a new file. + * + * Silence is built and maintained by the DEAL research group at the University of Seville. + * You can find us at https://deal.us.es + */ + +"use strict"; + +import { BASE_URL, requestOptions } from './common.js'; + +const photostagsAPI_auto = { + + /** Gets all entries from 'photostags' */ + getAll: async function() { + let response = await axios.get(`${BASE_URL}/photostags`, requestOptions); + return response.data; + }, + + /** Gets an entry from 'photostags' by its primary key */ + getById: async function(photoTagId) { + let response = await axios.get(`${BASE_URL}/photostags/${photoTagId}`, requestOptions); + return response.data[0]; + }, + + /** Creates a new entry in 'photostags' */ + create: async function(formData) { + let response = await axios.post(`${BASE_URL}/photostags`, formData, requestOptions); + return response.data; + }, + + /** Updates an existing entry in 'photostags' by its primary key */ + update: async function(formData, photoTagId) { + let response = await axios.put(`${BASE_URL}/photostags/${photoTagId}`, formData, requestOptions); + return response.data; + }, + + /** Deletes an existing entry in 'photostags' by its primary key */ + delete: async function(photoTagId) { + let response = await axios.delete(`${BASE_URL}/photostags/${photoTagId}`, requestOptions); + return response.data; + }, +}; + +export { photostagsAPI_auto }; \ No newline at end of file diff --git a/web/js/api/_photoswithusers.js b/web/js/api/_photoswithusers.js new file mode 100644 index 00000000..e75bcd3e --- /dev/null +++ b/web/js/api/_photoswithusers.js @@ -0,0 +1,23 @@ +/* + * DO NOT EDIT THIS FILE, it is auto-generated. It will be updated automatically. + * All changes done to this file will be lost upon re-running the 'silence createapi' command. + * If you want to create new API methods, define them in a new file. + * + * Silence is built and maintained by the DEAL research group at the University of Seville. + * You can find us at https://deal.us.es + */ + +"use strict"; + +import { BASE_URL, requestOptions } from './common.js'; + +const photoswithusersAPI_auto = { + + /** Gets all entries from 'photoswithusers' */ + getAll: async function() { + let response = await axios.get(`${BASE_URL}/photoswithusers`, requestOptions); + return response.data; + }, +}; + +export { photoswithusersAPI_auto }; \ No newline at end of file diff --git a/web/js/api/_tags.js b/web/js/api/_tags.js new file mode 100644 index 00000000..e550c230 --- /dev/null +++ b/web/js/api/_tags.js @@ -0,0 +1,47 @@ +/* + * DO NOT EDIT THIS FILE, it is auto-generated. It will be updated automatically. + * All changes done to this file will be lost upon re-running the 'silence createapi' command. + * If you want to create new API methods, define them in a new file. + * + * Silence is built and maintained by the DEAL research group at the University of Seville. + * You can find us at https://deal.us.es + */ + +"use strict"; + +import { BASE_URL, requestOptions } from './common.js'; + +const tagsAPI_auto = { + + /** Gets all entries from 'tags' */ + getAll: async function() { + let response = await axios.get(`${BASE_URL}/tags`, requestOptions); + return response.data; + }, + + /** Gets an entry from 'tags' by its primary key */ + getById: async function(tagId) { + let response = await axios.get(`${BASE_URL}/tags/${tagId}`, requestOptions); + return response.data[0]; + }, + + /** Creates a new entry in 'tags' */ + create: async function(formData) { + let response = await axios.post(`${BASE_URL}/tags`, formData, requestOptions); + return response.data; + }, + + /** Updates an existing entry in 'tags' by its primary key */ + update: async function(formData, tagId) { + let response = await axios.put(`${BASE_URL}/tags/${tagId}`, formData, requestOptions); + return response.data; + }, + + /** Deletes an existing entry in 'tags' by its primary key */ + delete: async function(tagId) { + let response = await axios.delete(`${BASE_URL}/tags/${tagId}`, requestOptions); + return response.data; + }, +}; + +export { tagsAPI_auto }; \ No newline at end of file diff --git a/web/js/api/_users.js b/web/js/api/_users.js new file mode 100644 index 00000000..4475f9f0 --- /dev/null +++ b/web/js/api/_users.js @@ -0,0 +1,47 @@ +/* + * DO NOT EDIT THIS FILE, it is auto-generated. It will be updated automatically. + * All changes done to this file will be lost upon re-running the 'silence createapi' command. + * If you want to create new API methods, define them in a new file. + * + * Silence is built and maintained by the DEAL research group at the University of Seville. + * You can find us at https://deal.us.es + */ + +"use strict"; + +import { BASE_URL, requestOptions } from './common.js'; + +const usersAPI_auto = { + + /** Gets all entries from 'users' */ + getAll: async function() { + let response = await axios.get(`${BASE_URL}/users`, requestOptions); + return response.data; + }, + + /** Gets an entry from 'users' by its primary key */ + getById: async function(userId) { + let response = await axios.get(`${BASE_URL}/users/${userId}`, requestOptions); + return response.data[0]; + }, + + /** Creates a new entry in 'users' */ + create: async function(formData) { + let response = await axios.post(`${BASE_URL}/users`, formData, requestOptions); + return response.data; + }, + + /** Updates an existing entry in 'users' by its primary key */ + update: async function(formData, userId) { + let response = await axios.put(`${BASE_URL}/users/${userId}`, formData, requestOptions); + return response.data; + }, + + /** Deletes an existing entry in 'users' by its primary key */ + delete: async function(userId) { + let response = await axios.delete(`${BASE_URL}/users/${userId}`, requestOptions); + return response.data; + }, +}; + +export { usersAPI_auto }; \ No newline at end of file diff --git a/web/js/api/_usersfollows.js b/web/js/api/_usersfollows.js new file mode 100644 index 00000000..53846dc9 --- /dev/null +++ b/web/js/api/_usersfollows.js @@ -0,0 +1,47 @@ +/* + * DO NOT EDIT THIS FILE, it is auto-generated. It will be updated automatically. + * All changes done to this file will be lost upon re-running the 'silence createapi' command. + * If you want to create new API methods, define them in a new file. + * + * Silence is built and maintained by the DEAL research group at the University of Seville. + * You can find us at https://deal.us.es + */ + +"use strict"; + +import { BASE_URL, requestOptions } from './common.js'; + +const usersfollowsAPI_auto = { + + /** Gets all entries from 'usersfollows' */ + getAll: async function() { + let response = await axios.get(`${BASE_URL}/usersfollows`, requestOptions); + return response.data; + }, + + /** Gets an entry from 'usersfollows' by its primary key */ + getById: async function(id) { + let response = await axios.get(`${BASE_URL}/usersfollows/${id}`, requestOptions); + return response.data[0]; + }, + + /** Creates a new entry in 'usersfollows' */ + create: async function(formData) { + let response = await axios.post(`${BASE_URL}/usersfollows`, formData, requestOptions); + return response.data; + }, + + /** Updates an existing entry in 'usersfollows' by its primary key */ + update: async function(formData, id) { + let response = await axios.put(`${BASE_URL}/usersfollows/${id}`, formData, requestOptions); + return response.data; + }, + + /** Deletes an existing entry in 'usersfollows' by its primary key */ + delete: async function(id) { + let response = await axios.delete(`${BASE_URL}/usersfollows/${id}`, requestOptions); + return response.data; + }, +}; + +export { usersfollowsAPI_auto }; \ No newline at end of file diff --git a/web/js/api/_votes.js b/web/js/api/_votes.js new file mode 100644 index 00000000..e4830931 --- /dev/null +++ b/web/js/api/_votes.js @@ -0,0 +1,47 @@ +/* + * DO NOT EDIT THIS FILE, it is auto-generated. It will be updated automatically. + * All changes done to this file will be lost upon re-running the 'silence createapi' command. + * If you want to create new API methods, define them in a new file. + * + * Silence is built and maintained by the DEAL research group at the University of Seville. + * You can find us at https://deal.us.es + */ + +"use strict"; + +import { BASE_URL, requestOptions } from './common.js'; + +const votesAPI_auto = { + + /** Gets all entries from 'votes' */ + getAll: async function() { + let response = await axios.get(`${BASE_URL}/votes`, requestOptions); + return response.data; + }, + + /** Gets an entry from 'votes' by its primary key */ + getById: async function(voteId) { + let response = await axios.get(`${BASE_URL}/votes/${voteId}`, requestOptions); + return response.data[0]; + }, + + /** Creates a new entry in 'votes' */ + create: async function(formData) { + let response = await axios.post(`${BASE_URL}/votes`, formData, requestOptions); + return response.data; + }, + + /** Updates an existing entry in 'votes' by its primary key */ + update: async function(formData, voteId) { + let response = await axios.put(`${BASE_URL}/votes/${voteId}`, formData, requestOptions); + return response.data; + }, + + /** Deletes an existing entry in 'votes' by its primary key */ + delete: async function(voteId) { + let response = await axios.delete(`${BASE_URL}/votes/${voteId}`, requestOptions); + return response.data; + }, +}; + +export { votesAPI_auto }; \ No newline at end of file diff --git a/web/register.html b/web/register.html new file mode 100644 index 00000000..8e2793fa --- /dev/null +++ b/web/register.html @@ -0,0 +1,20 @@ + + + + Register form + + + +
+

Introduzca sus datos:

+

First name:

+

Last name:

+

Email:

+

Password:

+

Send:

+
+ Volver a la pagina principal + + + + \ No newline at end of file