-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consumer API: Revamp Relationships API (#576)
* chore: move entities to Aggregates folder * feat: creation of Relationship and remove Changes related stuff * test: split into two tests * feat: acceptance of creation * feat: reject creation * feat: revoke creation * test: split relationship tests into multiple files * feat: allow multiple relationships as long as there is only one active * chore: remove redundant parameter * refactor: make RelationshipTemplatesRepository.Find return null instead of throwing * feat: add Handler * feat: add and use expressions * chore: don't use AutoMapper and add more tests * feat: reject relationship * feat: AcceptRelationshipCommand * feat: RevokeRelationshipCommand * feat: add AuditLog to DTOs * feat: add CreationContent property to RelationshipDTO * feat: add additional properties to RelationshipCreatedIntegrationEvent and RelationshipStatusChangedIntegrationEvent * feat: handle new integration events in Synchronization module * chore: formatting * test: fix tests * feat: replace integration events in quotas module with new ones * feat: add migration * feat: add controller methods * chore: fix/ignore compiler warnings * refactor: cleanup error codes * feat: add insomnia workspace * feat: add openapi.yml * fix: add RelationshipMetadataDTO type and add creationContent property to RelationshipDTO * refactor: rename Content to CreationContent in request to create a relationship * chore: update InsomniaWorkspace and openapi.yml * chore: rename RelationshipStatus "Accepted" to "Active" * chore: fix merge conflicts * chore: remove redundant whitespace * feat: add AcceptanceContent * fix: avoid error on creation of RelationshipsOverview view when RelationshipChanges table does not exist * feat: (WIP!!): update Admin API RelationshipOverviews view * feat: add AcceptanceContent to DTO * fix: pass AcceptanceContent to AcceptRelationshipCommand * chore: use postgres in Admin CLI launchSettings.json * fix: relationships overview migration * feat: update revamped relationships overview view with audit log --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Daniel Almeida <[email protected]>
- Loading branch information
1 parent
1d2ae84
commit 8c4f151
Showing
160 changed files
with
4,370 additions
and
2,823 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
205 changes: 205 additions & 0 deletions
205
...nfrastructure.Database.Postgres/Migrations/20240412142555_RelationshipsRevamp.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
...dminApi.Infrastructure.Database.Postgres/Migrations/20240412142555_RelationshipsRevamp.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
"""); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.