(string appId, [FromBody] UpdateAppRequestBody body, CancellationToken cancellationToken)
| 152 | } |
| 153 | |
| 154 | [HttpPut("/api/_apps/{appId}")] |
| 155 | public async Task<IActionResult> Update(string appId, [FromBody] UpdateAppRequestBody body, CancellationToken cancellationToken) |
| 156 | { |
| 157 | var app = await GetOwnedApp(appId); |
| 158 | if (app == null) |
| 159 | return NotFound(); |
| 160 | |
| 161 | if (!string.IsNullOrEmpty(body.Icon)) |
| 162 | { |
| 163 | var content = Convert.FromBase64String(body.Icon); |
| 164 | app.IconPath = await _blobService.UploadAsync("icons", content, "image/png", cancellationToken); |
| 165 | } |
| 166 | |
| 167 | app.Name = body.Name; |
| 168 | await _db.Connection.ExecuteScalarAsync<string>("UPDATE apps SET name = @name, icon_path = @iconPath WHERE id = @appId", new |
| 169 | { |
| 170 | appId = app.Id, |
| 171 | name = app.Name, |
| 172 | iconPath = app.IconPath, |
| 173 | }); |
| 174 | |
| 175 | return Ok(app); |
| 176 | } |
| 177 | |
| 178 | [HttpDelete("/api/_apps/{appId}")] |
| 179 | public async Task<IActionResult> Delete(string appId) |
nothing calls this directly
no test coverage detected