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: Terminate a Relationship #588

Merged
merged 93 commits into from
Apr 17, 2024
Merged
Show file tree
Hide file tree
Changes from 85 commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
7226804
chore: move entities to Aggregates folder
tnotheis Mar 20, 2024
1847a34
feat: creation of Relationship and remove Changes related stuff
tnotheis Mar 20, 2024
ea15f8a
test: split into two tests
tnotheis Mar 20, 2024
d4ca97e
feat: acceptance of creation
tnotheis Mar 20, 2024
69799fb
feat: reject creation
tnotheis Mar 20, 2024
247362b
feat: revoke creation
tnotheis Mar 20, 2024
2c2d2e2
test: split relationship tests into multiple files
tnotheis Mar 21, 2024
9f358b3
feat: allow multiple relationships as long as there is only one active
tnotheis Mar 21, 2024
bc09fb4
chore: remove redundant parameter
tnotheis Mar 21, 2024
1d7a0af
refactor: make RelationshipTemplatesRepository.Find return null inste…
tnotheis Mar 21, 2024
7b470b8
feat: add Handler
tnotheis Mar 21, 2024
143a14d
feat: add and use expressions
tnotheis Mar 22, 2024
13a6c3d
chore: don't use AutoMapper and add more tests
tnotheis Mar 22, 2024
011a2ba
feat: reject relationship
tnotheis Mar 25, 2024
c971ead
feat: AcceptRelationshipCommand
tnotheis Mar 25, 2024
ede02f5
feat: RevokeRelationshipCommand
tnotheis Mar 25, 2024
3857aed
feat: add AuditLog to DTOs
tnotheis Mar 25, 2024
c67f732
feat: add CreationContent property to RelationshipDTO
tnotheis Mar 25, 2024
28d0483
feat: add additional properties to RelationshipCreatedIntegrationEven…
tnotheis Mar 25, 2024
ecb95e4
feat: handle new integration events in Synchronization module
tnotheis Mar 25, 2024
ce3ac08
chore: formatting
tnotheis Mar 25, 2024
91ca682
test: fix tests
tnotheis Mar 25, 2024
cc49f32
feat: replace integration events in quotas module with new ones
tnotheis Mar 26, 2024
090eb54
feat: add migration
tnotheis Mar 26, 2024
3e793b3
feat: add controller methods
tnotheis Mar 26, 2024
988cf87
Merge branch 'main' into nmshdb-81-improve-relationships-api
mergify[bot] Mar 26, 2024
aceb7a1
chore: fix/ignore compiler warnings
tnotheis Mar 26, 2024
e9e7013
Merge branch 'main' into nmshdb-81-improve-relationships-api
mergify[bot] Mar 26, 2024
bf18362
Merge branch 'main' into nmshdb-81-improve-relationships-api
mergify[bot] Mar 26, 2024
7c8cad9
Merge branch 'main' into nmshdb-81-improve-relationships-api
mergify[bot] Mar 26, 2024
0df0274
Merge branch 'main' into nmshdb-81-improve-relationships-api
mergify[bot] Mar 27, 2024
f3fa7a7
Merge branch 'main' into nmshdb-81-improve-relationships-api
mergify[bot] Mar 27, 2024
c02a887
refactor: cleanup error codes
tnotheis Mar 28, 2024
989588f
Merge branch 'main' into nmshdb-81-improve-relationships-api
mergify[bot] Mar 28, 2024
fbf97de
Merge branch 'nmshdb-81-improve-relationships-api' of github.com:nmsh…
tnotheis Mar 28, 2024
5296012
feat: add insomnia workspace
tnotheis Mar 28, 2024
5a0c5a0
feat: add openapi.yml
tnotheis Mar 28, 2024
4f22e88
fix: add RelationshipMetadataDTO type and add creationContent propert…
tnotheis Apr 3, 2024
2a302ad
Merge branch 'main' into nmshdb-81-improve-relationships-api
tnotheis Apr 5, 2024
af4f129
Merge branch 'main' into nmshdb-81-improve-relationships-api
mergify[bot] Apr 5, 2024
d6ae441
refactor: rename Content to CreationContent in request to create a re…
tnotheis Apr 5, 2024
5f65c33
chore: update InsomniaWorkspace and openapi.yml
tnotheis Apr 5, 2024
5125dd4
feat: implement domain part of relationship termination
NikolaVetnic Apr 7, 2024
9b3f2fb
feat: implement application part of relationship termination
NikolaVetnic Apr 7, 2024
a7a7509
feat: implement relationship termination controller
NikolaVetnic Apr 7, 2024
b915470
feat: disable creating new relationship while terminated one exists
NikolaVetnic Apr 7, 2024
7199bf2
feat: disable sending messages when relationship is terminated
NikolaVetnic Apr 7, 2024
a55447e
test: add relationship termination domain and handler tests
NikolaVetnic Apr 7, 2024
f706e11
Merge branch 'main' into nmshdb-81-improve-relationships-api
mergify[bot] Apr 8, 2024
7add47a
Merge branch 'main' into nmshdb-81-improve-relationships-api
mergify[bot] Apr 8, 2024
0afff09
chore: rename RelationshipStatus "Accepted" to "Active"
tnotheis Apr 8, 2024
352a72e
feat: trigger external event
NikolaVetnic Apr 9, 2024
a86273c
chore: fix formatting
NikolaVetnic Apr 10, 2024
4e174cd
Merge branch 'main' into nmshdb-81-improve-relationships-api
tnotheis Apr 10, 2024
30efe3b
Merge branch 'main' into nmshdb-81-improve-relationships-api
mergify[bot] Apr 10, 2024
ee1e540
chore: fix merge conflicts
tnotheis Apr 10, 2024
492f6e2
Merge remote-tracking branch 'origin/nmshdb-81-improve-relationships-…
tnotheis Apr 10, 2024
916080c
chore: remove redundant whitespace
tnotheis Apr 10, 2024
da3f664
Merge branch 'nmshdb-81-improve-relationships-api' into nmshdb-89-ter…
NikolaVetnic Apr 10, 2024
6fc48f4
fix: add missing directive
NikolaVetnic Apr 10, 2024
98873bc
fix: update Content to CreationContent
NikolaVetnic Apr 10, 2024
5e90776
chore: update files prior to making PR ready for review
NikolaVetnic Apr 11, 2024
3ea1441
chore: fix formatting
NikolaVetnic Apr 11, 2024
8a4f48f
Merge branch 'main' into nmshdb-81-improve-relationships-api
tnotheis Apr 12, 2024
ddf2cfa
Merge branch 'nmshdb-81-improve-relationships-api' into nmshdb-89-ter…
mergify[bot] Apr 12, 2024
db603de
feat: add AcceptanceContent
tnotheis Apr 12, 2024
a630833
fix: avoid error on creation of RelationshipsOverview view when Relat…
tnotheis Apr 12, 2024
3303b3e
feat: (WIP!!): update Admin API RelationshipOverviews view
tnotheis Apr 12, 2024
5901067
feat: add AcceptanceContent to DTO
tnotheis Apr 12, 2024
c79d2eb
fix: pass AcceptanceContent to AcceptRelationshipCommand
tnotheis Apr 12, 2024
ed9ad51
chore: use postgres in Admin CLI launchSettings.json
tnotheis Apr 12, 2024
fadfcd5
Merge branch 'nmshdb-81-improve-relationships-api' into nmshdb-89-ter…
NikolaVetnic Apr 15, 2024
08322b7
feat: implement PR change requests
NikolaVetnic Apr 15, 2024
1d426ec
Merge branch 'nmshdb-89-termination-of-a-relationship' of github.com:…
NikolaVetnic Apr 15, 2024
97c4fd2
feat: implement PR change requests
NikolaVetnic Apr 15, 2024
bda8759
chore: fix formatting
NikolaVetnic Apr 15, 2024
dfad610
feat: implement PR change requests
NikolaVetnic Apr 15, 2024
38dc854
fix: relationships overview migration
daniel-almeida-konkconsulting Apr 16, 2024
a10a9c4
feat: update revamped relationships overview view with audit log
daniel-almeida-konkconsulting Apr 16, 2024
8c85f7e
Merge branch 'main' into nmshdb-81-improve-relationships-api
mergify[bot] Apr 16, 2024
bf51407
Merge branch 'nmshdb-81-improve-relationships-api' into nmshdb-89-ter…
mergify[bot] Apr 16, 2024
1454f0f
test: add relationship tests
NikolaVetnic Apr 16, 2024
18a82c8
Merge branch 'nmshdb-89-termination-of-a-relationship' of github.com:…
NikolaVetnic Apr 16, 2024
80a4539
chore: fix formatting and remove redundant overload
NikolaVetnic Apr 16, 2024
45da65f
chore: fix formatting
NikolaVetnic Apr 16, 2024
860473b
Merge branch 'release/v5' of github.com:nmshd/backbone into nmshdb-89…
NikolaVetnic Apr 16, 2024
35466d6
feat: implement PR change requests
NikolaVetnic Apr 16, 2024
5c76e1c
feat: implement PR change requests
NikolaVetnic Apr 16, 2024
b990413
chore: remove redundant Relationship statuses
NikolaVetnic Apr 16, 2024
f4977af
fix: update condition
NikolaVetnic Apr 16, 2024
9bd5e68
fix: re-introduce Terminated status
NikolaVetnic Apr 16, 2024
7ada3aa
chore: remove unused method
tnotheis Apr 17, 2024
a48cc07
refactor: combine checks for other relationships
tnotheis Apr 17, 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
Expand Up @@ -11,24 +11,36 @@ public partial class RelationshipsOverview : Migration
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql("""
CREATE VIEW "RelationshipOverviews" AS
SELECT
"Relationships"."From" AS "From",
"Relationships"."To" AS "To",
"Relationships"."RelationshipTemplateId" AS "RelationshipTemplateId",
"Relationships"."Status" AS "Status",
"Relationships"."CreatedAt" AS "CreatedAt",
"RelationshipChanges"."Res_CreatedAt" AS "AnsweredAt",
"RelationshipChanges"."Req_CreatedByDevice" AS "CreatedByDevice",
"RelationshipChanges"."Res_CreatedByDevice" AS "AnsweredByDevice"
FROM
"Relationships"."Relationships" AS "Relationships"
LEFT JOIN
"Relationships"."RelationshipChanges" AS "RelationshipChanges"
ON
"Relationships"."Id" = "RelationshipChanges"."RelationshipId"
WHERE
"RelationshipChanges"."Type" = 10
DO
$$
BEGIN
IF EXISTS (
SELECT FROM information_schema.tables
WHERE table_schema = 'Relationships'
AND table_name = 'RelationshipChanges'
) THEN
CREATE VIEW "RelationshipOverviews" AS
SELECT
"Relationships"."From" AS "From",
"Relationships"."To" AS "To",
"Relationships"."RelationshipTemplateId" AS "RelationshipTemplateId",
"Relationships"."Status" AS "Status",
"Relationships"."CreatedAt" AS "CreatedAt",
"RelationshipChanges"."Res_CreatedAt" AS "AnsweredAt",
"RelationshipChanges"."Req_CreatedByDevice" AS "CreatedByDevice",
"RelationshipChanges"."Res_CreatedByDevice" AS "AnsweredByDevice"
FROM
"Relationships"."Relationships" AS "Relationships"
LEFT JOIN
"Relationships"."RelationshipChanges" AS "RelationshipChanges"
ON
"Relationships"."Id" = "RelationshipChanges"."RelationshipId"
WHERE
"RelationshipChanges"."Type" = 10;
END IF;
END;
$$

""");
}

Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Backbone.AdminApi.Infrastructure.Database.Postgres.Migrations
{
/// <inheritdoc />
public partial class RelationshipsRevamp : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql("""
CREATE OR REPLACE VIEW "RelationshipOverviews" AS
SELECT
"Relationships"."From" AS "From",
"Relationships"."To" AS "To",
"Relationships"."RelationshipTemplateId" AS "RelationshipTemplateId",
"Relationships"."Status" AS "Status",
"AuditLog1"."CreatedAt" AS "CreatedAt",
"AuditLog1"."CreatedByDevice" AS "CreatedByDevice",
"AuditLog2"."CreatedAt" AS "AnsweredAt",
"AuditLog2"."CreatedByDevice" AS "AnsweredByDevice"
FROM "Relationships"."Relationships" AS "Relationships"
LEFT JOIN "Relationships"."RelationshipAuditLog" AS "AuditLog1"
ON "Relationships"."Id" = "AuditLog1"."RelationshipId" AND "AuditLog1"."Reason" = 0
LEFT JOIN "Relationships"."RelationshipAuditLog" AS "AuditLog2"
ON "Relationships"."Id" = "AuditLog2"."RelationshipId" AND "AuditLog2"."Reason" = 1
""");
}

