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/requests/degrees.http b/requests/degrees.http new file mode 100644 index 00000000..16e8a603 --- /dev/null +++ b/requests/degrees.http @@ -0,0 +1,3 @@ +@BASE = http://127.0.0.1:8080/api/v1 + +GET {{BASE}}/users/1 \ No newline at end of file diff --git a/settings.py b/settings.py index bff9f5d7..9124dce3 100644 --- a/settings.py +++ b/settings.py @@ -9,8 +9,8 @@ DB_CONN = { "host": "127.0.0.1", "port": 3306, - "username": "iissi_user", - "password": "iissi$user", + "username": "iissi_user2", + "password": "iissi$user2", "database": "gallery", } @@ -20,7 +20,7 @@ "create_tables.sql", "create_views.sql", "populate_database.sql", -] +] # The port in which the API and the web server will be deployed HTTP_PORT = 8080 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