You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							84 lines
						
					
					
						
							2.3 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							84 lines
						
					
					
						
							2.3 KiB
						
					
					
				| using System; | |
| using System.Collections; | |
| using System.Collections.Generic; | |
| using System.Linq; | |
| using System.Threading.Tasks; | |
| using CoviDok.Api; | |
| using CoviDok.Api.Request; | |
| using CoviDok.Api.Response; | |
| using CoviDok.BLL; | |
| using CoviDok.data; | |
| using Microsoft.AspNetCore.Http; | |
| using Microsoft.AspNetCore.Mvc; | |
| 
 | |
| namespace CoviDok.Controllers | |
| { | |
|     [Route("api/[controller]")] | |
|     [ApiController] | |
|     public class CaseController : ControllerBase | |
|     { | |
|         // POST /api/Case/{id} | |
|         [HttpGet("{id}")] | |
|         public async Task<ActionResult<Case>> GetCase(string id, AuthGet auth) | |
|         { | |
|             if (auth.SessionID != "a") return Unauthorized(); | |
| 
 | |
|             List<Update> updates = new List<Update>(); | |
|             for (int i = 0; i < 10; i++) | |
|             { | |
|                 Update u = new Update | |
|                 { | |
|                     Content = i.ToString(), | |
|                     Sender = "Dr. A B", | |
|                     Id = i.ToString() | |
|                 }; | |
|                 updates.Add(u); | |
|             } | |
|             Case c = new Case | |
|             { | |
|                 Id = "asasadf", | |
|                 DoctorID = "hehegbvdesv", | |
|                 ParentID = "qgwenhjegh", | |
|                 ChildID = "egwbenbeb", | |
|                 CaseStatus = CaseStatus.InProgress | |
|             }; | |
| 
 | |
|             return c; | |
|         } | |
| 
 | |
|         // POST /api/Case/{id}/update | |
|  | |
|         [HttpPut("{id}/update")] | |
|         public async Task<IActionResult> PostUpdate(string id, CaseUpdate data) | |
|         { | |
|             if (data.SessionID != "a") return Unauthorized(); | |
| 
 | |
|             return Ok(); | |
|         } | |
| 
 | |
|         // POST /api/Case/{id}/close | |
|         [HttpPost("{i}/close")] | |
|         public async Task<IActionResult> PostClose(string id, CaseUpdate data) | |
|         { | |
|             if (data.SessionID != "a") return Unauthorized(); | |
|             // if not doctor: unauthorized | |
|             return Ok(); | |
|         } | |
| 
 | |
|         // POST /api/Case/filter | |
|         public async Task<ActionResult<FilteredCases>> Filter(CaseFilter filters) | |
|         { | |
|             if (filters.SessionID != "a") return Unauthorized(); | |
| 
 | |
|             FilteredCases cases = new FilteredCases(); | |
|             for (int i = 0; i < 10; i++) | |
|             { | |
|                 cases.Cases.Add(Tools.MockCase(filters.Filters)); | |
|             } | |
| 
 | |
|             return cases; | |
|              | |
|         } | |
| 
 | |
|     } | |
| }
 | |
| 
 |