-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[YOMA-66] Feature/action links (#752)
* Added entities, repositories and domain enumerations and models * Added services Sharing now uses an action link Updated routes Link management, cliaming and instant verify still in progress * Small refactoring * Linting * Entity refactoring Unique usage now tracked provided authenticated * Linting * Added comments
- Loading branch information
1 parent
f48b4f8
commit be17db2
Showing
48 changed files
with
3,689 additions
and
161 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
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
21 changes: 21 additions & 0 deletions
21
src/api/src/domain/Yoma.Core.Domain/ActionLink/Enumerations.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,21 @@ | ||
namespace Yoma.Core.Domain.ActionLink | ||
{ | ||
public enum LinkEntityType | ||
{ | ||
Opportunity | ||
} | ||
|
||
public enum LinkAction | ||
{ | ||
Share, | ||
Verify | ||
} | ||
|
||
public enum LinkStatus | ||
{ | ||
Active, | ||
Inactive, | ||
Expired, | ||
LimitReached | ||
} | ||
} |
31 changes: 31 additions & 0 deletions
31
src/api/src/domain/Yoma.Core.Domain/ActionLink/Extensions/LinkExtensions.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,31 @@ | ||
using Yoma.Core.Domain.ActionLink.Models; | ||
using Yoma.Core.Domain.Core.Helpers; | ||
|
||
namespace Yoma.Core.Domain.ActionLink.Extensions | ||
{ | ||
public static class LinkExtensions | ||
{ | ||
public static LinkInfo ToLinkInfo(this Link value, bool? includeQRCode) | ||
{ | ||
ArgumentNullException.ThrowIfNull(value, nameof(value)); | ||
|
||
return new LinkInfo | ||
{ | ||
Id = value.Id, | ||
Name = value.Name, | ||
Description = value.Description, | ||
StatusId = value.StatusId, | ||
Status = value.Status, | ||
URL = value.URL, | ||
ShortURL = value.ShortURL, | ||
QRCodeBase64 = includeQRCode == true ? QRCodeHelper.GenerateQRCodeBase64(value.ShortURL) : null, | ||
UsagesLimit = value.UsagesLimit, | ||
UsagesTotal = value.UsagesTotal, | ||
UsagesAvailable = value.UsagesLimit.HasValue ? value.UsagesLimit - (value.UsagesTotal ?? 0) : null, | ||
DateEnd = value.DateEnd, | ||
DateCreated = value.DateCreated, | ||
DateModified = value.DateModified | ||
}; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/api/src/domain/Yoma.Core.Domain/ActionLink/Interfaces/ILinkService.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,11 @@ | ||
using Yoma.Core.Domain.ActionLink.Models; | ||
|
||
namespace Yoma.Core.Domain.ActionLink.Interfaces | ||
{ | ||
public interface ILinkService | ||
{ | ||
Task<Link> Create(LinkRequestCreate request, bool ensureOrganizationAuthorization); | ||
|
||
Task<Link> LogUsage(Guid id); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
src/api/src/domain/Yoma.Core.Domain/ActionLink/Interfaces/ILinkStatusService.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,15 @@ | ||
namespace Yoma.Core.Domain.ActionLink.Interfaces | ||
{ | ||
public interface ILinkStatusService | ||
{ | ||
Models.Lookups.LinkStatus GetByName(string name); | ||
|
||
Models.Lookups.LinkStatus? GetByNameOrNull(string name); | ||
|
||
Models.Lookups.LinkStatus GetById(Guid id); | ||
|
||
Models.Lookups.LinkStatus? GetByIdOrNull(Guid id); | ||
|
||
List<Models.Lookups.LinkStatus> List(); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
src/api/src/domain/Yoma.Core.Domain/ActionLink/Models/Link.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,39 @@ | ||
namespace Yoma.Core.Domain.ActionLink.Models | ||
{ | ||
public class Link | ||
{ | ||
public Guid Id { get; set; } | ||
|
||
public string Name { get; set; } | ||
|
||
public string? Description { get; set; } | ||
|
||
public string EntityType { get; set; } | ||
|
||
public string Action { get; set; } | ||
|
||
public Guid StatusId { get; set; } | ||
|
||
public LinkStatus Status { get; set; } | ||
|
||
public Guid? OpportunityId { get; set; } | ||
|
||
public string URL { get; set; } | ||
|
||
public string ShortURL { get; set; } | ||
|
||
public int? UsagesLimit { get; set; } | ||
|
||
public int? UsagesTotal { get; set; } | ||
|
||
public DateTimeOffset? DateEnd { get; set; } | ||
|
||
public DateTimeOffset DateCreated { get; set; } | ||
|
||
public Guid CreatedByUserId { get; set; } | ||
|
||
public DateTimeOffset DateModified { get; set; } | ||
|
||
public Guid ModifiedByUserId { get; set; } | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
src/api/src/domain/Yoma.Core.Domain/ActionLink/Models/LinkInfo.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,33 @@ | ||
namespace Yoma.Core.Domain.ActionLink.Models | ||
{ | ||
public class LinkInfo | ||
{ | ||
public Guid Id { get; set; } | ||
|
||
public string Name { get; set; } | ||
|
||
public string? Description { get; set; } | ||
|
||
public Guid StatusId { get; set; } | ||
|
||
public LinkStatus Status { get; set; } | ||
|
||
public string URL { get; set; } | ||
|
||
public string ShortURL { get; set; } | ||
|
||
public string? QRCodeBase64 { get; set; } | ||
|
||
public int? UsagesLimit { get; set; } | ||
|
||
public int? UsagesTotal { get; set; } | ||
|
||
public int? UsagesAvailable { get; set; } | ||
|
||
public DateTimeOffset? DateEnd { get; set; } | ||
|
||
public DateTimeOffset DateCreated { get; set; } | ||
|
||
public DateTimeOffset DateModified { get; set; } | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/api/src/domain/Yoma.Core.Domain/ActionLink/Models/LinkRequestCreate.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,21 @@ | ||
namespace Yoma.Core.Domain.ActionLink.Models | ||
{ | ||
public class LinkRequestCreate | ||
{ | ||
public string Name { get; set; } | ||
|
||
public string? Description { get; set; } | ||
|
||
public LinkEntityType EntityType { get; set; } | ||
|
||
public LinkAction Action { get; set; } | ||
|
||
public Guid EntityId { get; set; } | ||
|
||
public string URL { get; set; } | ||
|
||
public int? UsagesLimit { get; set; } | ||
|
||
public DateTimeOffset? DateEnd { get; set; } | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
src/api/src/domain/Yoma.Core.Domain/ActionLink/Models/LinkUsageLog.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,13 @@ | ||
namespace Yoma.Core.Domain.ActionLink.Models | ||
{ | ||
public class LinkUsageLog | ||
{ | ||
public Guid Id { get; set; } | ||
|
||
public Guid LinkId { get; set; } | ||
|
||
public Guid UserId { get; set; } | ||
|
||
public DateTimeOffset DateCreated { get; set; } | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
src/api/src/domain/Yoma.Core.Domain/ActionLink/Models/Lookups/LinkStatus.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,9 @@ | ||
namespace Yoma.Core.Domain.ActionLink.Models.Lookups | ||
{ | ||
public class LinkStatus | ||
{ | ||
public Guid Id { get; set; } | ||
|
||
public string Name { get; set; } | ||
} | ||
} |
Oops, something went wrong.