Skip to content
This repository has been archived by the owner on Oct 23, 2024. It is now read-only.

Commit

Permalink
Merge pull request #12 from NCAR/Additional-Routes-for-Front-End
Browse files Browse the repository at this point in the history
Bug fixes and refactors due to database changes
  • Loading branch information
ecyr20 authored Apr 23, 2024
2 parents 7b1ae2f + 4b934d8 commit 9fc28eb
Show file tree
Hide file tree
Showing 47 changed files with 409 additions and 984 deletions.
2 changes: 1 addition & 1 deletion Controllers/FamilyController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public async Task<IReadOnlyList<Family>> Get()

// POST api/Family/create
[HttpPost("create")]
public async Task<Guid> Create([FromBody] string name)
public async Task<Family> Create([FromBody] string name)
{
return await familyService.CreateFamilyAsync(name);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,40 @@ namespace Chemistry_Cafe_API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class FamilyMechListController : ControllerBase
public class FamilyTagMechListController : ControllerBase
{
private FamilyMechListService familyMechListService;
private FamilyTagMechListService familyMechListService;

//Injects sql data source setup in Program.cs
public FamilyMechListController([FromServices] MySqlDataSource db)
public FamilyTagMechListController([FromServices] MySqlDataSource db)
{
this.familyMechListService = new FamilyMechListService(db);
this.familyMechListService = new FamilyTagMechListService(db);
}

// GET: api/FamilyMechList/all
[HttpGet("all")]
public async Task<IReadOnlyList<FamilyMechList>> Get()
public async Task<IReadOnlyList<FamilyTagMechList>> Get()
{
return await familyMechListService.GetFamilyMechListsAsync();
}

// GET api/FamilyMechList/5
[HttpGet("{uuid}")]
public async Task<FamilyMechList?> Get(Guid uuid)
public async Task<FamilyTagMechList?> Get(Guid uuid)
{
return await familyMechListService.GetFamilyMechListAsync(uuid);
}

// POST api/FamilyMechList/create
[HttpPost("create")]
public async Task<Guid> Create([FromBody] FamilyMechList newFamilyMechList)
public async Task<Guid> Create([FromBody] FamilyTagMechList newFamilyMechList)
{
return await familyMechListService.CreateFamilyMechListAsync(newFamilyMechList);
}

// PUT api/FamilyMechList/5
[HttpPut("update")]
public async Task Put([FromBody] FamilyMechList newFamilyMechList)
public async Task Put([FromBody] FamilyTagMechList newFamilyMechList)
{
await familyMechListService.UpdateFamilyMechListAsync(newFamilyMechList);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,40 +9,40 @@ namespace Chemistry_Cafe_API.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class FamilyMechListVersionController : ControllerBase
public class FamilyTagMechListVersionController : ControllerBase
{
private FamilyMechListVersionService familyMechListVersionService;
private FamilyTagMechListVersionService familyMechListVersionService;

//Injects sql data source setup in Program.cs
public FamilyMechListVersionController([FromServices] MySqlDataSource db)
public FamilyTagMechListVersionController([FromServices] MySqlDataSource db)
{
this.familyMechListVersionService = new FamilyMechListVersionService(db);
this.familyMechListVersionService = new FamilyTagMechListVersionService(db);
}

// GET: api/FamilyMechListVersion/all
[HttpGet("all")]
public async Task<IReadOnlyList<FamilyMechListVersion>> Get()
public async Task<IReadOnlyList<FamilyTagMechListVersion>> Get()
{
return await familyMechListVersionService.GetFamilyMechListVersionsAsync();
}

// GET api/FamilyMechListVersion/5
[HttpGet("{uuid}")]
public async Task<FamilyMechListVersion?> Get(Guid uuid)
public async Task<FamilyTagMechListVersion?> Get(Guid uuid)
{
return await familyMechListVersionService.GetFamilyMechListVersionAsync(uuid);
}

// POST api/FamilyMechListVersion/create
[HttpPost("create")]
public async Task<Guid> Create([FromBody] FamilyMechListVersion newFamilyMechListVersion)
public async Task<Guid> Create([FromBody] FamilyTagMechListVersion newFamilyMechListVersion)
{
return await familyMechListVersionService.CreateFamilyMechListVersionAsync(newFamilyMechListVersion);
}

// PUT api/FamilyMechListVersion/5
[HttpPut("update")]
public async Task Put([FromBody] FamilyMechListVersion newFamilyMechListVersion)
public async Task Put([FromBody] FamilyTagMechListVersion newFamilyMechListVersion)
{
await familyMechListVersionService.UpdateFamilyMechListVersionAsync(newFamilyMechListVersion);
}
Expand Down
57 changes: 0 additions & 57 deletions Controllers/MechTagMechListController.cs

This file was deleted.

57 changes: 0 additions & 57 deletions Controllers/MechTagMechListVersionController.cs

This file was deleted.

65 changes: 0 additions & 65 deletions Controllers/MechanismController.cs

This file was deleted.

11 changes: 9 additions & 2 deletions Controllers/OpenAtmosController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@ public OpenAtmosController([FromServices] MySqlDataSource db)

// GET: api/OpenAtmos/JSON
[HttpGet("JSON/{tag_mechanism_uuid}")]
public async Task<string> Get(Guid tag_mechanism_uuid)
public async Task<string> GetJSON(Guid tag_mechanism_uuid)
{
return await openAtmosService.Get(tag_mechanism_uuid);
return await openAtmosService.GetJSON(tag_mechanism_uuid);
}

// GET: api/OpenAtmos/YAML
[HttpGet("YAML/{tag_mechanism_uuid}")]
public async Task<string> GetYAML(Guid tag_mechanism_uuid)
{
return await openAtmosService.GetYAML(tag_mechanism_uuid);
}

}
Expand Down
7 changes: 7 additions & 0 deletions Controllers/PropertyTypeController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ public async Task<IReadOnlyList<PropertyType>> Get()
return await propertyTypeService.GetPropertyTypeAsync(uuid);
}

// GET: api/PropertyType/Validation/uuid
[HttpGet("Validation/{validation}")]
public async Task<IReadOnlyList<PropertyType>> GetValidation(string validation)
{
return await propertyTypeService.GetPropertyTypeValidationAsync(validation);
}

// POST api/PropertyType/create
[HttpPost("create")]
public async Task<Guid> Create([FromBody] PropertyType propertyType)
Expand Down
10 changes: 5 additions & 5 deletions Controllers/ReactantProductListController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,14 +57,14 @@ public async Task Create([FromBody] ReactantProductList reactantProduct)

// PUT api/ReactantProductList/5
[HttpPut("update")]
public async Task Put([FromBody] ReactantProductList userpreferences)
public async Task Put([FromBody] ReactantProductList reactantProductList)
{
await userpreferencesService.UpdateReactantProductListAsync(userpreferences);
await userpreferencesService.UpdateReactantProductListAsync(reactantProductList);
}

// DELETE api/ReactantProductList/delete/5
[HttpDelete("delete/{uuid}")]
public async Task Delete(Guid uuid)
// DELETE api/ReactantProductList/delete Body [reaction_product_uuid, species_uuid]
[HttpDelete("delete")]
public async Task Delete([FromBody]DeleteReactantProductList uuid)
{
await userpreferencesService.DeleteReactantProductListAsync(uuid);
}
Expand Down
7 changes: 7 additions & 0 deletions Controllers/ReactionController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ public async Task<IReadOnlyList<Reaction>> Get()
return await reactionService.GetReactionAsync(uuid);
}

// GET api/Reaction/String/5
[HttpGet("String/{uuid}")]
public async Task<String?> GetString(Guid uuid)
{
return await reactionService.GetReactionStringAsync(uuid);
}

// GET api/Reaction/TagMechanism/5
[HttpGet("TagMechanism/{tag_mechanism_uuid}")]
public async Task<IReadOnlyList<Reaction>> GetTags(Guid tag_mechanism_uuid)
Expand Down
Loading

0 comments on commit 9fc28eb

Please sign in to comment.