Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consumer Api: Deletion of Files, Tokens and Relationship Templates #934

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
d848d08
feat: Add file deletion command, handler, repository and controller
MH321Productions Oct 30, 2024
0e0b128
feat: Add file deletion command to Consumer Api SDK
MH321Productions Oct 30, 2024
d9f87e5
feat: Add file deletion command to bruno
MH321Productions Oct 30, 2024
0b62ae6
feat: Add command, handler and repository method for delete token end…
MH321Productions Oct 31, 2024
68e0891
feat: Add delete token endpoint to bruno and consumer api sdk
MH321Productions Oct 31, 2024
6fec1d3
feat: Migrate DB to make relationship template nullable in relationship
MH321Productions Nov 6, 2024
ae49df2
feat: Make Relationship Template nullable in Relationship
MH321Productions Nov 6, 2024
2a3c59c
feat: Add controller, command, handler, validator, sdk method and bru…
MH321Productions Nov 6, 2024
1736a46
chore: Add user b to bruno variables and update passwords
MH321Productions Nov 6, 2024
1221a52
chore: Add/update bruno files for multiple relationship endpoints
MH321Productions Nov 6, 2024
b8fc0fe
Merge branch 'main' into deletion-of-files-tokens-and-relationship-te…
MH321Productions Nov 6, 2024
9d4e9f1
chore: Make relationship template nullable in sdk types
MH321Productions Nov 6, 2024
8e0275c
test: Add integration test for relationship template deletion
MH321Productions Nov 6, 2024
3b1c30c
Merge branch 'main' into deletion-of-files-tokens-and-relationship-te…
mergify[bot] Nov 6, 2024
5ac2960
Merge branch 'main' into deletion-of-files-tokens-and-relationship-te…
mergify[bot] Nov 7, 2024
41725cd
Merge branch 'main' into deletion-of-files-tokens-and-relationship-te…
mergify[bot] Nov 8, 2024
2d26c7c
chore: Add tests for deletion, rewrite existing ones, refactor backin…
MH321Productions Nov 8, 2024
a95fdec
chore: Switch order for file deletion
MH321Productions Nov 8, 2024
0a17d1f
Merge branch 'main' into deletion-of-files-tokens-and-relationship-te…
mergify[bot] Nov 9, 2024
14a06a1
chore: Move owner checks to domain classes and rewrite domain exceptions
MH321Productions Nov 11, 2024
ba4bf2c
chore: Add unit tests for deletion check functions
MH321Productions Nov 11, 2024
6b68bef
chore: Change function and variable names to comply with convention
MH321Productions Nov 11, 2024
a03f31a
chore: Simplify used test functions
MH321Productions Nov 11, 2024
8294768
chore: Simplify test function
MH321Productions Nov 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
meta {
name: Get OAuth Token (B)
type: http
seq: 2
}

post {
url: {{auth.url}}
body: formUrlEncoded
auth: none
}

body:form-urlencoded {
grant_type: password
username: {{auth.username_b}}
password: {{auth.password_b}}
client_id: {{auth.client_id}}
client_secret: {{auth.client_secret}}
}

vars:post-response {
jwt.token: res.body.access_token
jwt.expires_in: res.body.expires_in
}
15 changes: 15 additions & 0 deletions Applications/ConsumerApi/src/http/Files/Delete File.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
meta {
name: /Files/{id}
type: http
seq: 5
}

delete {
url: {{baseUrl}}/Files/{{id}}
body: none
auth: inherit
}