/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql("""
CREATE OR REPLACE VIEW "RelationshipOverviews" AS
SELECT
"Relationships"."From" AS "From",
"Relationships"."To" AS "To",
"Relationships"."RelationshipTemplateId" AS "RelationshipTemplateId",
"Relationships"."Status" AS "Status",
"Relationships"."CreatedAt" AS "CreatedAt",
"RelationshipChanges"."Res_CreatedAt" AS "AnsweredAt",
"RelationshipChanges"."Req_CreatedByDevice" AS "CreatedByDevice",
"RelationshipChanges"."Res_CreatedByDevice" AS "AnsweredByDevice"
FROM
"Relationships"."Relationships" AS "Relationships"
LEFT JOIN
"Relationships"."RelationshipChanges" AS "RelationshipChanges"
ON
"Relationships"."Id" = "RelationshipChanges"."RelationshipId"
WHERE
"RelationshipChanges"."Type" = 10
""");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,27 @@ public partial class RelationshipsOverview : Migration
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.Sql("""
CREATE VIEW RelationshipOverviews AS
SELECT
[RELATIONSHIPS].[From] AS [From],
[RELATIONSHIPS].[To] AS [To],
[RELATIONSHIPS].[RelationshipTemplateId] AS [RelationshipTemplateId],
[RELATIONSHIPS].[Status] AS [Status],
[RELATIONSHIPS].[CreatedAt] AS [CreatedAt],
[RELATIONSHIPCHANGES].[Res_CreatedAt] AS [AnsweredAt],
[RELATIONSHIPCHANGES].[Req_CreatedByDevice] AS [CreatedByDevice],
[RELATIONSHIPCHANGES].[Res_CreatedByDevice] AS [AnsweredByDevice]
FROM
[Relationships].[Relationships] AS RELATIONSHIPS
LEFT JOIN
[Relationships].[RelationshipChanges] AS RELATIONSHIPCHANGES
ON
[RELATIONSHIPS].[Id] = [RELATIONSHIPCHANGES].[RelationshipId]
WHERE
[RELATIONSHIPCHANGES].[Type] = 10
IF EXISTS (SELECT * FROM information_schema.tables WHERE table_schema = 'Relationships' AND table_name = 'RelationshipChanges')
BEGIN
EXECUTE('CREATE OR ALTER VIEW RelationshipOverviews AS
SELECT
[RELATIONSHIPS].[From] AS [From],
[RELATIONSHIPS].[To] AS [To],
[RELATIONSHIPS].[RelationshipTemplateId] AS [RelationshipTemplateId],
[RELATIONSHIPS].[Status] AS [Status],
[RELATIONSHIPS].[CreatedAt] AS [CreatedAt],
[RELATIONSHIPCHANGES].[Res_CreatedAt] AS [AnsweredAt],
[RELATIONSHIPCHANGES].[Req_CreatedByDevice] AS [CreatedByDevice],
[RELATIONSHIPCHANGES].[Res_CreatedByDevice] AS [AnsweredByDevice]
FROM
[Relationships].[Relationships] AS RELATIONSHIPS
LEFT JOIN
[Relationships].[RelationshipChanges] AS RELATIONSHIPCHANGES
ON
[RELATIONSHIPS].[Id] = [RELATIONSHIPCHANGES].[RelationshipId]
WHERE
[RELATIONSHIPCHANGES].[Type] = 10')
END
""");
}

Expand Down
Loading
Loading