@@ -13,18 +13,18 @@ namespace OpenShock.API.Controller.Public;
1313public sealed partial class PublicController
1414{
1515 /// <summary>
16- /// Gets information about a public share link .
16+ /// Gets information about a public share.
1717 /// </summary>
18- /// <param name="shareLinkId "></param>
19- /// <response code="200">The share link information was successfully retrieved.</response>
20- /// <response code="404">The share link does not exist.</response>
21- [ HttpGet ( "shares/links/{shareLinkId }" ) ]
22- [ Tags ( "Shocker ShareLinks " ) ]
23- [ ProducesResponseType < LegacyDataResponse < PublicShareLinkResponse > > ( StatusCodes . Status200OK , MediaTypeNames . Application . Json ) ]
24- [ ProducesResponseType < OpenShockProblem > ( StatusCodes . Status404NotFound , MediaTypeNames . Application . ProblemJson ) ] // ShareLinkNotFound
25- public async Task < IActionResult > GetShareLink ( [ FromRoute ] Guid shareLinkId )
18+ /// <param name="publicShareId "></param>
19+ /// <response code="200">The public share information was successfully retrieved.</response>
20+ /// <response code="404">The public share does not exist.</response>
21+ [ HttpGet ( "shares/links/{publicShareId }" ) ]
22+ [ Tags ( "Public Shocker Shares " ) ]
23+ [ ProducesResponseType < LegacyDataResponse < PublicShareResponse > > ( StatusCodes . Status200OK , MediaTypeNames . Application . Json ) ]
24+ [ ProducesResponseType < OpenShockProblem > ( StatusCodes . Status404NotFound , MediaTypeNames . Application . ProblemJson ) ] // PublicShareNotFound
25+ public async Task < IActionResult > GetPublicShare ( [ FromRoute ] Guid publicShareId )
2626 {
27- var shareLink = await _db . ShockerShareLinks . Where ( x => x . Id == shareLinkId ) . Select ( x => new
27+ var publicShare = await _db . PublicShares . Where ( x => x . Id == publicShareId ) . Select ( x => new
2828 {
2929 Author = new GenericIni
3030 {
@@ -40,7 +40,7 @@ public async Task<IActionResult> GetShareLink([FromRoute] Guid shareLinkId)
4040 {
4141 DeviceId = y . Shocker . Device . Id ,
4242 DeviceName = y . Shocker . Device . Name ,
43- Shocker = new ShareLinkShocker
43+ Shocker = new PublicShareShocker
4444 {
4545 Id = y . Shocker . Id ,
4646 Name = y . Shocker . Name ,
@@ -56,26 +56,26 @@ public async Task<IActionResult> GetShareLink([FromRoute] Guid shareLinkId)
5656 Shock = y . AllowShock ,
5757 Live = y . AllowLiveControl
5858 } ,
59- Paused = ShareLinkUtils . GetPausedReason ( y . IsPaused , y . Shocker . IsPaused ) ,
59+ Paused = PublicShareUtils . GetPausedReason ( y . IsPaused , y . Shocker . IsPaused ) ,
6060 }
6161 } )
6262 } ) . FirstOrDefaultAsync ( ) ;
6363
64- if ( shareLink == null ) return Problem ( ShareLinkError . ShareLinkNotFound ) ;
64+ if ( publicShare == null ) return Problem ( PublicShareError . PublicShareNotFound ) ;
6565
6666
67- var final = new PublicShareLinkResponse
67+ var final = new PublicShareResponse
6868 {
69- Id = shareLink . Id ,
70- Name = shareLink . Name ,
71- Author = shareLink . Author ,
72- CreatedOn = shareLink . CreatedAt ,
73- ExpiresOn = shareLink . ExpiresAt
69+ Id = publicShare . Id ,
70+ Name = publicShare . Name ,
71+ Author = publicShare . Author ,
72+ CreatedOn = publicShare . CreatedAt ,
73+ ExpiresOn = publicShare . ExpiresAt
7474 } ;
75- foreach ( var shocker in shareLink . Shockers )
75+ foreach ( var shocker in publicShare . Shockers )
7676 {
7777 if ( final . Devices . All ( x => x . Id != shocker . DeviceId ) )
78- final . Devices . Add ( new ShareLinkDevice
78+ final . Devices . Add ( new PublicShareDevice
7979 {
8080 Id = shocker . DeviceId ,
8181 Name = shocker . DeviceName ,
0 commit comments