Skip to content

Commit

Permalink
fix: Add missing return types for Transmissions and Activities in Ope…
Browse files Browse the repository at this point in the history
…nAPI spec (#1244)

<!--- Provide a general summary of your changes in the Title above -->

## Description

<!--- Describe your changes in detail -->

## Related Issue(s)

- #1239 

## Verification

- [ ] **Your** code builds clean without any errors or warnings
- [ ] Manual testing done (required)
- [ ] Relevant automated test added (if you find this hard, leave it and
we'll help out)

## Documentation

- [ ] Documentation is updated (either in `docs`-directory, Altinnpedia
or a separate linked PR in
[altinn-studio-docs.](https://github.com/Altinn/altinn-studio-docs), if
applicable)


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

- **New Features**
- Introduced multiple new schemas for dialog activity and transmission
handling, enhancing metadata management.
- Updated API endpoints to return detailed lists of dialog activities
and their attachments.
- Enhanced data structures with new properties for better clarity and
functionality in dialog activities and transmissions.
- Improved Swagger configurations for better documentation clarity and
specificity for dialog activity and transmission endpoints.
- Added support for notification conditions in the API, improving the
handling of related queries.

- **Bug Fixes**
- Improved response structure of dialog activity and transmission
endpoints to ensure accurate data retrieval.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
  • Loading branch information
oskogstad authored Oct 10, 2024
1 parent 806aa0a commit 972870d
Show file tree
Hide file tree
Showing 20 changed files with 1,223 additions and 182 deletions.
1,161 changes: 1,005 additions & 156 deletions docs/schema/V1/swagger.verified.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,145 @@ namespace Digdir.Domain.Dialogporten.Application.Features.V1.EndUser.DialogTrans

public sealed class GetDialogTransmissionDto
{
/// <summary>
/// The unique identifier for the transmission in UUIDv7 format.
/// </summary>
public Guid Id { get; set; }

/// <summary>
/// The date and time when the transmission was created.
/// </summary>
public DateTimeOffset CreatedAt { get; set; }

/// <summary>
/// The authorization attribute associated with the transmission.
/// </summary>
public string? AuthorizationAttribute { get; set; }

/// <summary>
/// Flag indicating if the authenticated user is authorized for this transmission. If not, embedded content and
/// the attachments will not be available
/// </summary>
public bool IsAuthorized { get; set; }

/// <summary>
/// The extended type URI for the transmission.
/// </summary>
public Uri? ExtendedType { get; set; }

/// <summary>
/// The unique identifier for the related transmission, if any.
/// </summary>
public Guid? RelatedTransmissionId { get; set; }

/// <summary>
/// The date and time when the transmission was deleted, if applicable.
/// </summary>
public DateTimeOffset? DeletedAt { get; set; }

/// <summary>
/// The type of the transmission.
/// </summary>
public DialogTransmissionType.Values Type { get; set; }

/// <summary>
/// The sender actor information for the transmission.
/// </summary>
public GetDialogTransmissionSenderActorDto Sender { get; set; } = null!;

/// <summary>
/// The content of the transmission.
/// </summary>
public GetDialogTransmissionContentDto Content { get; set; } = null!;

/// <summary>
/// The attachments associated with the transmission.
/// </summary>
public List<GetDialogTransmissionAttachmentDto> Attachments { get; set; } = [];
}

public sealed class GetDialogTransmissionSenderActorDto
{
/// <summary>
/// The unique identifier for the sender actor in UUIDv7 format.
/// </summary>
public Guid Id { get; set; }

/// <summary>
/// The type of the actor.
/// </summary>
public ActorType.Values ActorType { get; set; }

/// <summary>
/// The name of the actor.
/// </summary>
public string ActorName { get; set; } = null!;

/// <summary>
/// The identifier of the actor.
/// </summary>
public string ActorId { get; set; } = null!;
}

public sealed class GetDialogTransmissionContentDto
{
/// <summary>
/// The title of the content.
/// </summary>
public ContentValueDto Title { get; set; } = null!;

/// <summary>
/// The summary of the content.
/// </summary>
public ContentValueDto Summary { get; set; } = null!;
}

public sealed class GetDialogTransmissionAttachmentDto
{
/// <summary>
/// The unique identifier for the attachment in UUIDv7 format.
/// </summary>
public Guid Id { get; set; }

/// <summary>
/// The display name of the attachment that should be used in GUIs.
/// </summary>
public List<LocalizationDto> DisplayName { get; set; } = [];

/// <summary>
/// The URLs associated with the attachment, each referring to a different representation of the attachment.
/// </summary>
public List<GetDialogTransmissionAttachmentUrlDto> Urls { get; set; } = [];
}

public sealed class GetDialogTransmissionAttachmentUrlDto
{
/// <summary>
/// The unique identifier for the attachment URL in UUIDv7 format.
/// </summary>
public Guid Id { get; set; }

/// <summary>
/// The fully qualified URL of the attachment. Will be set to "urn:dialogporten:unauthorized" if the user is
/// not authorized to access the transmission.
/// </summary>
/// <example>
/// https://someendpoint.com/someattachment.pdf
/// urn:dialogporten:unauthorized
/// </example>
public Uri Url { get; set; } = null!;

/// <summary>
/// The media type of the attachment.
/// </summary>
/// <example>
/// application/pdf
/// application/zip
/// </example>
public string? MediaType { get; set; } = null!;

/// <summary>
/// The type of consumer the URL is intended for.
/// </summary>
public AttachmentUrlConsumerType.Values ConsumerType { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public sealed class GetDialogDialogTransmissionDto
/// <summary>
/// The transmission-level attachments
/// </summary>
public List<GetDialogTransmissionAttachmentDto> Attachments { get; set; } = [];
public List<GetDialogDialogTransmissionAttachmentDto> Attachments { get; set; } = [];
}

public sealed class GetDialogDialogSeenLogDto
Expand Down Expand Up @@ -629,7 +629,7 @@ public sealed class GetDialogDialogAttachmentUrlDto
public AttachmentUrlConsumerType.Values ConsumerType { get; set; }
}

public sealed class GetDialogTransmissionAttachmentDto
public sealed class GetDialogDialogTransmissionAttachmentDto
{
/// <summary>
/// The unique identifier for the attachment in UUIDv7 format.
Expand All @@ -644,10 +644,10 @@ public sealed class GetDialogTransmissionAttachmentDto
/// <summary>
/// The URLs associated with the attachment, each referring to a different representation of the attachment.
/// </summary>
public List<GetDialogTransmissionAttachmentUrlDto> Urls { get; set; } = [];
public List<GetDialogDialogTransmissionAttachmentUrlDto> Urls { get; set; } = [];
}

public sealed class GetDialogTransmissionAttachmentUrlDto
public sealed class GetDialogDialogTransmissionAttachmentUrlDto
{
/// <summary>
/// The fully qualified URL of the attachment. Will be set to "urn:dialogporten:unauthorized" if the user is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public MappingProfile()
CreateMap<DialogTransmission, GetDialogDialogTransmissionDto>()
.ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.TypeId));

CreateMap<DialogTransmissionAttachment, GetDialogTransmissionAttachmentDto>();
CreateMap<AttachmentUrl, GetDialogTransmissionAttachmentUrlDto>()
CreateMap<DialogTransmissionAttachment, GetDialogDialogTransmissionAttachmentDto>();
CreateMap<AttachmentUrl, GetDialogDialogTransmissionAttachmentUrlDto>()
.ForMember(dest => dest.ConsumerType, opt => opt.MapFrom(src => src.ConsumerTypeId));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,48 +8,139 @@ namespace Digdir.Domain.Dialogporten.Application.Features.V1.ServiceOwner.Dialog

public sealed class GetDialogTransmissionDto
{
/// <summary>
/// The unique identifier for the transmission in UUIDv7 format.
/// </summary>
public Guid Id { get; set; }

/// <summary>
/// The date and time when the transmission was created.
/// </summary>
public DateTimeOffset CreatedAt { get; set; }

/// <summary>
/// The authorization attribute associated with the transmission.
/// </summary>
public string? AuthorizationAttribute { get; set; }

/// <summary>
/// The extended type URI for the transmission.
/// </summary>
public Uri? ExtendedType { get; set; }

/// <summary>
/// The unique identifier for the related transmission, if any.
/// </summary>
public Guid? RelatedTransmissionId { get; set; }

/// <summary>
/// The date and time when the transmission was deleted, if applicable.
/// </summary>
public DateTimeOffset? DeletedAt { get; set; }

/// <summary>
/// The type of the transmission.
/// </summary>
public DialogTransmissionType.Values Type { get; set; }

/// <summary>
/// The sender actor information for the transmission.
/// </summary>
public GetDialogTransmissionSenderActorDto Sender { get; set; } = null!;

/// <summary>
/// The content of the transmission.
/// </summary>
public GetDialogTransmissionContentDto Content { get; set; } = null!;

/// <summary>
/// The attachments associated with the transmission.
/// </summary>
public List<GetDialogTransmissionAttachmentDto> Attachments { get; set; } = [];
}

public sealed class GetDialogTransmissionSenderActorDto
{
/// <summary>
/// The unique identifier for the sender actor in UUIDv7 format.
/// </summary>
public Guid Id { get; set; }

/// <summary>
/// The type of the actor.
/// </summary>
public ActorType.Values ActorType { get; set; }

/// <summary>
/// The name of the actor.
/// </summary>
public string ActorName { get; set; } = null!;

/// <summary>
/// The identifier of the actor.
/// </summary>
public string ActorId { get; set; } = null!;
}

public sealed class GetDialogTransmissionContentDto
{
/// <summary>
/// The title of the content.
/// </summary>
public ContentValueDto Title { get; set; } = null!;

/// <summary>
/// The summary of the content.
/// </summary>
public ContentValueDto Summary { get; set; } = null!;
}

public sealed class GetDialogTransmissionAttachmentDto
{
/// <summary>
/// The unique identifier for the attachment in UUIDv7 format.
/// </summary>
public Guid Id { get; set; }

/// <summary>
/// The display name of the attachment that should be used in GUIs.
/// </summary>
public List<LocalizationDto> DisplayName { get; set; } = [];

/// <summary>
/// The URLs associated with the attachment, each referring to a different representation of the attachment.
/// </summary>
public List<GetDialogTransmissionAttachmentUrlDto> Urls { get; set; } = [];
}

public sealed class GetDialogTransmissionAttachmentUrlDto
{
/// <summary>
/// The unique identifier for the attachment URL in UUIDv7 format.
/// </summary>
public Guid Id { get; set; }

/// <summary>
/// The fully qualified URL of the attachment. Will be set to "urn:dialogporten:unauthorized" if the user is
/// not authorized to access the transmission.
/// </summary>
/// <example>
/// https://someendpoint.com/someattachment.pdf
/// urn:dialogporten:unauthorized
/// </example>
public Uri Url { get; set; } = null!;

/// <summary>
/// The media type of the attachment.
/// </summary>
/// <example>
/// application/pdf
/// application/zip
/// </example>
public string? MediaType { get; set; } = null!;

/// <summary>
/// The type of consumer the URL is intended for.
/// </summary>
public AttachmentUrlConsumerType.Values ConsumerType { get; set; }
}
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ public sealed class GetDialogDialogTransmissionDto
/// <summary>
/// The transmission-level attachments
/// </summary>
public List<GetDialogTransmissionAttachmentDto> Attachments { get; set; } = [];
public List<GetDialogDialogTransmissionAttachmentDto> Attachments { get; set; } = [];
}

public sealed class GetDialogDialogSeenLogDto
Expand Down Expand Up @@ -636,7 +636,7 @@ public sealed class GetDialogDialogAttachmentUrlDto
public AttachmentUrlConsumerType.Values ConsumerType { get; set; }
}

