Skip to content

Commit

Permalink
Merge pull request #14 from fmIst0/improvements
Browse files Browse the repository at this point in the history
added default admin user for AWS to test methods only for admins
  • Loading branch information
fmIst0 authored Oct 5, 2023
2 parents f8901a2 + f6c0316 commit f6d3b09
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@ Docker Compose with command : `docker-compose up`

## Or try to test with [Swagger](http://ec2-16-170-234-204.eu-north-1.compute.amazonaws.com/swagger-ui/index.html#/)📍

### Login
{<br/>
"email": "[email protected]",<br/>
"password": "1234567890"<br/>
}




Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
databaseChangeLog:
- changeSet:
id: add-admin-to-users-table
author: fmIst0
changes:
- insert:
tableName: users
columns:
- column:
{name: "email", value: "[email protected]"}
- column:
{name: "password", value: "1234567890"}
- column:
{name: "first_name", value: "Bob"}
- column:
{name: "last_name", value: "Doe"}
- column:
{name: "shipping_address", value: "New Shipping Address"}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
databaseChangeLog:
- changeSet:
id: give-admin-role-to-user
author: fmIst0
changes:
- sql:
dbms: mysql
sql: |
INSERT INTO users_roles (user_id, role_id)
SELECT id, 1
FROM users
WHERE email = '[email protected]'
- sql:
dbms: mysql
sql: |
INSERT INTO users_roles (user_id, role_id)
SELECT id, 2
FROM users
WHERE email = '[email protected]'
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
databaseChangeLog:
- changeSet:
id: reset-to-bencrypted-password-for-user
author: fmIst0
changes:
- update:
tableName: users
columns:
- column:
name: password
value: "$2a$10$v4st87IQUD8HRp07RoTbd.QOOU7VXLVaOORFx5UNbr6Galn8/O.lW"
where: email='[email protected]'
8 changes: 7 additions & 1 deletion src/main/resources/db/changelog/db.changelog-master.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,10 @@ databaseChangeLog:
- include:
file: db/changelog/changes/14-modify-data-type-order_total-order_items_price.yaml
- include:
file: db/changelog/changes/15-make-column-name-categories-unique.yaml
file: db/changelog/changes/15-make-column-name-categories-unique.yaml
- include:
file: db/changelog/changes/16-add-admin-to-users-table.yaml
- include:
file: db/changelog/changes/17-give-admin-role-to-user.yaml
- include:
file: db/changelog/changes/17-reset-to-bencrypted-password-for-user.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ static void teardown(DataSource dataSource) {
connection,
new ClassPathResource("database/shopping_carts/delete-from-shopping_carts.sql")
);
ScriptUtils.executeSqlScript(
connection,
new ClassPathResource("database/users_roles/delete-from-users-roles.sql")
);
ScriptUtils.executeSqlScript(
connection,
new ClassPathResource("database/users/delete-from-users.sql")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DELETE FROM users_roles;

0 comments on commit f6d3b09

Please sign in to comment.