Skip to content

Commit

Permalink
Allow permission set for live perm
Browse files Browse the repository at this point in the history
  • Loading branch information
LucHeart committed Jan 14, 2024
1 parent 69f385e commit 183a39f
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 13 deletions.
7 changes: 4 additions & 3 deletions API/Controller/Public/PublicShareController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ namespace OpenShock.API.Controller.Public;

public sealed partial class PublicController
{
/// <summary>
/// Gets information about a public share link.
/// </summary>
/// <summary>
/// Gets information about a public share link.
/// </summary>
/// <param name="id"></param>
/// <response code="200">The share link information was successfully retrieved.</response>
/// <response code="404">The share link does not exist.</response>
Expand Down Expand Up @@ -50,6 +50,7 @@ public async Task<BaseResponse<PublicShareLinkResponse>> Get([FromRoute] Guid id
Vibrate = y.PermVibrate,
Sound = y.PermSound,
Shock = y.PermShock,
Live = y.PermLive
},
Paused = ShareLinkUtils.GetPausedReason(y.Paused, y.Shocker.Paused),
}
Expand Down
13 changes: 7 additions & 6 deletions API/Controller/Shares/Links/EditShockerShareLink.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ namespace OpenShock.API.Controller.Shares.Links;

public sealed partial class ShareLinksController
{
/// <summary>
/// Edit a shocker in a share link
/// </summary>
/// <param name="id"></param>
/// <param name="shockerId"></param>
/// <param name="data"></param>
/// <summary>
/// Edit a shocker in a share link
/// </summary>
/// <param name="id"></param>
/// <param name="shockerId"></param>
/// <param name="data"></param>
/// <response code="200">Successfully updated shocker</response>
/// <response code="404">Share link or shocker does not exist</response>
/// <response code="400">Shocker does not exist in share link</response>
Expand All @@ -39,6 +39,7 @@ await _db.ShockerSharesLinksShockers.FirstOrDefaultAsync(x =>
shocker.PermShock = data.Permissions.Shock;
shocker.LimitDuration = data.Limits.Duration;
shocker.LimitIntensity = data.Limits.Intensity;
shocker.PermLive = data.Permissions.Live;
shocker.Cooldown = data.Cooldown;

await _db.SaveChangesAsync();
Expand Down
4 changes: 3 additions & 1 deletion API/Controller/Shockers/ShareShockerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public async Task<BaseResponse<IEnumerable<ShareInfo>>> GetShares([FromRoute] Gu
{
Sound = x.PermSound,
Shock = x.PermShock,
Vibrate = x.PermVibrate
Vibrate = x.PermVibrate,
Live = x.PermLive
},
Limits = new ShockerLimits
{
Expand Down Expand Up @@ -216,6 +217,7 @@ public async Task<BaseResponse<object>> UpdateShare(
share.PermVibrate = data.Permissions.Vibrate;
share.LimitDuration = data.Limits.Duration;
share.LimitIntensity = data.Limits.Intensity;
share.PermLive = data.Permissions.Live;

await _db.SaveChangesAsync();

Expand Down
3 changes: 2 additions & 1 deletion API/Controller/Shockers/SharedShockersController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ public async Task<BaseResponse<IEnumerable<OwnerShockerResponse>>> GetSharedShoc
{
Shock = x.PermShock,
Sound = x.PermSound,
Vibrate = x.PermVibrate
Vibrate = x.PermVibrate,
Live = x.PermLive
},
Limits = new ShockerLimits
{
Expand Down
1 change: 1 addition & 0 deletions API/Models/Response/ShockerPermissions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ public class ShockerPermissions
public required bool Vibrate { get; set; }
public required bool Sound { get; set; }
public required bool Shock { get; set; }
public bool Live { get; set; } = false;
}
2 changes: 0 additions & 2 deletions LiveControlGateway/Controllers/DeviceController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,6 @@ await HcOwner.OtaInstallFailed(
payload.OtaInstallFailed.UpdateId,
payload.OtaInstallFailed.Fatal,
payload.OtaInstallFailed.Message!);



_lastStatus = OtaUpdateStatus.Error;
break;
Expand Down

0 comments on commit 183a39f

Please sign in to comment.