vars:pre-request {
id: FILF5vUtJstbmLAr8A0z
}
2 changes: 1 addition & 1 deletion Applications/ConsumerApi/src/http/Files/Upload File.bru
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ post {
body:multipart-form {
content: @file(C:\Users\mherrman\Documents\Scrum Workshop.md)
cipherHash: AAAA
owner: id1CsU6VwBMgBA4TLc61nj895ZD1mPjbddNW
owner: did:e:localhost:dids:0f3e40164b6c495c28674f
expiresAt: 2024-12-07
encryptedProperties: AAAA
ownerSignature: AAAA
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
meta {
name: /RelationshipTemplates/{id}
type: http
seq: 4
}

delete {
url: {{baseUrl}}/RelationshipTemplates/{{id}}
body: none
auth: inherit
}

vars:pre-request {
id: RLTpUznhYQsBse545qLZ
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ meta {
}

get {
url: {{baseUrl}}/RelationshipTemplates?Ids=RLTEb4Zmk5CZwoKYgLVT
url: {{baseUrl}}/RelationshipTemplates?Ids=RLTpUznhYQsBse545qLZ
body: none
auth: inherit
}

query {
Ids: RLTEb4Zmk5CZwoKYgLVT
params:query {
Ids: RLTpUznhYQsBse545qLZ
~PageNumber: 1
~PageSize: 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
meta {
name: /Relationships/{id}/Accept
type: http
seq: 1
}

put {
url: {{baseUrl}}/Relationships/{{id}}/Accept
body: json
auth: inherit
}

body:json {
{
"creationResponseContent": ""
}
}

vars:pre-request {
id: RELquh4tVcr3zOTQGti7
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
meta {
name: /Relationships/{id}/Decompose
type: http
seq: 5
}

put {
url: {{baseUrl}}/Relationships/{{id}}/Decompose
body: json
auth: inherit
}

body:json {
{
"creationResponseContent": ""
}
}

vars:pre-request {
id: REL8DyBnfWYiXCzxkMiv
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
meta {
name: /Relationships/{id}/Reject
type: http
seq: 2
}

put {
url: {{baseUrl}}/Relationships/{{id}}/Reject
body: json
auth: inherit
}

body:json {
{
"creationResponseContent": ""
}
}

vars:pre-request {
id: REL8DyBnfWYiXCzxkMiv
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
meta {
name: /Relationships/{id}/Revoke
type: http
seq: 3
}

put {
url: {{baseUrl}}/Relationships/{{id}}/Revoke
body: json
auth: inherit
}

body:json {
{
"creationResponseContent": ""
}
}

vars:pre-request {
id: REL8DyBnfWYiXCzxkMiv
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
meta {
name: /Relationships/{id}/Terminate
type: http
seq: 4
}

put {
url: {{baseUrl}}/Relationships/{{id}}/Terminate
body: json
auth: inherit
}

body:json {
{
"creationResponseContent": ""
}
}

vars:pre-request {
id: REL8DyBnfWYiXCzxkMiv
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ post {

body:json {
{
"relationshipTemplateId": "",
"relationshipTemplateId": "RLTpUznhYQsBse545qLZ",
"content": ""
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ get {
}

vars:pre-request {
RelationshipId: RELUY2h3HVSFfYkdli0P
RelationshipId: RELquh4tVcr3zOTQGti7
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ meta {
}

get {
url: {{baseUrl}}/Relationships?Ids=REL6mRNeRz42f4R2OTKn
url: {{baseUrl}}/Relationships?Ids=RELquh4tVcr3zOTQGti7
body: none
auth: inherit
}

query {
Ids: REL6mRNeRz42f4R2OTKn
params:query {
Ids: RELquh4tVcr3zOTQGti7
~PageNumber: 1
~PageSize: 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
meta {
name: /Relationships/{id}/Reactivate/Accept
type: http
seq: 2
}

put {
url: {{baseUrl}}/Relationships/{{id}}/Reactivate/Accept
body: json
auth: inherit
}

body:json {
{
"creationResponseContent": ""
}
}

vars:pre-request {
id: REL8DyBnfWYiXCzxkMiv
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
meta {
name: /Relationships/{id}/Reactivate
type: http
seq: 1
}

put {
url: {{baseUrl}}/Relationships/{{id}}/Reactivate
body: json
auth: inherit
}

body:json {
{
"creationResponseContent": ""
}
}

vars:pre-request {
id: REL8DyBnfWYiXCzxkMiv
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
meta {
name: /Relationships/{id}/Reactivate/Reject
type: http
seq: 3
}

put {
url: {{baseUrl}}/Relationships/{{id}}/Reactivate/Reject
body: json
auth: inherit
}

body:json {
{
"creationResponseContent": ""
}
}

vars:pre-request {
id: REL8DyBnfWYiXCzxkMiv
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
meta {
name: /Relationships/{id}/Reactivate/Revoke
type: http
seq: 4
}

put {
url: {{baseUrl}}/Relationships/{{id}}/Reactivate/Revoke
body: json
auth: inherit
}

body:json {
{
"creationResponseContent": ""
}
}

vars:pre-request {
id: REL8DyBnfWYiXCzxkMiv
}
15 changes: 15 additions & 0 deletions Applications/ConsumerApi/src/http/Tokens/Delete Token.bru
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
meta {
name: /Tokens/{id}
type: http
seq: 4
}

delete {
url: {{baseUrl}}/Tokens/{{id}}
body: none
auth: inherit
}

vars:pre-request {
id: TOKsjPynl0FHYJzHnkIo
}
3 changes: 2 additions & 1 deletion Applications/ConsumerApi/src/http/Tokens/List Tokens.bru
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ get {
auth: inherit
}

query {
params:query {
~ids: TOKsjPynl0FHYJzHnkIo
~PageNumber: 1
~PageSize: 1
}
4 changes: 3 additions & 1 deletion Applications/ConsumerApi/src/http/environments/Local.bru
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ vars {
baseUrl: http://localhost:8081/api/v1
auth.url: http://localhost:8081/connect/token
auth.username: USRa
auth.password: a
auth.password: Aaaaaaaa1!
auth.username_b: USRb
auth.password_b: Bbbbbbbb1!
auth.client_id: test
auth.client_secret: test
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using Backbone.ConsumerApi.Sdk.Endpoints.Files.Types;

namespace Backbone.ConsumerApi.Tests.Integration.Contexts;

public class FilesContext
{
public readonly Dictionary<string, FileMetadata> Files = [];
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
using Backbone.ConsumerApi.Sdk.Endpoints.Relationships.Types;
using Backbone.ConsumerApi.Sdk.Endpoints.RelationshipTemplates.Types.Responses;

namespace Backbone.ConsumerApi.Tests.Integration.Contexts;

public class RelationshipsContext
{
public readonly Dictionary<string, Relationship> Relationships = new();
public readonly Dictionary<string, CreateRelationshipTemplateResponse> CreateRelationshipTemplateResponses = new();
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
@Integration
Feature: DELETE /Files/{id}

User deletes a File

Scenario: Deleting a File actually removes it
Given Identity i
And File f created by i
When i sends a DELETE request to the /Files/f.Id endpoint
And i sends a GET request to the /Files/f.Id endpoint
Then the response status code is 404 (Not Found)
Loading