mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-02-12 19:22:45 +00:00
api: fix minor issues
This commit is contained in:
committed by
Abdullah Atta
parent
41a185bd9f
commit
908d64bd4f
@@ -102,7 +102,7 @@ namespace Notesnook.API.Controllers
|
||||
}
|
||||
|
||||
[HttpPost]
|
||||
public async Task<IActionResult> PublishAsync([FromQuery] string deviceId, [FromBody] Monograph monograph)
|
||||
public async Task<IActionResult> PublishAsync([FromQuery] string? deviceId, [FromBody] Monograph monograph)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -150,7 +150,7 @@ namespace Notesnook.API.Controllers
|
||||
}
|
||||
|
||||
[HttpPatch]
|
||||
public async Task<IActionResult> UpdateAsync([FromQuery] string deviceId, [FromBody] Monograph monograph)
|
||||
public async Task<IActionResult> UpdateAsync([FromQuery] string? deviceId, [FromBody] Monograph monograph)
|
||||
{
|
||||
try
|
||||
{
|
||||
@@ -265,7 +265,7 @@ namespace Notesnook.API.Controllers
|
||||
}
|
||||
|
||||
[HttpDelete("{id}")]
|
||||
public async Task<IActionResult> DeleteAsync([FromQuery] string deviceId, [FromRoute] string id)
|
||||
public async Task<IActionResult> DeleteAsync([FromQuery] string? deviceId, [FromRoute] string id)
|
||||
{
|
||||
var monograph = await FindMonographAsync(id);
|
||||
if (monograph == null || monograph.Deleted)
|
||||
|
||||
@@ -56,6 +56,13 @@ namespace Notesnook.API.Controllers
|
||||
if (!HttpContext.Request.Headers.ContentLength.HasValue) return BadRequest(new { error = "No Content-Length header found." });
|
||||
|
||||
long fileSize = HttpContext.Request.Headers.ContentLength.Value;
|
||||
if (fileSize == 0)
|
||||
{
|
||||
var uploadUrl = S3Service.GetUploadObjectUrl(userId, name);
|
||||
if (uploadUrl == null) return BadRequest(new { error = "Could not create signed url." });
|
||||
return Ok(uploadUrl);
|
||||
}
|
||||
|
||||
var subscriptionService = await WampServers.SubscriptionServer.GetServiceAsync<IUserSubscriptionService>(SubscriptionServerTopics.UserSubscriptionServiceTopic);
|
||||
var subscription = await subscriptionService.GetUserSubscriptionAsync(Clients.Notesnook.Id, userId);
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Notesnook.API.Models
|
||||
public bool SelfDestruct { get; set; }
|
||||
|
||||
[JsonPropertyName("encryptedContent")]
|
||||
public EncryptedData EncryptedContent { get; set; }
|
||||
public EncryptedData? EncryptedContent { get; set; }
|
||||
|
||||
[JsonPropertyName("datePublished")]
|
||||
public long DatePublished { get; set; }
|
||||
@@ -85,10 +85,10 @@ namespace Notesnook.API.Models
|
||||
public string Content { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public byte[] CompressedContent { get; set; }
|
||||
public byte[]? CompressedContent { get; set; }
|
||||
|
||||
[JsonPropertyName("password")]
|
||||
public EncryptedData Password { get; set; }
|
||||
public EncryptedData? Password { get; set; }
|
||||
|
||||
[JsonPropertyName("deleted")]
|
||||
public bool Deleted { get; set; }
|
||||
|
||||
@@ -87,6 +87,7 @@ namespace Notesnook.API.Services
|
||||
Plan = SubscriptionPlan.FREE,
|
||||
UserId = response.UserId,
|
||||
StartTime = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
|
||||
Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user