From 518641f610648bfe249a3022df0923a95a760708 Mon Sep 17 00:00:00 2001 From: esensar Date: Fri, 24 Mar 2017 00:40:02 +0100 Subject: [PATCH] Add postman collections --- events/build.gradle | 1 - .../production/events/application.properties | 24 + .../ba/steleks/repository/model/Media.java | 6 +- .../src/main/resources/application.properties | 46 +- .../Local.postman_environment.json | 35 ++ .../Steleks%20Backend.postman_collection.json | 479 ++++++++++++++++++ 6 files changed, 564 insertions(+), 27 deletions(-) create mode 100644 events/out/production/events/application.properties create mode 100644 postman collections/Local.postman_environment.json create mode 100644 postman collections/Steleks%20Backend.postman_collection.json diff --git a/events/build.gradle b/events/build.gradle index dda8709..05de41e 100644 --- a/events/build.gradle +++ b/events/build.gradle @@ -23,7 +23,6 @@ repositories { dependencies { - compile("users") compile("org.springframework.boot:spring-boot-starter-data-rest") compile('org.springframework.boot:spring-boot-starter-data-jpa') runtime('com.h2database:h2') diff --git a/events/out/production/events/application.properties b/events/out/production/events/application.properties new file mode 100644 index 0000000..edb8b0d --- /dev/null +++ b/events/out/production/events/application.properties @@ -0,0 +1,24 @@ +server.port = 9000 + +spring.datasource.url = jdbc:mysql://localhost:3306/events +spring.datasource.username = root +spring.datasource.password = 1DvaTri! + +# Keep the connection alive if idle for a long time (needed in production) +spring.datasource.testWhileIdle = true +spring.datasource.validationQuery = SELECT 1 + +# Show or not log for each sql query +spring.jpa.show-sql = true + +# Hibernate ddl auto (create, create-drop, update) +spring.jpa.hibernate.ddl-auto = update + +# Naming strategy +spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy + +# Use spring.jpa.properties.* for Hibernate native properties (the prefix is +# stripped before adding them to the entity manager) + +# The SQL dialect makes Hibernate generate better SQL for the chosen database +spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect \ No newline at end of file diff --git a/events/src/main/java/ba/steleks/repository/model/Media.java b/events/src/main/java/ba/steleks/repository/model/Media.java index 334c96e..175802c 100644 --- a/events/src/main/java/ba/steleks/repository/model/Media.java +++ b/events/src/main/java/ba/steleks/repository/model/Media.java @@ -19,7 +19,7 @@ public class Media { private String contentUrl; private Date creationDate; - private String createdById; + private long createdById; public Media() { } @@ -48,11 +48,11 @@ public class Media { this.creationDate = creationDate; } - public String getCreatedById() { + public long getCreatedById() { return createdById; } - public void setCreatedById(String createdById) { + public void setCreatedById(long createdById) { this.createdById = createdById; } } diff --git a/events/src/main/resources/application.properties b/events/src/main/resources/application.properties index edb8b0d..f171311 100644 --- a/events/src/main/resources/application.properties +++ b/events/src/main/resources/application.properties @@ -1,24 +1,24 @@ server.port = 9000 - -spring.datasource.url = jdbc:mysql://localhost:3306/events -spring.datasource.username = root -spring.datasource.password = 1DvaTri! - -# Keep the connection alive if idle for a long time (needed in production) -spring.datasource.testWhileIdle = true -spring.datasource.validationQuery = SELECT 1 - -# Show or not log for each sql query -spring.jpa.show-sql = true - -# Hibernate ddl auto (create, create-drop, update) -spring.jpa.hibernate.ddl-auto = update - -# Naming strategy -spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy - -# Use spring.jpa.properties.* for Hibernate native properties (the prefix is -# stripped before adding them to the entity manager) - -# The SQL dialect makes Hibernate generate better SQL for the chosen database -spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect \ No newline at end of file +# +#spring.datasource.url = jdbc:mysql://localhost:3306/events +#spring.datasource.username = root +#spring.datasource.password = 1DvaTri! +# +## Keep the connection alive if idle for a long time (needed in production) +#spring.datasource.testWhileIdle = true +#spring.datasource.validationQuery = SELECT 1 +# +## Show or not log for each sql query +#spring.jpa.show-sql = true +# +## Hibernate ddl auto (create, create-drop, update) +#spring.jpa.hibernate.ddl-auto = update +# +## Naming strategy +#spring.jpa.hibernate.naming-strategy = org.hibernate.cfg.ImprovedNamingStrategy +# +## Use spring.jpa.properties.* for Hibernate native properties (the prefix is +## stripped before adding them to the entity manager) +# +## The SQL dialect makes Hibernate generate better SQL for the chosen database +#spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5Dialect \ No newline at end of file diff --git a/postman collections/Local.postman_environment.json b/postman collections/Local.postman_environment.json new file mode 100644 index 0000000..4250f7f --- /dev/null +++ b/postman collections/Local.postman_environment.json @@ -0,0 +1,35 @@ +{ + "id": "f9241756-1b82-e149-d0d5-9269bf40e003", + "name": "Local", + "values": [ + { + "key": "url", + "type": "text", + "value": "localhost", + "enabled": true + }, + { + "key": "usersPort", + "type": "text", + "value": "8090", + "enabled": true + }, + { + "key": "eventsPort", + "type": "text", + "value": "9000", + "enabled": true + }, + { + "key": "teamsPort", + "type": "text", + "value": "9010", + "enabled": true + } + ], + "timestamp": 1490312377323, + "synced": false, + "syncedFilename": "", + "team": null, + "isDeleted": false +} \ No newline at end of file diff --git a/postman collections/Steleks%20Backend.postman_collection.json b/postman collections/Steleks%20Backend.postman_collection.json new file mode 100644 index 0000000..e03fa9f --- /dev/null +++ b/postman collections/Steleks%20Backend.postman_collection.json @@ -0,0 +1,479 @@ +{ + "variables": [], + "info": { + "name": "Steleks Backend", + "_postman_id": "ef580742-4589-8237-e6de-a870eb8253e9", + "description": "", + "schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json" + }, + "item": [ + { + "name": "Courses", + "description": "", + "item": [ + { + "name": "Get All Courses", + "request": { + "url": "http://{{url}}:{{usersPort}}/courses", + "method": "GET", + "header": [], + "body": { + "mode": "formdata", + "formdata": [] + }, + "description": "" + }, + "response": [] + }, + { + "name": "Add Course", + "request": { + "url": "http://{{url}}:{{usersPort}}/courses", + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"courseName\":\"TRECA\"\n}" + }, + "description": "" + }, + "response": [] + } + ] + }, + { + "name": "Events", + "description": "", + "item": [ + { + "name": "Get All", + "request": { + "url": "http://{{url}}:{{eventsPort}}", + "method": "GET", + "header": [], + "body": { + "mode": "formdata", + "formdata": [] + }, + "description": "" + }, + "response": [] + }, + { + "name": "Add Event", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": "\nvar jsonData = JSON.parse(responseBody);\nvar arr = jsonData._links.self.href.split(\"/\");\npostman.setEnvironmentVariable(\"eventId\", arr[4]);" + } + } + ], + "request": { + "url": "http://{{url}}:{{eventsPort}}/events", + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"title\":\"Testni\",\n \"shortText\":\"Txt\",\n \"longText\":\"Textcina\"\n}" + }, + "description": "" + }, + "response": [] + }, + { + "name": "Get Events", + "request": { + "url": "http://{{url}}:{{eventsPort}}/events", + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"title\":\"Testni\",\n \"shortText\":\"Txt\",\n \"longText\":\"Textcina\"\n}" + }, + "description": "" + }, + "response": [] + }, + { + "name": "Get Event", + "request": { + "url": "http://{{url}}:{{eventsPort}}/events/{{eventId}}", + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"title\":\"Testni\",\n \"shortText\":\"Txt\",\n \"longText\":\"Textcina\"\n}" + }, + "description": "" + }, + "response": [] + }, + { + "name": "Get Event Medias", + "request": { + "url": "http://{{url}}:{{eventsPort}}/events/{{eventId}}/mediaSet", + "method": "GET", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"title\":\"Testni\",\n \"shortText\":\"Txt\",\n \"longText\":\"Textcina\"\n}" + }, + "description": "" + }, + "response": [] + }, + { + "name": "Add Media To Event", + "request": { + "url": "http://{{url}}:{{eventsPort}}/events/{{eventId}}/mediaSet", + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "text/uri-list", + "description": "" + } + ], + "body": { + "mode": "raw", + "raw": "http://{{url}}:{{eventsPort}}/medias/1" + }, + "description": "" + }, + "response": [] + } + ] + }, + { + "name": "Media", + "description": "", + "item": [ + { + "name": "Add Media", + "request": { + "url": "http://{{url}}:{{eventsPort}}/medias", + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"contentUrl\":\"http://www.google.com\"\n}" + }, + "description": "" + }, + "response": [] + }, + { + "name": "Get All Medias", + "request": { + "url": "http://{{url}}:{{eventsPort}}/medias", + "method": "GET", + "header": [], + "body": { + "mode": "formdata", + "formdata": [] + }, + "description": "" + }, + "response": [] + } + ] + }, + { + "name": "Membership Types", + "description": "", + "item": [ + { + "name": "Get All Membership Types", + "request": { + "url": "http://{{url}}:{{usersPort}}/membershipTypes", + "method": "GET", + "header": [], + "body": { + "mode": "formdata", + "formdata": [] + }, + "description": "" + }, + "response": [] + }, + { + "name": "Add Membership Type", + "request": { + "url": "http://{{url}}:{{usersPort}}/membershipTypes", + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"membershipTypeName\":\"TRECA\"\n}" + }, + "description": "" + }, + "response": [] + } + ] + }, + { + "name": "Roles", + "description": "", + "item": [ + { + "name": "Get All User Roles", + "request": { + "url": "http://{{url}}:{{usersPort}}/userRoles", + "method": "GET", + "header": [], + "body": { + "mode": "formdata", + "formdata": [] + }, + "description": "" + }, + "response": [] + }, + { + "name": "Add User Role", + "request": { + "url": "http://{{url}}:{{usersPort}}/userRoles", + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"roleName\":\"TRECA\"\n}" + }, + "description": "" + }, + "response": [] + } + ] + }, + { + "name": "Users", + "description": "", + "item": [ + { + "name": "Get Users", + "request": { + "url": "http://{{url}}:{{usersPort}}/users", + "method": "GET", + "header": [], + "body": { + "mode": "formdata", + "formdata": [] + }, + "description": "" + }, + "response": [] + }, + { + "name": "Add User", + "event": [ + { + "listen": "test", + "script": { + "type": "text/javascript", + "exec": "\nvar jsonData = JSON.parse(responseBody);\nvar arr = jsonData._links.self.href.split(\"/\");\npostman.setEnvironmentVariable(\"userId\", arr[4]);" + } + } + ], + "request": { + "url": "http://{{url}}:{{usersPort}}/users", + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "application/json", + "description": "" + } + ], + "body": { + "mode": "raw", + "raw": "{\n \"firstName\":\"Testni\",\n \"lastName\":\"User\",\n \"username\":\"Juzernejm\"\n}" + }, + "description": "" + }, + "response": [] + }, + { + "name": "Add Roles To User", + "request": { + "url": "http://{{url}}:{{usersPort}}/users/{{userId}}/userRoles", + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "text/uri-list", + "description": "" + } + ], + "body": { + "mode": "raw", + "raw": "http://{{url}}:{{usersPort}}/userRoles/1" + }, + "description": "" + }, + "response": [] + }, + { + "name": "Get User", + "request": { + "url": "http://{{url}}:{{usersPort}}/users/{{userId}}", + "method": "GET", + "header": [], + "body": { + "mode": "formdata", + "formdata": [] + }, + "description": "" + }, + "response": [] + }, + { + "name": "Get User Roles", + "request": { + "url": "http://{{url}}:{{usersPort}}/users/{{userId}}/userRoles", + "method": "GET", + "header": [], + "body": { + "mode": "formdata", + "formdata": [] + }, + "description": "" + }, + "response": [] + }, + { + "name": "Add Courses To User", + "request": { + "url": "http://{{url}}:{{usersPort}}/users/{{userId}}/courses", + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "text/uri-list", + "description": "" + } + ], + "body": { + "mode": "raw", + "raw": "http://{{url}}:{{usersPort}}/courses/1" + }, + "description": "" + }, + "response": [] + }, + { + "name": "Get User Courses", + "request": { + "url": "http://{{url}}:{{usersPort}}/users/{{userId}}/courses", + "method": "GET", + "header": [], + "body": { + "mode": "formdata", + "formdata": [] + }, + "description": "" + }, + "response": [] + }, + { + "name": "Add Membership Types To User", + "request": { + "url": "http://{{url}}:{{usersPort}}/users/{{userId}}/membershipTypes", + "method": "POST", + "header": [ + { + "key": "Content-Type", + "value": "text/uri-list", + "description": "" + } + ], + "body": { + "mode": "raw", + "raw": "http://{{url}}:{{usersPort}}/membershipTypes/1" + }, + "description": "" + }, + "response": [] + }, + { + "name": "Get User Membership Types", + "request": { + "url": "http://{{url}}:{{usersPort}}/users/{{userId}}/membershipTypes", + "method": "GET", + "header": [], + "body": { + "mode": "formdata", + "formdata": [] + }, + "description": "" + }, + "response": [] + }, + { + "name": "Get All", + "request": { + "url": "http://{{url}}:{{usersPort}}", + "method": "GET", + "header": [], + "body": { + "mode": "formdata", + "formdata": [] + }, + "description": "" + }, + "response": [] + } + ] + } + ] +} \ No newline at end of file