This repository has been archived by the owner on Mar 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
defb2d1
commit afdea4e
Showing
3 changed files
with
46 additions
and
5 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
41 changes: 41 additions & 0 deletions
41
Rinkudesu.Services.Links/Rinkudesu.Services.Links/DataTransferObjects/V1/LinkEditDto.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,41 @@ | ||
using System; | ||
using System.ComponentModel.DataAnnotations; | ||
using System.Diagnostics.CodeAnalysis; | ||
using Rinkudesu.Services.Links.Models; | ||
|
||
namespace Rinkudesu.Services.Links.DataTransferObjects.V1 | ||
{ | ||
/// <summary> | ||
/// Data transfer object to send and receive <see cref="Link"/> objects | ||
/// </summary> | ||
[ExcludeFromCodeCoverage] | ||
public class LinkEditDto | ||
{ | ||
/// <summary> | ||
/// URL the link is pointing to | ||
/// </summary> | ||
[DataType(DataType.Url)] | ||
[MaxLength(200)] | ||
[SuppressMessage("Design", "CA1056:URI-like properties should not be strings")] | ||
public string LinkUrl { get; set; } = null!; | ||
/// <summary> | ||
/// Title of the link | ||
/// </summary> | ||
[MaxLength(250)] | ||
public string Title { get; set; } = null!; | ||
/// <summary> | ||
/// Description of the link | ||
/// </summary> | ||
[MaxLength(1000)] | ||
public string? Description { get; set; } | ||
/// <summary> | ||
/// Privacy configuration of the link | ||
/// </summary> | ||
public Link.LinkPrivacyOptions PrivacyOptions { get; set; } | ||
|
||
/// <summary> | ||
/// Verifies whether <see cref="LinkUrl"/> is a valid absolute url. | ||
/// </summary> | ||
public bool IsLinkUrlValid() => Uri.TryCreate(LinkUrl, UriKind.Absolute, out _); | ||
} | ||
} |