Exemple #1
0
        public async Task <IActionResult> PostItem([FromRoute] ulong guildId, [FromRoute] int caseId, [FromForm] Dtos.ModCase.UploadedFile uploadedFile)
        {
            await RequirePermission(guildId, caseId, APIActionPermission.Edit);

            Identity identity = await GetIdentity();

            return(Ok(new { path = await FileRepository.CreateDefault(_serviceProvider, identity).UploadFile(uploadedFile.File, guildId, caseId) }));
        }
Exemple #2
0
        public async Task <IActionResult> DeleteSpecificItem([FromRoute] ulong guildId, [FromRoute] int caseId, [FromRoute] string filename)
        {
            await RequirePermission(guildId, caseId, APIActionPermission.Edit);

            Identity identity = await GetIdentity();

            await FileRepository.CreateDefault(_serviceProvider, identity).DeleteFile(guildId, caseId, filename);

            return(Ok());
        }
Exemple #3
0
        public async Task <IActionResult> GetAllItems([FromRoute] ulong guildId, [FromRoute] int caseId)
        {
            await RequirePermission(guildId, caseId, APIActionPermission.View);

            Identity identity = await GetIdentity();

            List <string> files = new();

            try
            {
                files = FileRepository.CreateDefault(_serviceProvider, identity).GetCaseFiles(guildId, caseId);
            }
            catch (ResourceNotFoundException) { }

            return(Ok(new { names = files }));
        }