From 21d9fdab16ff269260c61fb7155f307f8566af1a Mon Sep 17 00:00:00 2001 From: StevanFreeborn Date: Fri, 24 Jun 2022 09:58:35 -0500 Subject: [PATCH] add characters controller and repository --- server/Controllers/v1/CharactersController.cs | 12 ++ server/Controllers/v1/QuotesController.cs | 10 +- .../Repositories/CharacterRepository.cs | 6 + .../Repositories/ICharacterRepository.cs | 13 ++ server/Program.cs | 2 + .../profile.arm.json | 113 ++++++++++++++++++ 6 files changed, 155 insertions(+), 1 deletion(-) create mode 100644 server/Controllers/v1/CharactersController.cs create mode 100644 server/Persistence/Repositories/CharacterRepository.cs create mode 100644 server/Persistence/Repositories/ICharacterRepository.cs create mode 100644 server/Properties/ServiceDependencies/criminalmindsapi - Web Deploy/profile.arm.json diff --git a/server/Controllers/v1/CharactersController.cs b/server/Controllers/v1/CharactersController.cs new file mode 100644 index 0000000..2a31a84 --- /dev/null +++ b/server/Controllers/v1/CharactersController.cs @@ -0,0 +1,12 @@ +using Microsoft.AspNetCore.Mvc; + +namespace server.Controllers.v1 +{ + [ApiController] + [ApiVersion("1.0")] + [Route("/api/episodes")] + [Produces("application/json")] + public class CharactersController : ControllerBase + { + } +} diff --git a/server/Controllers/v1/QuotesController.cs b/server/Controllers/v1/QuotesController.cs index 08de272..e8f838c 100644 --- a/server/Controllers/v1/QuotesController.cs +++ b/server/Controllers/v1/QuotesController.cs @@ -46,7 +46,15 @@ namespace server.Controllers.v1 } } - // TODO: Add xml comments + /// + /// Gets a quote by its id. + /// + /// The id of the quote being requested. + /// Returns the quote requested. + /// Not a valid request. + /// Quote with the given id not found. + /// Failed to get quote. + /// Returns a quote. [MapToApiVersion("1.0")] [HttpGet("{id}")] [ProducesResponseType(typeof(Quote), StatusCodes.Status200OK)] diff --git a/server/Persistence/Repositories/CharacterRepository.cs b/server/Persistence/Repositories/CharacterRepository.cs new file mode 100644 index 0000000..a06868f --- /dev/null +++ b/server/Persistence/Repositories/CharacterRepository.cs @@ -0,0 +1,6 @@ +namespace server.Persistence.Repositories +{ + public class CharacterRepository : ICharacterRepository + { + } +} diff --git a/server/Persistence/Repositories/ICharacterRepository.cs b/server/Persistence/Repositories/ICharacterRepository.cs new file mode 100644 index 0000000..2882fa5 --- /dev/null +++ b/server/Persistence/Repositories/ICharacterRepository.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace server.Persistence.Repositories +{ + public interface ICharacterRepository + { + + } +} diff --git a/server/Program.cs b/server/Program.cs index 72fae26..7095bca 100644 --- a/server/Program.cs +++ b/server/Program.cs @@ -63,6 +63,8 @@ builder.Services.AddScoped(); builder.Services.AddScoped(); +builder.Services.AddScoped(); + builder.Services.AddControllers(); builder.Services.AddEndpointsApiExplorer(); diff --git a/server/Properties/ServiceDependencies/criminalmindsapi - Web Deploy/profile.arm.json b/server/Properties/ServiceDependencies/criminalmindsapi - Web Deploy/profile.arm.json new file mode 100644 index 0000000..9d32f2f --- /dev/null +++ b/server/Properties/ServiceDependencies/criminalmindsapi - Web Deploy/profile.arm.json @@ -0,0 +1,113 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "_dependencyType": "compute.appService.windows" + }, + "parameters": { + "resourceGroupName": { + "type": "string", + "defaultValue": "StevanFreeborn", + "metadata": { + "description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking." + } + }, + "resourceGroupLocation": { + "type": "string", + "defaultValue": "centralus", + "metadata": { + "description": "Location of the resource group. Resource groups could have different location than resources, however by default we use API versions from latest hybrid profile which support all locations for resource types we support." + } + }, + "resourceName": { + "type": "string", + "defaultValue": "criminalmindsapi", + "metadata": { + "description": "Name of the main resource to be created by this template." + } + }, + "resourceLocation": { + "type": "string", + "defaultValue": "[parameters('resourceGroupLocation')]", + "metadata": { + "description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there." + } + } + }, + "variables": { + "appServicePlan_name": "[concat('Plan', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]", + "appServicePlan_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/serverFarms/', variables('appServicePlan_name'))]" + }, + "resources": [ + { + "type": "Microsoft.Resources/resourceGroups", + "name": "[parameters('resourceGroupName')]", + "location": "[parameters('resourceGroupLocation')]", + "apiVersion": "2019-10-01" + }, + { + "type": "Microsoft.Resources/deployments", + "name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]", + "resourceGroup": "[parameters('resourceGroupName')]", + "apiVersion": "2019-10-01", + "dependsOn": [ + "[parameters('resourceGroupName')]" + ], + "properties": { + "mode": "Incremental", + "template": { + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [ + { + "location": "[parameters('resourceLocation')]", + "name": "[parameters('resourceName')]", + "type": "Microsoft.Web/sites", + "apiVersion": "2015-08-01", + "tags": { + "[concat('hidden-related:', variables('appServicePlan_ResourceId'))]": "empty" + }, + "dependsOn": [ + "[variables('appServicePlan_ResourceId')]" + ], + "kind": "app", + "properties": { + "name": "[parameters('resourceName')]", + "kind": "app", + "httpsOnly": true, + "reserved": false, + "serverFarmId": "[variables('appServicePlan_ResourceId')]", + "siteConfig": { + "metadata": [ + { + "name": "CURRENT_STACK", + "value": "dotnetcore" + } + ] + } + }, + "identity": { + "type": "SystemAssigned" + } + }, + { + "location": "[parameters('resourceLocation')]", + "name": "[variables('appServicePlan_name')]", + "type": "Microsoft.Web/serverFarms", + "apiVersion": "2015-08-01", + "sku": { + "name": "S1", + "tier": "Standard", + "family": "S", + "size": "S1" + }, + "properties": { + "name": "[variables('appServicePlan_name')]" + } + } + ] + } + } + } + ] +} \ No newline at end of file