public sealed class GetDialogTransmissionAttachmentDto
public sealed class GetDialogDialogTransmissionAttachmentDto
{
/// <summary>
/// The unique identifier for the attachment in UUIDv7 format.
Expand All @@ -651,10 +651,10 @@ public sealed class GetDialogTransmissionAttachmentDto
/// <summary>
/// The URLs associated with the attachment, each referring to a different representation of the attachment.
/// </summary>
public List<GetDialogTransmissionAttachmentUrlDto> Urls { get; set; } = [];
public List<GetDialogDialogTransmissionAttachmentUrlDto> Urls { get; set; } = [];
}

public sealed class GetDialogTransmissionAttachmentUrlDto
public sealed class GetDialogDialogTransmissionAttachmentUrlDto
{
/// <summary>
/// The fully qualified URL of the attachment. Will be set to "urn:dialogporten:unauthorized" if the user is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ public MappingProfile()
CreateMap<DialogTransmission, GetDialogDialogTransmissionDto>()
.ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.TypeId));

CreateMap<DialogTransmissionAttachment, GetDialogTransmissionAttachmentDto>();
CreateMap<AttachmentUrl, GetDialogTransmissionAttachmentUrlDto>()
CreateMap<DialogTransmissionAttachment, GetDialogDialogTransmissionAttachmentDto>();
CreateMap<AttachmentUrl, GetDialogDialogTransmissionAttachmentUrlDto>()
.ForMember(dest => dest.ConsumerType, opt => opt.MapFrom(src => src.ConsumerTypeId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public MappingProfile()
CreateMap<GetDialogDialogTransmissionDto, Transmission>()
.ForMember(dest => dest.Type, opt => opt.MapFrom(src => src.Type));
CreateMap<GetDialogDialogTransmissionSenderActorDto, Actor>();
CreateMap<GetDialogTransmissionAttachmentDto, Attachment>();
CreateMap<GetDialogTransmissionAttachmentUrlDto, AttachmentUrl>()
CreateMap<GetDialogDialogTransmissionAttachmentDto, Attachment>();
CreateMap<GetDialogDialogTransmissionAttachmentUrlDto, AttachmentUrl>()
.ForMember(dest => dest.ConsumerType, opt => opt.MapFrom(src => src.ConsumerType));
CreateMap<GetDialogDialogTransmissionContentDto, TransmissionContent>();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

namespace Digdir.Domain.Dialogporten.WebApi.Endpoints.V1.EndUser.DialogActivities.Get;

public sealed class GetDialogActivityEndpoint : Endpoint<GetDialogActivityQuery>
public sealed class GetDialogActivityEndpoint : Endpoint<GetDialogActivityQuery, GetDialogActivityDto>
{
private readonly ISender _sender;

Expand Down
Loading

0 comments on commit 972870d

Please sign in to comment.