├── .idea
└── .idea.AccraCity
│ └── .idea
│ └── .name
├── AccraCityApi
├── obj
│ ├── Debug
│ │ └── net7.0
│ │ │ ├── AccraCityApi.MvcApplicationPartsAssemblyInfo.cache
│ │ │ ├── AccraCityApi.AssemblyInfoInputs.cache
│ │ │ ├── AccraCityApi.genruntimeconfig.cache
│ │ │ ├── apphost
│ │ │ ├── AccraCityApi.csproj.CoreCompileInputs.cache
│ │ │ ├── AccraCityApi.dll
│ │ │ ├── AccraCityApi.pdb
│ │ │ ├── ref
│ │ │ └── AccraCityApi.dll
│ │ │ ├── refint
│ │ │ └── AccraCityApi.dll
│ │ │ ├── staticwebassets
│ │ │ ├── msbuild.build.AccraCityApi.props
│ │ │ ├── msbuild.buildMultiTargeting.AccraCityApi.props
│ │ │ └── msbuild.buildTransitive.AccraCityApi.props
│ │ │ ├── AccraCityApi.assets.cache
│ │ │ ├── AccraCityApi.csproj.AssemblyReference.cache
│ │ │ ├── .NETCoreApp,Version=v7.0.AssemblyAttributes.cs
│ │ │ ├── staticwebassets.build.json
│ │ │ ├── AccraCityApi.MvcApplicationPartsAssemblyInfo.cs
│ │ │ ├── AccraCityApi.GlobalUsings.g.cs
│ │ │ ├── AccraCityApi.GeneratedMSBuildEditorConfig.editorconfig
│ │ │ ├── AccraCityApi.AssemblyInfo.cs
│ │ │ └── AccraCityApi.csproj.FileListAbsolute.txt
│ ├── AccraCityApi.csproj.nuget.g.targets
│ ├── AccraCityApi.csproj.nuget.g.props
│ ├── AccraCityApi.csproj.nuget.dgspec.json
│ └── project.nuget.cache
├── bin
│ └── Debug
│ │ └── net7.0
│ │ ├── AccraCityApi
│ │ ├── AccraCityApi.dll
│ │ ├── AccraCityApi.pdb
│ │ ├── Microsoft.OpenApi.dll
│ │ ├── AccraCity.Application.dll
│ │ ├── AccraCityApi.Contracts.dll
│ │ ├── AccraCityApi.Contracts.pdb
│ │ ├── Microsoft.AspNetCore.OpenApi.dll
│ │ ├── Swashbuckle.AspNetCore.Swagger.dll
│ │ ├── Swashbuckle.AspNetCore.SwaggerGen.dll
│ │ ├── Swashbuckle.AspNetCore.SwaggerUI.dll
│ │ ├── appsettings.Development.json
│ │ ├── AccraCityApi.runtimeconfig.json
│ │ └── appsettings.json
├── appsettings.Development.json
├── appsettings.json
├── Properties
│ └── launchSettings.json
├── ContractMappings
│ ├── RegionContractMapping.cs
│ ├── DistrictContractMapping.cs
│ └── TownContractMapping.cs
├── AccraCityApi.csproj
├── ApiEndpoints.cs
├── Controllers
│ ├── AuthController.cs
│ ├── TownController.cs
│ ├── RegionController.cs
│ └── DistrictController.cs
└── Program.cs
├── Request
└── CityApi
│ ├── DeleteTown.http
│ ├── CreateTown.http
│ ├── GetTownRequest.http
│ └── UpdateTown.http
├── AccraCity.Application
├── obj
│ ├── Debug
│ │ └── net7.0
│ │ │ ├── AccraCity.Application.AssemblyInfoInputs.cache
│ │ │ ├── AccraCity.Application.csproj.CoreCompileInputs.cache
│ │ │ ├── AccraCity.Application.dll
│ │ │ ├── ref
│ │ │ └── AccraCity.Application.dll
│ │ │ ├── refint
│ │ │ └── AccraCity.Application.dll
│ │ │ ├── AccraCity.Application.assets.cache
│ │ │ ├── AccraCity.Application.csproj.AssemblyReference.cache
│ │ │ ├── .NETCoreApp,Version=v7.0.AssemblyAttributes.cs
│ │ │ ├── AccraCity.Application.GlobalUsings.g.cs
│ │ │ ├── AccraCity.Application.GeneratedMSBuildEditorConfig.editorconfig
│ │ │ ├── AccraCity.Application.AssemblyInfo.cs
│ │ │ └── AccraCity.Application.csproj.FileListAbsolute.txt
│ ├── AccraCity.Application.csproj.nuget.g.targets
│ ├── AccraCity.Application.csproj.EntityFrameworkCore.targets
│ ├── AccraCity.Application.csproj.nuget.g.props
│ └── AccraCity.Application.csproj.nuget.dgspec.json
├── bin
│ └── Debug
│ │ └── net7.0
│ │ └── AccraCity.Application.dll
├── OtherObjects
│ └── StaticUserRoles.cs
├── Models
│ ├── User.cs
│ ├── Region.cs
│ ├── District.cs
│ └── AccraCity.cs
├── Dto
│ ├── UpdatePermissionDto.cs
│ ├── AuthServiceResponseDto.cs
│ ├── LoginDto.cs
│ └── RegisterDto.cs
├── ApplicationCollectionExtensions.cs
├── Interface
│ ├── IAuthRepository.cs
│ ├── ITownRepository.cs
│ ├── IRegionRepository.cs
│ └── IDistrictRepository.cs
├── AccraCity.Application.csproj
├── Database
│ └── AppDbContext.cs
├── Repository
│ ├── RegionRepository.cs
│ ├── DistrictRepository.cs
│ └── TownRepository.cs
└── Service
│ └── AuthService.cs
├── AccraCityApi.Contracts
├── obj
│ ├── Debug
│ │ └── net7.0
│ │ │ ├── AccraCityApi.Contracts.AssemblyInfoInputs.cache
│ │ │ ├── AccraCityApi.Contracts.csproj.CoreCompileInputs.cache
│ │ │ ├── AccraCityApi.Contracts.dll
│ │ │ ├── AccraCityApi.Contracts.pdb
│ │ │ ├── ref
│ │ │ └── AccraCityApi.Contracts.dll
│ │ │ ├── refint
│ │ │ └── AccraCityApi.Contracts.dll
│ │ │ ├── AccraCityApi.Contracts.assets.cache
│ │ │ ├── AccraCityApi.Contracts.csproj.AssemblyReference.cache
│ │ │ ├── .NETCoreApp,Version=v7.0.AssemblyAttributes.cs
│ │ │ ├── AccraCityApi.Contracts.GlobalUsings.g.cs
│ │ │ ├── AccraCityApi.Contracts.GeneratedMSBuildEditorConfig.editorconfig
│ │ │ ├── AccraCityApi.Contracts.AssemblyInfo.cs
│ │ │ └── AccraCityApi.Contracts.csproj.FileListAbsolute.txt
│ ├── AccraCityApi.Contracts.csproj.nuget.g.targets
│ ├── AccraCityApi.Contracts.csproj.nuget.g.props
│ ├── AccraCityApi.Contracts.csproj.nuget.dgspec.json
│ └── project.nuget.cache
├── bin
│ └── Debug
│ │ └── net7.0
│ │ ├── AccraCity.Application.dll
│ │ ├── AccraCityApi.Contracts.dll
│ │ └── AccraCityApi.Contracts.pdb
├── Requests
│ ├── RegionRequests
│ │ ├── CreateRegionRequest.cs
│ │ └── UpdateRegionRequest.cs
│ ├── DistrictRequests
│ │ ├── CreateDistrictRequest.cs
│ │ └── UpdateDistrictRequest.cs
│ └── TownRequests
│ │ ├── CreateTownRequest.cs
│ │ └── UpdateTownRequest.cs
├── Response
│ ├── FinalResponse.cs
│ ├── TownResponses
│ │ ├── TownsResponse.cs
│ │ └── TownResponse.cs
│ ├── RegionResponses
│ │ ├── RegionsResponse.cs
│ │ └── RegionResponse.cs
│ └── DistrictResponse
│ │ ├── DistrictsResponse.cs
│ │ └── DistrictResponse.cs
└── AccraCityApi.Contracts.csproj
├── LICENSE
├── AccraCity.sln
├── Docs
└── Api.md
├── README.md
├── CODE_OF_CONDUCT.md
└── .gitignore
/.idea/.idea.AccraCity/.idea/.name:
--------------------------------------------------------------------------------
1 | AccraCity
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/AccraCityApi.MvcApplicationPartsAssemblyInfo.cache:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/Request/CityApi/DeleteTown.http:
--------------------------------------------------------------------------------
1 |
2 | DELETE http://localhost:5235/town/1
3 | Content-Type: application/json
4 |
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/AccraCityApi.AssemblyInfoInputs.cache:
--------------------------------------------------------------------------------
1 | 3aec0258bcb26a18974c1608537d4abcf3570892457934e53a4d9c2d359923b5
2 |
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/AccraCityApi.genruntimeconfig.cache:
--------------------------------------------------------------------------------
1 | 43fc75fbc330d57b5f3189ddbec82e246419c469599420d85ea4b68373dbf2a7
2 |
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/apphost:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi/obj/Debug/net7.0/apphost
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/AccraCityApi.csproj.CoreCompileInputs.cache:
--------------------------------------------------------------------------------
1 | 567f100f396538ba46df8e7fae053bc6ab939740808908bbc6a428b4391bee34
2 |
--------------------------------------------------------------------------------
/AccraCityApi/bin/Debug/net7.0/AccraCityApi:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi/bin/Debug/net7.0/AccraCityApi
--------------------------------------------------------------------------------
/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.AssemblyInfoInputs.cache:
--------------------------------------------------------------------------------
1 | 15b41af1a5579d7fc76ea9b0da0d8b6b389415faa810e7e06337c6ab42032dbf
2 |
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.AssemblyInfoInputs.cache:
--------------------------------------------------------------------------------
1 | d13322c8a01036b0b1fff2202ec3295b7d2613327f45052279ebba6fb14010b4
2 |
--------------------------------------------------------------------------------
/AccraCityApi/bin/Debug/net7.0/AccraCityApi.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi/bin/Debug/net7.0/AccraCityApi.dll
--------------------------------------------------------------------------------
/AccraCityApi/bin/Debug/net7.0/AccraCityApi.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi/bin/Debug/net7.0/AccraCityApi.pdb
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/AccraCityApi.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi/obj/Debug/net7.0/AccraCityApi.dll
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/AccraCityApi.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi/obj/Debug/net7.0/AccraCityApi.pdb
--------------------------------------------------------------------------------
/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.csproj.CoreCompileInputs.cache:
--------------------------------------------------------------------------------
1 | 7ab3326cbeb52bfe8f6e14c20579c32d13d07653c6549efcf479351985d6f902
2 |
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.csproj.CoreCompileInputs.cache:
--------------------------------------------------------------------------------
1 | ca6b27b5e667fea7e16071212889440ecd24cf8142d90522af4fd59acf685a79
2 |
--------------------------------------------------------------------------------
/AccraCityApi/bin/Debug/net7.0/Microsoft.OpenApi.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi/bin/Debug/net7.0/Microsoft.OpenApi.dll
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/ref/AccraCityApi.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi/obj/Debug/net7.0/ref/AccraCityApi.dll
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/refint/AccraCityApi.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi/obj/Debug/net7.0/refint/AccraCityApi.dll
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/staticwebassets/msbuild.build.AccraCityApi.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/staticwebassets/msbuild.buildMultiTargeting.AccraCityApi.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/AccraCityApi/bin/Debug/net7.0/AccraCity.Application.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi/bin/Debug/net7.0/AccraCity.Application.dll
--------------------------------------------------------------------------------
/AccraCityApi/bin/Debug/net7.0/AccraCityApi.Contracts.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi/bin/Debug/net7.0/AccraCityApi.Contracts.dll
--------------------------------------------------------------------------------
/AccraCityApi/bin/Debug/net7.0/AccraCityApi.Contracts.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi/bin/Debug/net7.0/AccraCityApi.Contracts.pdb
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/AccraCityApi.assets.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi/obj/Debug/net7.0/AccraCityApi.assets.cache
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/staticwebassets/msbuild.buildTransitive.AccraCityApi.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
--------------------------------------------------------------------------------
/AccraCityApi/bin/Debug/net7.0/Microsoft.AspNetCore.OpenApi.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi/bin/Debug/net7.0/Microsoft.AspNetCore.OpenApi.dll
--------------------------------------------------------------------------------
/AccraCity.Application/bin/Debug/net7.0/AccraCity.Application.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCity.Application/bin/Debug/net7.0/AccraCity.Application.dll
--------------------------------------------------------------------------------
/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.dll
--------------------------------------------------------------------------------
/AccraCityApi/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/AccraCityApi/bin/Debug/net7.0/Swashbuckle.AspNetCore.Swagger.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi/bin/Debug/net7.0/Swashbuckle.AspNetCore.Swagger.dll
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/bin/Debug/net7.0/AccraCity.Application.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi.Contracts/bin/Debug/net7.0/AccraCity.Application.dll
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/bin/Debug/net7.0/AccraCityApi.Contracts.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi.Contracts/bin/Debug/net7.0/AccraCityApi.Contracts.dll
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/bin/Debug/net7.0/AccraCityApi.Contracts.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi.Contracts/bin/Debug/net7.0/AccraCityApi.Contracts.pdb
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.dll
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.pdb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.pdb
--------------------------------------------------------------------------------
/AccraCityApi/bin/Debug/net7.0/Swashbuckle.AspNetCore.SwaggerGen.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi/bin/Debug/net7.0/Swashbuckle.AspNetCore.SwaggerGen.dll
--------------------------------------------------------------------------------
/AccraCityApi/bin/Debug/net7.0/Swashbuckle.AspNetCore.SwaggerUI.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi/bin/Debug/net7.0/Swashbuckle.AspNetCore.SwaggerUI.dll
--------------------------------------------------------------------------------
/AccraCity.Application/obj/Debug/net7.0/ref/AccraCity.Application.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCity.Application/obj/Debug/net7.0/ref/AccraCity.Application.dll
--------------------------------------------------------------------------------
/AccraCity.Application/obj/Debug/net7.0/refint/AccraCity.Application.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCity.Application/obj/Debug/net7.0/refint/AccraCity.Application.dll
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/obj/Debug/net7.0/ref/AccraCityApi.Contracts.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi.Contracts/obj/Debug/net7.0/ref/AccraCityApi.Contracts.dll
--------------------------------------------------------------------------------
/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.assets.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.assets.cache
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/obj/Debug/net7.0/refint/AccraCityApi.Contracts.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi.Contracts/obj/Debug/net7.0/refint/AccraCityApi.Contracts.dll
--------------------------------------------------------------------------------
/AccraCityApi/bin/Debug/net7.0/appsettings.Development.json:
--------------------------------------------------------------------------------
1 | {
2 | "Logging": {
3 | "LogLevel": {
4 | "Default": "Information",
5 | "Microsoft.AspNetCore": "Warning"
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/AccraCityApi.csproj.AssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi/obj/Debug/net7.0/AccraCityApi.csproj.AssemblyReference.cache
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.assets.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.assets.cache
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/Requests/RegionRequests/CreateRegionRequest.cs:
--------------------------------------------------------------------------------
1 | namespace AccraCityApi.Contracts.Requests.RegionRequests;
2 |
3 | public class CreateRegionRequest
4 | {
5 | public required string RegionName { get; set; }
6 | }
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/Requests/RegionRequests/UpdateRegionRequest.cs:
--------------------------------------------------------------------------------
1 | namespace AccraCityApi.Contracts.Requests.RegionRequests;
2 |
3 | public class UpdateRegionRequest
4 | {
5 | public required string RegionName { get; set; }
6 | }
--------------------------------------------------------------------------------
/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.csproj.AssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.csproj.AssemblyReference.cache
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.csproj.AssemblyReference.cache:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/niiwade/Accra-City-Towns-Api/HEAD/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.csproj.AssemblyReference.cache
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/Response/FinalResponse.cs:
--------------------------------------------------------------------------------
1 | namespace AccraCityApi.Contracts.Response;
2 |
3 | public class FinalResponse
4 | {
5 | public int StatusCode { get; set; }
6 | public string? Message { get; set; }
7 | public T? Data { get; set; }
8 | }
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/Response/TownResponses/TownsResponse.cs:
--------------------------------------------------------------------------------
1 | namespace AccraCityApi.Contracts.Response.TownResponses;
2 |
3 | public class TownsResponse
4 | {
5 | public required IEnumerable Towns { get; init; } = Enumerable.Empty();
6 | }
--------------------------------------------------------------------------------
/AccraCity.Application/OtherObjects/StaticUserRoles.cs:
--------------------------------------------------------------------------------
1 | namespace AccraCity.Application.OtherObjects;
2 |
3 | public class StaticUserRoles
4 | {
5 | public const string OWNER = "OWNER";
6 | public const string ADMIN = "ADMIN";
7 | public const string USER = "USER";
8 | }
--------------------------------------------------------------------------------
/AccraCity.Application/Models/User.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.AspNetCore.Identity;
2 |
3 | namespace AccraCity.Application.Models;
4 |
5 | public class User : IdentityUser
6 | {
7 | public required string FirstName { get; set; }
8 | public required string LastName { get; set; }
9 | }
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/Response/RegionResponses/RegionsResponse.cs:
--------------------------------------------------------------------------------
1 | namespace AccraCityApi.Contracts.Response.RegionResponses;
2 |
3 | public class RegionsResponse
4 | {
5 | public required IEnumerable Regions { get; init; } = Enumerable.Empty();
6 | }
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs:
--------------------------------------------------------------------------------
1 | //
2 | using System;
3 | using System.Reflection;
4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")]
5 |
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/Requests/DistrictRequests/CreateDistrictRequest.cs:
--------------------------------------------------------------------------------
1 | namespace AccraCityApi.Contracts.Requests.DistrictRequests;
2 |
3 | public class CreateDistrictRequest
4 | {
5 | public required string DistrictName { get; set; }
6 | public Guid RegionId { get; set; }
7 | }
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/Requests/DistrictRequests/UpdateDistrictRequest.cs:
--------------------------------------------------------------------------------
1 | namespace AccraCityApi.Contracts.Requests.DistrictRequests;
2 |
3 | public class UpdateDistrictRequest
4 | {
5 | public required string DistrictName { get; set; }
6 | public Guid RegionId { get; set; }
7 | }
--------------------------------------------------------------------------------
/AccraCity.Application/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs:
--------------------------------------------------------------------------------
1 | //
2 | using System;
3 | using System.Reflection;
4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")]
5 |
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/obj/Debug/net7.0/.NETCoreApp,Version=v7.0.AssemblyAttributes.cs:
--------------------------------------------------------------------------------
1 | //
2 | using System;
3 | using System.Reflection;
4 | [assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETCoreApp,Version=v7.0", FrameworkDisplayName = ".NET 7.0")]
5 |
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/Response/DistrictResponse/DistrictsResponse.cs:
--------------------------------------------------------------------------------
1 | namespace AccraCityApi.Contracts.Response.DistrictResponse;
2 |
3 | public class DistrictsResponse
4 | {
5 | public required IEnumerable Districts { get; init; } = Enumerable.Empty();
6 | }
--------------------------------------------------------------------------------
/AccraCity.Application/Dto/UpdatePermissionDto.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 |
3 | namespace AccraCity.Application.Dto;
4 |
5 | public class UpdatePermissionDto
6 | {
7 | [Required(ErrorMessage = "Username is required")]
8 | public required string UserName { get; set; }
9 | }
--------------------------------------------------------------------------------
/AccraCity.Application/Dto/AuthServiceResponseDto.cs:
--------------------------------------------------------------------------------
1 | namespace AccraCity.Application.Dto;
2 |
3 | public class AuthServiceResponseDto
4 | {
5 | public int? StatusCode { get; set; }
6 | public bool IsSucceed { get; set; }
7 | public string? Message { get; set; }
8 | public string? Data { get; set; }
9 | }
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/Response/DistrictResponse/DistrictResponse.cs:
--------------------------------------------------------------------------------
1 | namespace AccraCityApi.Contracts.Response.DistrictResponse;
2 |
3 | public class DistrictResponse
4 | {
5 | public required Guid Id { get; set; }
6 | public required string DistrictName { get; set; }
7 | public Guid RegionId { get; set; }
8 | }
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/staticwebassets.build.json:
--------------------------------------------------------------------------------
1 | {
2 | "Version": 1,
3 | "Hash": "sqLnhEbClVaS5jfBCi5qnVrTtrnRy8rkw3H5nW0QE+0=",
4 | "Source": "AccraCityApi",
5 | "BasePath": "_content/AccraCityApi",
6 | "Mode": "Default",
7 | "ManifestType": "Build",
8 | "ReferencedProjectsConfiguration": [],
9 | "DiscoveryPatterns": [],
10 | "Assets": []
11 | }
--------------------------------------------------------------------------------
/AccraCity.Application/Models/Region.cs:
--------------------------------------------------------------------------------
1 | namespace AccraCity.Application.Models;
2 |
3 | public class Region
4 | {
5 | public required Guid Id { get; set; }
6 | public required string RegionName { get; set; }
7 | public ICollection Districts { get; set; } = new List();
8 | public ICollection Towns { get; set; } = new List();
9 | }
--------------------------------------------------------------------------------
/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.GlobalUsings.g.cs:
--------------------------------------------------------------------------------
1 | //
2 | global using global::System;
3 | global using global::System.Collections.Generic;
4 | global using global::System.IO;
5 | global using global::System.Linq;
6 | global using global::System.Net.Http;
7 | global using global::System.Threading;
8 | global using global::System.Threading.Tasks;
9 |
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.GlobalUsings.g.cs:
--------------------------------------------------------------------------------
1 | //
2 | global using global::System;
3 | global using global::System.Collections.Generic;
4 | global using global::System.IO;
5 | global using global::System.Linq;
6 | global using global::System.Net.Http;
7 | global using global::System.Threading;
8 | global using global::System.Threading.Tasks;
9 |
--------------------------------------------------------------------------------
/AccraCity.Application/Dto/LoginDto.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 |
3 | namespace AccraCity.Application.Dto;
4 |
5 | public class LoginDto
6 | {
7 | [Required (ErrorMessage = "Username is required")]
8 | public required string UserName { get; set; }
9 | [Required (ErrorMessage = "Password is required")]
10 | public required string Password { get; set; }
11 | }
--------------------------------------------------------------------------------
/AccraCity.Application/Models/District.cs:
--------------------------------------------------------------------------------
1 | namespace AccraCity.Application.Models;
2 |
3 | public class District
4 | {
5 | public required Guid Id { get; set; }
6 | public required string DistrictName { get; set; }
7 | public Guid RegionId { get; set; }
8 | public Region Region { get; set; } = null!;
9 | public ICollection Towns { get; set; } = new List();
10 |
11 | }
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/AccraCityApi.Contracts.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | enable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/Response/RegionResponses/RegionResponse.cs:
--------------------------------------------------------------------------------
1 | using AccraCity.Application.Models;
2 |
3 | namespace AccraCityApi.Contracts.Response.RegionResponses;
4 | public class RegionResponse
5 | {
6 | public required Guid Id { get; set; }
7 | public required string RegionName { get; set; }
8 | // public ICollection Districts { get; set; } = new List();
9 | // public ICollection Towns { get; set; } = new List();
10 |
11 | }
--------------------------------------------------------------------------------
/Request/CityApi/CreateTown.http:
--------------------------------------------------------------------------------
1 |
2 | POST http://localhost:5235/town
3 | Content-Type: application/json
4 |
5 | {
6 | "TownName": "Mamprobi",
7 | "District":"dfdfsf",
8 | "Category":"fsdsdfs",
9 | "Region":"sdfsdf",
10 | "Population":"121121",
11 | "Latitude": "12.1",
12 | "Longitude": "0.2",
13 | "startDateTime": "2022-04-08T08:00:00",
14 | "NearbyTowns": [
15 | "sasadsd",
16 | "adasfef",
17 | "Thaow",
18 | "trqpe"
19 |
20 | ],
21 | "NotableLandMarks": [
22 | "sasadsd",
23 | "adasfef"
24 | ]
25 | }
--------------------------------------------------------------------------------
/Request/CityApi/GetTownRequest.http:
--------------------------------------------------------------------------------
1 |
2 | GET http://localhost:5235/town/
3 | Content-Type: application/json
4 |
5 | {
6 | "TownName": "Mamprobi",
7 | "District":"dfdfsf",
8 | "Category":"fsdsdfs",
9 | "Region":"sdfsdf",
10 | "Population":"121121",
11 | "Latitude": "12.1",
12 | "Longitude": "0.2",
13 | "startDateTime": "2022-04-08T08:00:00",
14 | "NearbyTowns": [
15 | "sasadsd",
16 | "adasfef",
17 | "Thaow",
18 | "trqpe"
19 |
20 | ],
21 | "NotableLandMarks": [
22 | "sasadsd",
23 | "adasfef"
24 | ]
25 | }
--------------------------------------------------------------------------------
/Request/CityApi/UpdateTown.http:
--------------------------------------------------------------------------------
1 |
2 | PUT http://localhost:5235/town/1
3 | Content-Type: application/json
4 |
5 | {
6 | "TownName": "Mamprobi",
7 | "District":"dfdfsf",
8 | "Category":"fsdsdfs",
9 | "Region":"sdfsdf",
10 | "Population":"121121",
11 | "Latitude": "12.1",
12 | "Longitude": "0.2",
13 | "startDateTime": "2022-04-08T08:00:00",
14 | "NearbyTowns": [
15 | "sasadsd",
16 | "adasfef",
17 | "Thaow",
18 | "trqpe"
19 |
20 | ],
21 | "NotableLandMarks": [
22 | "sasadsd",
23 | "adasfef"
24 | ]
25 | }
--------------------------------------------------------------------------------
/AccraCityApi/bin/Debug/net7.0/AccraCityApi.runtimeconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "runtimeOptions": {
3 | "tfm": "net7.0",
4 | "frameworks": [
5 | {
6 | "name": "Microsoft.NETCore.App",
7 | "version": "7.0.0"
8 | },
9 | {
10 | "name": "Microsoft.AspNetCore.App",
11 | "version": "7.0.0"
12 | }
13 | ],
14 | "configProperties": {
15 | "System.GC.Server": true,
16 | "System.Reflection.NullabilityInfoContext.IsSupported": true,
17 | "System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
18 | }
19 | }
20 | }
--------------------------------------------------------------------------------
/AccraCity.Application/Dto/RegisterDto.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel.DataAnnotations;
2 |
3 | namespace AccraCity.Application.Dto;
4 |
5 | public class RegisterDto
6 | {
7 | [Required (ErrorMessage = "FirstName is required")]
8 | public required string FirstName { get; set; }
9 |
10 | [Required (ErrorMessage = "LastName is required")]
11 | public required string LastName { get; set; }
12 |
13 | [Required (ErrorMessage = "Username is required")]
14 | public required string UserName { get; set; }
15 | [Required (ErrorMessage = "Email is required")]
16 | public required string Email { get; set; }
17 | [Required (ErrorMessage = "Password is required")]
18 | public required string Password { get; set; }
19 | }
--------------------------------------------------------------------------------
/AccraCity.Application/ApplicationCollectionExtensions.cs:
--------------------------------------------------------------------------------
1 | using AccraCity.Application.Interface;
2 | using AccraCity.Application.Repository;
3 | using AccraCity.Application.Service;
4 | using Microsoft.Extensions.DependencyInjection;
5 |
6 | namespace AccraCity.Application;
7 |
8 | public static class ApplicationCollectionExtensions
9 | {
10 | public static IServiceCollection AddApplication(this IServiceCollection service)
11 | {
12 | service.AddScoped();
13 | service.AddScoped();
14 | service.AddScoped();
15 | service.AddScoped();
16 | return service;
17 | }
18 |
19 | }
--------------------------------------------------------------------------------
/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.GeneratedMSBuildEditorConfig.editorconfig:
--------------------------------------------------------------------------------
1 | is_global = true
2 | build_property.TargetFramework = net7.0
3 | build_property.TargetPlatformMinVersion =
4 | build_property.UsingMicrosoftNETSdkWeb =
5 | build_property.ProjectTypeGuids =
6 | build_property.InvariantGlobalization =
7 | build_property.PlatformNeutralAssembly =
8 | build_property.EnforceExtendedAnalyzerRules =
9 | build_property._SupportedPlatformList = Linux,macOS,Windows
10 | build_property.RootNamespace = AccraCity.Application
11 | build_property.ProjectDir = /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/
12 | build_property.EnableComHosting =
13 | build_property.EnableGeneratedComInterfaceComImportInterop =
14 |
--------------------------------------------------------------------------------
/AccraCity.Application/Interface/IAuthRepository.cs:
--------------------------------------------------------------------------------
1 | using AccraCity.Application.Dto;
2 |
3 | namespace AccraCity.Application.Interface;
4 |
5 | public interface IAuthRepository
6 | {
7 | Task SeedRolesAsync();
8 | Task RegisterAsync (RegisterDto registerDto);
9 | Task LoginAsync (LoginDto loginDto);
10 | Task MakeAdminAsync (UpdatePermissionDto updatePermissionDto);
11 | Task MakeOwnerAsync (UpdatePermissionDto updatePermissionDto);
12 | Task RemoveAdminRoleAsync (UpdatePermissionDto updatePermissionDto);
13 | Task RemoveOwnerRoleAsync (UpdatePermissionDto updatePermissionDto);
14 | }
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/Requests/TownRequests/CreateTownRequest.cs:
--------------------------------------------------------------------------------
1 | namespace AccraCityApi.Contracts.AccraCity;
2 |
3 |
4 | public class CreateTownRequest
5 | {
6 | public required string TownName { get; set; }
7 | public required string Category { get; set; }
8 | public required int Population { get; set; }
9 | public required float Latitude { get; set; }
10 | public required float Longitude { get; set; }
11 | public DateTime CreatedAt { get; set; }
12 | //public DateTime LastModifiedAt { get; set; }
13 | public List NearbyTowns { get; set; } = new List();
14 | public List NotableLandMarks { get; set; } = new List();
15 | public Guid DistrictId { get; set; }
16 | public Guid RegionId { get; set; }
17 | }
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/Requests/TownRequests/UpdateTownRequest.cs:
--------------------------------------------------------------------------------
1 | namespace AccraCityApi.Contracts.Requests.TownRequests;
2 | public class UpdateTownRequest
3 | {
4 | public required string TownName { get; set; }
5 | public required string Category { get; set; }
6 | public required int Population { get; set; }
7 | public required float Latitude { get; set; }
8 | public required float Longitude { get; set; }
9 | //public DateTime CreatedAt { get; set; }
10 | public DateTime LastModifiedAt { get; set; }
11 | public List NearbyTowns { get; set; } = new List();
12 | public List NotableLandMarks { get; set; } = new List();
13 | public Guid DistrictId { get; set; }
14 | public Guid RegionId { get; set; }
15 | }
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.GeneratedMSBuildEditorConfig.editorconfig:
--------------------------------------------------------------------------------
1 | is_global = true
2 | build_property.TargetFramework = net7.0
3 | build_property.TargetPlatformMinVersion =
4 | build_property.UsingMicrosoftNETSdkWeb =
5 | build_property.ProjectTypeGuids =
6 | build_property.InvariantGlobalization =
7 | build_property.PlatformNeutralAssembly =
8 | build_property.EnforceExtendedAnalyzerRules =
9 | build_property._SupportedPlatformList = Linux,macOS,Windows
10 | build_property.RootNamespace = AccraCityApi.Contracts
11 | build_property.ProjectDir = /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/
12 | build_property.EnableComHosting =
13 | build_property.EnableGeneratedComInterfaceComImportInterop =
14 |
--------------------------------------------------------------------------------
/AccraCity.Application/Interface/ITownRepository.cs:
--------------------------------------------------------------------------------
1 | using AccraCity.Application.Models;
2 |
3 | namespace AccraCity.Application.Interface;
4 |
5 | public interface ITownRepository
6 | {
7 | Task> GetTownAsync(CancellationToken token = default);
8 | Task GetTownById(Guid id, CancellationToken token = default);
9 | Task CreateTown(Town town, CancellationToken token = default);
10 | Task UpdateTown(Town town, CancellationToken token = default);
11 | Task DeleteTown(Guid id, CancellationToken token = default);
12 | Task TownExists(Guid id, CancellationToken token = default);
13 | Task TownExistsByName(string townName, CancellationToken token = default);
14 | Task Save(CancellationToken token = default);
15 | }
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/AccraCityApi.MvcApplicationPartsAssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | //
5 | // Changes to this file may cause incorrect behavior and will be lost if
6 | // the code is regenerated.
7 | //
8 | //------------------------------------------------------------------------------
9 |
10 | using System;
11 | using System.Reflection;
12 |
13 | [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("Microsoft.AspNetCore.OpenApi")]
14 | [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("Swashbuckle.AspNetCore.SwaggerGen")]
15 |
16 | // Generated by the MSBuild WriteCodeFragment class.
17 |
18 |
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/Response/TownResponses/TownResponse.cs:
--------------------------------------------------------------------------------
1 | namespace AccraCityApi.Contracts.Response.TownResponses;
2 |
3 |
4 | public class TownResponse
5 | {
6 | public required Guid Id { get; set; }
7 | public required string TownName { get; set; }
8 | public required string Category { get; set; }
9 | public required int Population { get; set; }
10 | public required float Latitude { get; set; }
11 | public required float Longitude { get; set; }
12 | public DateTime CreatedAt { get; set; }
13 | public DateTime LastModifiedAt { get; set; }
14 | public List NearbyTowns { get; set; } = new List();
15 | public List NotableLandMarks { get; set; } = new List();
16 | public Guid DistrictId { get; set; }
17 | public Guid RegionId { get; set; }
18 | }
--------------------------------------------------------------------------------
/AccraCity.Application/Interface/IRegionRepository.cs:
--------------------------------------------------------------------------------
1 | using AccraCity.Application.Models;
2 |
3 | namespace AccraCity.Application.Interface;
4 |
5 | public interface IRegionRepository
6 | {
7 | Task> GetRegionAsync(CancellationToken token = default);
8 | Task GetRegionById(Guid id, CancellationToken token = default);
9 | Task CreateRegion(Region region, CancellationToken token = default);
10 | Task UpdateRegion(Region region, CancellationToken token = default);
11 | Task DeleteRegion(Guid id, CancellationToken token = default);
12 | Task RegionExists(Guid id, CancellationToken token = default);
13 | Task RegionExistsByName(string regionName, CancellationToken token = default);
14 | Task Save(CancellationToken token = default);
15 | }
--------------------------------------------------------------------------------
/AccraCity.Application/Interface/IDistrictRepository.cs:
--------------------------------------------------------------------------------
1 | using AccraCity.Application.Models;
2 |
3 | namespace AccraCity.Application.Interface;
4 |
5 | public interface IDistrictRepository
6 | {
7 | Task> GetDistrictAsync(CancellationToken token = default);
8 | Task GetDistrictById(Guid id, CancellationToken token = default);
9 | Task CreateDistrict(District district, CancellationToken token = default);
10 | Task UpdateDistrict(District district, CancellationToken token = default);
11 | Task DeleteDistrict(Guid id, CancellationToken token = default);
12 | Task DistrictExists(Guid id, CancellationToken token = default);
13 | Task DistrictExistsByName(string districtName, CancellationToken token = default);
14 | Task Save(CancellationToken token = default);
15 | }
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/AccraCityApi.GlobalUsings.g.cs:
--------------------------------------------------------------------------------
1 | //
2 | global using global::Microsoft.AspNetCore.Builder;
3 | global using global::Microsoft.AspNetCore.Hosting;
4 | global using global::Microsoft.AspNetCore.Http;
5 | global using global::Microsoft.AspNetCore.Routing;
6 | global using global::Microsoft.Extensions.Configuration;
7 | global using global::Microsoft.Extensions.DependencyInjection;
8 | global using global::Microsoft.Extensions.Hosting;
9 | global using global::Microsoft.Extensions.Logging;
10 | global using global::System;
11 | global using global::System.Collections.Generic;
12 | global using global::System.IO;
13 | global using global::System.Linq;
14 | global using global::System.Net.Http;
15 | global using global::System.Net.Http.Json;
16 | global using global::System.Threading;
17 | global using global::System.Threading.Tasks;
18 |
--------------------------------------------------------------------------------
/AccraCity.Application/Models/AccraCity.cs:
--------------------------------------------------------------------------------
1 | namespace AccraCity.Application.Models;
2 |
3 | public class Town
4 | {
5 | public required Guid Id { get; set; }
6 | public required string TownName { get; set; }
7 | public required string Category { get; set; }
8 | public required int Population { get; set; }
9 | public required float Latitude { get; set; }
10 | public required float Longitude { get; set; }
11 | public DateTime CreatedAt { get; set; }
12 | public DateTime LastModifiedAt { get; set; }
13 | public List NearbyTowns { get; set; } = new List();
14 | public List NotableLandMarks { get; set; } = new List();
15 | public Guid DistrictId { get; set; }
16 | public District District { get; set; } = null!;
17 | public Guid RegionId { get; set; }
18 | public Region Region { get; set; } = null!;
19 |
20 | }
--------------------------------------------------------------------------------
/AccraCityApi/bin/Debug/net7.0/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "ConnectionStrings": {
3 | "Default": "User ID=postgres;Password=123;Host=localhost;Port=5432;Database=AccraCities;Pooling=true;"
4 |
5 | },
6 |
7 | "Logging": {
8 | "LogLevel": {
9 | "Default": "Information",
10 | "Microsoft.AspNetCore": "Warning"
11 | }
12 | },
13 |
14 | "Serilog": {
15 | "Using": [ "Serilog.Sinks.File" ],
16 | "MinimumLevel": {
17 | "Default": "Information"
18 | },
19 | "WriteTo": [
20 | {
21 | "Name": "File",
22 | "Args": {
23 | "path": "../logs/webapi-.log",
24 | "rollingInterval": "Day",
25 | "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} {CorrelationId} {Level:u3} {Username} {Message:lj}{Exception}{NewLine}"
26 | }
27 | }
28 | ]
29 | },
30 |
31 | "AllowedHosts": "*"
32 | }
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/obj/AccraCityApi.Contracts.csproj.nuget.g.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/AccraCityApi/appsettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "ConnectionStrings": {
3 | "Default": "User ID=postgres;Password=123;Host=localhost;Port=5432;Database=AccraCities;Pooling=true;"
4 |
5 | },
6 |
7 | "Logging": {
8 | "LogLevel": {
9 | "Default": "Information",
10 | "Microsoft.AspNetCore": "Warning"
11 | }
12 | },
13 |
14 | "Serilog": {
15 | "Using": [ "Serilog.Sinks.File" ],
16 | "MinimumLevel": {
17 | "Default": "Information"
18 | },
19 | "WriteTo": [
20 | {
21 | "Name": "File",
22 | "Args": {
23 | "path": "../logs/webapi-.log",
24 | "rollingInterval": "Day",
25 | "outputTemplate": "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} {CorrelationId} {Level:u3} {Username} {Message:lj}{Exception}{NewLine}"
26 | }
27 | }
28 | ]
29 | },
30 |
31 | "JWT" :{
32 | "Issuer": "https://localhost:7034",
33 | "Audience": "https://localhost:7035",
34 | "SecretKey": "88w8j8ushaaamao1983j921128821929922iskssooklk1lsksmmdkjd"
35 | },
36 |
37 | "AllowedHosts": "*"
38 | }
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/AccraCityApi.GeneratedMSBuildEditorConfig.editorconfig:
--------------------------------------------------------------------------------
1 | is_global = true
2 | build_property.TargetFramework = net7.0
3 | build_property.TargetPlatformMinVersion =
4 | build_property.UsingMicrosoftNETSdkWeb = true
5 | build_property.ProjectTypeGuids =
6 | build_property.InvariantGlobalization =
7 | build_property.PlatformNeutralAssembly =
8 | build_property.EnforceExtendedAnalyzerRules =
9 | build_property._SupportedPlatformList = Linux,macOS,Windows
10 | build_property.RootNamespace = AccraCityApi
11 | build_property.RootNamespace = AccraCityApi
12 | build_property.ProjectDir = /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi/
13 | build_property.EnableComHosting =
14 | build_property.EnableGeneratedComInterfaceComImportInterop =
15 | build_property.RazorLangVersion = 7.0
16 | build_property.SupportLocalizedComponentNames =
17 | build_property.GenerateRazorMetadataSourceChecksumAttributes =
18 | build_property.MSBuildProjectDirectory = /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi
19 | build_property._RazorSourceGeneratorDebug =
20 |
--------------------------------------------------------------------------------
/AccraCityApi/obj/Debug/net7.0/AccraCityApi.AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | //
5 | // Changes to this file may cause incorrect behavior and will be lost if
6 | // the code is regenerated.
7 | //
8 | //------------------------------------------------------------------------------
9 |
10 | using System;
11 | using System.Reflection;
12 |
13 | [assembly: System.Reflection.AssemblyCompanyAttribute("AccraCityApi")]
14 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
15 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
16 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f24e56dffa2d2658c23d4329669add422753c512")]
17 | [assembly: System.Reflection.AssemblyProductAttribute("AccraCityApi")]
18 | [assembly: System.Reflection.AssemblyTitleAttribute("AccraCityApi")]
19 | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
20 |
21 | // Generated by the MSBuild WriteCodeFragment class.
22 |
23 |
--------------------------------------------------------------------------------
/AccraCity.Application/obj/AccraCity.Application.csproj.nuget.g.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2023 Joseph Nii Lante Lamptey
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | //
5 | // Changes to this file may cause incorrect behavior and will be lost if
6 | // the code is regenerated.
7 | //
8 | //------------------------------------------------------------------------------
9 |
10 | using System;
11 | using System.Reflection;
12 |
13 | [assembly: System.Reflection.AssemblyCompanyAttribute("AccraCity.Application")]
14 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
15 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
16 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+21db8216bc15515f2a7232f1f473ba278099453b")]
17 | [assembly: System.Reflection.AssemblyProductAttribute("AccraCity.Application")]
18 | [assembly: System.Reflection.AssemblyTitleAttribute("AccraCity.Application")]
19 | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
20 |
21 | // Generated by the MSBuild WriteCodeFragment class.
22 |
23 |
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | //
5 | // Changes to this file may cause incorrect behavior and will be lost if
6 | // the code is regenerated.
7 | //
8 | //------------------------------------------------------------------------------
9 |
10 | using System;
11 | using System.Reflection;
12 |
13 | [assembly: System.Reflection.AssemblyCompanyAttribute("AccraCityApi.Contracts")]
14 | [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
15 | [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
16 | [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+21db8216bc15515f2a7232f1f473ba278099453b")]
17 | [assembly: System.Reflection.AssemblyProductAttribute("AccraCityApi.Contracts")]
18 | [assembly: System.Reflection.AssemblyTitleAttribute("AccraCityApi.Contracts")]
19 | [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
20 |
21 | // Generated by the MSBuild WriteCodeFragment class.
22 |
23 |
--------------------------------------------------------------------------------
/AccraCityApi/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "$schema": "https://json.schemastore.org/launchsettings.json",
3 | "iisSettings": {
4 | "windowsAuthentication": false,
5 | "anonymousAuthentication": true,
6 | "iisExpress": {
7 | "applicationUrl": "http://localhost:34331",
8 | "sslPort": 44366
9 | }
10 | },
11 | "profiles": {
12 | "http": {
13 | "commandName": "Project",
14 | "dotnetRunMessages": true,
15 | "launchBrowser": true,
16 | "launchUrl": "swagger",
17 | "applicationUrl": "http://localhost:5235",
18 | "environmentVariables": {
19 | "ASPNETCORE_ENVIRONMENT": "Development"
20 | }
21 | },
22 | "https": {
23 | "commandName": "Project",
24 | "dotnetRunMessages": true,
25 | "launchBrowser": true,
26 | "launchUrl": "swagger",
27 | "applicationUrl": "https://localhost:7093;http://localhost:5235",
28 | "environmentVariables": {
29 | "ASPNETCORE_ENVIRONMENT": "Development"
30 | }
31 | },
32 | "IIS Express": {
33 | "commandName": "IISExpress",
34 | "launchBrowser": true,
35 | "launchUrl": "swagger",
36 | "environmentVariables": {
37 | "ASPNETCORE_ENVIRONMENT": "Development"
38 | }
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/AccraCityApi/obj/AccraCityApi.csproj.nuget.g.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/AccraCity.Application/AccraCity.Application.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | net8.0
5 | enable
6 | enable
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | all
16 | runtime; build; native; contentfiles; analyzers; buildtransitive
17 |
18 |
19 | all
20 | runtime; build; native; contentfiles; analyzers; buildtransitive
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
--------------------------------------------------------------------------------
/AccraCityApi/ContractMappings/RegionContractMapping.cs:
--------------------------------------------------------------------------------
1 | using AccraCity.Application.Models;
2 | using AccraCityApi.Contracts.Requests.RegionRequests;
3 | using AccraCityApi.Contracts.Response.RegionResponses;
4 |
5 | namespace AccraCityApi.ContractMappings;
6 |
7 | public static class RegionContractMapping
8 | {
9 | public static Region MapToRegion(this CreateRegionRequest request) //This maps the CreateRegionDto to Region
10 | {
11 | return new Region()
12 | {
13 | Id = Guid.NewGuid(),
14 | RegionName = request.RegionName
15 | };
16 |
17 | }
18 |
19 | public static Region MapToRegion(this UpdateRegionRequest request, Guid id) //This maps the UpdateRegionDto to Region
20 | {
21 | return new Region()
22 | {
23 | Id = id,
24 | RegionName = request.RegionName
25 | };
26 |
27 | }
28 |
29 |
30 | public static RegionResponse MapsToResponse(this Region region) //This maps the Region to RegionResponseDto
31 | {
32 | return new RegionResponse()
33 | {
34 | Id = region.Id,
35 | RegionName = region.RegionName
36 | };
37 | }
38 |
39 | public static RegionsResponse MapsToResponse(this IEnumerable regions) //This maps the list of districts to the DistrictsResponses
40 | {
41 | return new RegionsResponse()
42 | {
43 | Regions = regions.Select(MapsToResponse)
44 | };
45 | }
46 | }
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/obj/AccraCityApi.Contracts.csproj.nuget.g.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | True
5 | NuGet
6 | $(MSBuildThisFileDirectory)project.assets.json
7 | /Users/perigrinobruce/.nuget/packages/
8 | /Users/perigrinobruce/.nuget/packages/
9 | PackageReference
10 | 6.9.1
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/AccraCityApi/ContractMappings/DistrictContractMapping.cs:
--------------------------------------------------------------------------------
1 | using AccraCity.Application.Models;
2 | using AccraCityApi.Contracts.Requests.DistrictRequests;
3 | using AccraCityApi.Contracts.Response.DistrictResponse;
4 |
5 | namespace AccraCityApi.ContractMappings;
6 |
7 | public static class DistrictContractMapping
8 | {
9 | public static District MapToDistrict(this CreateDistrictRequest request) //This maps the CreateDistrictDto to Region
10 | {
11 | return new District()
12 | {
13 | Id = Guid.NewGuid(),
14 | DistrictName = request.DistrictName,
15 | RegionId = request.RegionId
16 | };
17 |
18 | }
19 |
20 | public static District MapToDistrict(this UpdateDistrictRequest request, Guid id) //This maps the UpdateDistrictDto to Region
21 | {
22 | return new District()
23 | {
24 | Id = id,
25 | DistrictName = request.DistrictName,
26 | RegionId = request.RegionId
27 | };
28 |
29 | }
30 |
31 |
32 | public static DistrictResponse MapsToResponse(this District district) //This maps the District to DistrictResponseDto
33 | {
34 | return new DistrictResponse()
35 | {
36 | Id = district.Id,
37 | DistrictName = district.DistrictName,
38 | RegionId = district.RegionId
39 | };
40 | }
41 |
42 | public static DistrictsResponse MapsToResponse(this IEnumerable districts) //This maps the list of Districts to the DistrictsResponses
43 | {
44 | return new DistrictsResponse()
45 | {
46 | Districts = districts.Select(MapsToResponse)
47 | };
48 | }
49 | }
--------------------------------------------------------------------------------
/AccraCity.Application/obj/AccraCity.Application.csproj.EntityFrameworkCore.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/AccraCityApi/AccraCityApi.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | net8.0
10 | enable
11 | enable
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | all
21 | runtime; build; native; contentfiles; analyzers; buildtransitive
22 |
23 |
24 | all
25 | runtime; build; native; contentfiles; analyzers; buildtransitive
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
--------------------------------------------------------------------------------
/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/bin/Debug/net7.0/AccraCity.Application.deps.json
2 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/bin/Debug/net7.0/AccraCity.Application.runtimeconfig.json
3 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/bin/Debug/net7.0/AccraCity.Application.dll
4 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/bin/Debug/net7.0/AccraCity.Application.pdb
5 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.csproj.AssemblyReference.cache
6 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.GeneratedMSBuildEditorConfig.editorconfig
7 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.AssemblyInfoInputs.cache
8 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.AssemblyInfo.cs
9 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.csproj.CoreCompileInputs.cache
10 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.sourcelink.json
11 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.dll
12 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/obj/Debug/net7.0/refint/AccraCity.Application.dll
13 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.pdb
14 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/obj/Debug/net7.0/AccraCity.Application.genruntimeconfig.cache
15 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/obj/Debug/net7.0/ref/AccraCity.Application.dll
16 |
--------------------------------------------------------------------------------
/AccraCity.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.0.31903.59
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccraCityApi.Contracts", "AccraCityApi.Contracts\AccraCityApi.Contracts.csproj", "{B8D9F013-0BB9-40CD-92FC-0A071AD80C3B}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccraCityApi", "AccraCityApi\AccraCityApi.csproj", "{1C35B840-B613-4FD7-BC77-F3B8F4009D1C}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AccraCity.Application", "AccraCity.Application\AccraCity.Application.csproj", "{D5C8EDCA-769E-4ADA-8DFB-6290F03926AA}"
11 | EndProject
12 | Global
13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
14 | Debug|Any CPU = Debug|Any CPU
15 | Release|Any CPU = Release|Any CPU
16 | EndGlobalSection
17 | GlobalSection(SolutionProperties) = preSolution
18 | HideSolutionNode = FALSE
19 | EndGlobalSection
20 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
21 | {B8D9F013-0BB9-40CD-92FC-0A071AD80C3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
22 | {B8D9F013-0BB9-40CD-92FC-0A071AD80C3B}.Debug|Any CPU.Build.0 = Debug|Any CPU
23 | {B8D9F013-0BB9-40CD-92FC-0A071AD80C3B}.Release|Any CPU.ActiveCfg = Release|Any CPU
24 | {B8D9F013-0BB9-40CD-92FC-0A071AD80C3B}.Release|Any CPU.Build.0 = Release|Any CPU
25 | {1C35B840-B613-4FD7-BC77-F3B8F4009D1C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
26 | {1C35B840-B613-4FD7-BC77-F3B8F4009D1C}.Debug|Any CPU.Build.0 = Debug|Any CPU
27 | {1C35B840-B613-4FD7-BC77-F3B8F4009D1C}.Release|Any CPU.ActiveCfg = Release|Any CPU
28 | {1C35B840-B613-4FD7-BC77-F3B8F4009D1C}.Release|Any CPU.Build.0 = Release|Any CPU
29 | {D5C8EDCA-769E-4ADA-8DFB-6290F03926AA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
30 | {D5C8EDCA-769E-4ADA-8DFB-6290F03926AA}.Debug|Any CPU.Build.0 = Debug|Any CPU
31 | {D5C8EDCA-769E-4ADA-8DFB-6290F03926AA}.Release|Any CPU.ActiveCfg = Release|Any CPU
32 | {D5C8EDCA-769E-4ADA-8DFB-6290F03926AA}.Release|Any CPU.Build.0 = Release|Any CPU
33 | EndGlobalSection
34 | EndGlobal
35 |
--------------------------------------------------------------------------------
/AccraCityApi/ApiEndpoints.cs:
--------------------------------------------------------------------------------
1 | namespace AccraCityApi;
2 |
3 | public static class ApiEndpoints
4 | {
5 | private const string ApiBase = "api";
6 |
7 | public static class Region
8 | {
9 | private const string Base = $"{ApiBase}/region";
10 |
11 | public const string Get = $"{Base}/{{id:guid}}";
12 |
13 | public const string GetRegion = $"{Base}/region/{{id:guid}}";
14 | public const string GetAll = Base;
15 | public const string Create = Base;
16 | public const string Update = $"{Base}/{{id:guid}}";
17 | public const string Delete = $"{Base}/{{id:guid}}";
18 | }
19 |
20 |
21 | public static class District
22 | {
23 | private const string Base = $"{ApiBase}/district";
24 |
25 | public const string Get = $"{Base}/{{id:guid}}";
26 |
27 | public const string GetDistrict = $"{Base}/district/{{id:guid}}";
28 | public const string GetAll = Base;
29 | public const string Create = Base;
30 | public const string Update = $"{Base}/{{id:guid}}";
31 | public const string Delete = $"{Base}/{{id:guid}}";
32 | }
33 |
34 | public static class Town
35 | {
36 | private const string Base = $"{ApiBase}/town";
37 |
38 | public const string Get = $"{Base}/{{id:guid}}";
39 |
40 | public const string GetTown = $"{Base}/town/{{id:guid}}";
41 | public const string GetAll = Base;
42 | public const string Create = Base;
43 | public const string Update = $"{Base}/{{id:guid}}";
44 | public const string Delete = $"{Base}/{{id:guid}}";
45 | }
46 |
47 | public static class Auth
48 | {
49 | private const string Base = $"{ApiBase}/Auth";
50 |
51 | public const string SeedRoles = $"{Base}/seed-roles";
52 | //public const string GetWallet = $"{Base}/wallets/{{id:guid}}";
53 | public const string Register = $"{Base}/register";
54 | public const string Login = $"{Base}/login";
55 | public const string MakeAdmin = $"{Base}/make_user_admin";
56 | public const string MakeOwner = $"{Base}/make_user_owner";
57 | public const string RemoveOwnerRole = $"{Base}/remove_owner_role";
58 | public const string RemoveAdminRole = $"{Base}/remove_admin_role";
59 | }
60 |
61 | }
--------------------------------------------------------------------------------
/AccraCity.Application/Database/AppDbContext.cs:
--------------------------------------------------------------------------------
1 | using AccraCity.Application.Models;
2 | using Microsoft.AspNetCore.Identity;
3 | using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
4 | using Microsoft.EntityFrameworkCore;
5 | using Microsoft.EntityFrameworkCore.Design;
6 | using Microsoft.Extensions.Configuration;
7 |
8 | namespace AccraCity.Application.Database;
9 |
10 | public class AppDbContext : IdentityDbContext
11 | {
12 | public AppDbContext(DbContextOptions options) : base(options)
13 | {
14 |
15 | }
16 | protected override void OnModelCreating(ModelBuilder modelBuilder)
17 | {
18 | modelBuilder.Entity()
19 | .HasMany(e => e.Districts)
20 | .WithOne(e => e.Region)
21 | .HasForeignKey(e => e.RegionId)
22 | .IsRequired();
23 |
24 | modelBuilder.Entity()
25 | .HasMany(e => e.Towns)
26 | .WithOne(e => e.Region)
27 | .HasForeignKey(e => e.RegionId)
28 | .IsRequired();
29 |
30 | modelBuilder.Entity()
31 | .HasMany(e => e.Towns)
32 | .WithOne(e => e.District)
33 | .HasForeignKey(e => e.DistrictId)
34 | .IsRequired();
35 |
36 | modelBuilder.Entity>().HasNoKey();
37 | modelBuilder.Entity>().HasNoKey();
38 | modelBuilder.Entity>().HasNoKey();
39 | }
40 | public DbSet Town { get; set; }
41 | public DbSet Regions { get; set; }
42 | public DbSet Districts { get; set; }
43 | }
44 |
45 | public class AppDbContextFactory : IDesignTimeDbContextFactory
46 | {
47 | public AppDbContext CreateDbContext(string[] args)
48 | {
49 | var configuration = new ConfigurationBuilder()
50 | .SetBasePath(Directory.GetCurrentDirectory()) // Assuming the appsettings.json file is in the same directory
51 | .AddJsonFile(@Directory.GetCurrentDirectory() + "/../AccraCityApi/appsettings.json")
52 | .Build();
53 | var connectionString = configuration.GetConnectionString("Default");
54 | var optionsBuilder = new DbContextOptionsBuilder();
55 | optionsBuilder.UseNpgsql(connectionString);
56 |
57 | return new AppDbContext(optionsBuilder.Options);
58 | }
59 | }
--------------------------------------------------------------------------------
/AccraCity.Application/obj/AccraCity.Application.csproj.nuget.g.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | True
5 | NuGet
6 | $(MSBuildThisFileDirectory)project.assets.json
7 | /Users/perigrinobruce/.nuget/packages/
8 | /Users/perigrinobruce/.nuget/packages/
9 | PackageReference
10 | 6.9.1
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | /Users/perigrinobruce/.nuget/packages/microsoft.codeanalysis.analyzers/3.3.3
21 | /Users/perigrinobruce/.nuget/packages/microsoft.entityframeworkcore.tools/8.0.7
22 |
23 |
--------------------------------------------------------------------------------
/AccraCityApi/ContractMappings/TownContractMapping.cs:
--------------------------------------------------------------------------------
1 | using AccraCity.Application.Models;
2 | using AccraCityApi.Contracts.AccraCity;
3 | using AccraCityApi.Contracts.Requests.TownRequests;
4 | using AccraCityApi.Contracts.Response.TownResponses;
5 |
6 | namespace AccraCityApi.ContractMappings;
7 |
8 | public static class TownContractMapping
9 | {
10 | public static Town MapToTown(this CreateTownRequest request) //This maps the CreateTownDto to Town
11 | {
12 | return new Town()
13 | {
14 | Id = Guid.NewGuid(),
15 | TownName = request.TownName,
16 | Category = request.Category,
17 | Population =request.Population,
18 | Latitude = request.Latitude,
19 | Longitude =request.Longitude,
20 | CreatedAt = DateTime.UtcNow,
21 | //LastModifiedAt = request.LastModifiedAt,
22 | NearbyTowns = request.NearbyTowns,
23 | NotableLandMarks = request.NotableLandMarks,
24 | DistrictId = request.DistrictId,
25 | RegionId = request.RegionId
26 | };
27 |
28 | }
29 |
30 | public static Town MapToTown(this UpdateTownRequest request, Guid id) //This maps the UpdateTownDto to Town
31 | {
32 | return new Town()
33 | {
34 | Id = id,
35 | TownName = request.TownName,
36 | Category = request.Category,
37 | Population =request.Population,
38 | Latitude = request.Latitude,
39 | Longitude = request.Longitude,
40 | //CreatedAt = request.CreatedAt,
41 | LastModifiedAt = DateTime.UtcNow,
42 | NearbyTowns = request.NearbyTowns,
43 | NotableLandMarks = request.NotableLandMarks,
44 | DistrictId = request.DistrictId,
45 | RegionId = request.RegionId
46 | };
47 |
48 | }
49 |
50 |
51 | public static TownResponse MapsToResponse(this Town town) //This maps the Town to TownResponseDto
52 | {
53 | return new TownResponse()
54 | {
55 | Id = town.Id,
56 | TownName = town.TownName,
57 | Category = town.Category,
58 | Population =town.Population,
59 | Latitude = town.Latitude,
60 | Longitude =town.Longitude,
61 | CreatedAt = town.CreatedAt,
62 | LastModifiedAt = town.LastModifiedAt,
63 | NearbyTowns = town.NearbyTowns,
64 | NotableLandMarks = town.NotableLandMarks,
65 | DistrictId = town.DistrictId,
66 | RegionId = town.RegionId
67 | };
68 | }
69 |
70 | public static TownsResponse MapsToResponse(this IEnumerable regions) //This maps the list of Towns to the TownsResponses
71 | {
72 | return new TownsResponse()
73 | {
74 | Towns = regions.Select(MapsToResponse)
75 | };
76 | }
77 | }
--------------------------------------------------------------------------------
/AccraCity.Application/Repository/RegionRepository.cs:
--------------------------------------------------------------------------------
1 | using AccraCity.Application.Database;
2 | using AccraCity.Application.Interface;
3 | using AccraCity.Application.Models;
4 | using Microsoft.EntityFrameworkCore;
5 |
6 | namespace AccraCity.Application.Repository;
7 |
8 | public class RegionRepository: IRegionRepository
9 | {
10 | private readonly AppDbContext _context;
11 |
12 | public RegionRepository(AppDbContext context)
13 | {
14 | _context = context;
15 | }
16 |
17 | public async Task> GetRegionAsync(CancellationToken token = default)
18 | {
19 | var region = await _context.Regions.ToListAsync(cancellationToken: token);
20 | return region;
21 | }
22 |
23 | public async Task GetRegionById(Guid id, CancellationToken token = default)
24 | {
25 | var region = await _context.Regions.FirstOrDefaultAsync(i => i.Id == id, cancellationToken: token);
26 | return region;
27 | }
28 |
29 | public async Task CreateRegion(Region region, CancellationToken token = default)
30 | {
31 | var newRegion = new Region()
32 | {
33 | Id = region.Id,
34 | RegionName = region.RegionName
35 | };
36 | await _context.AddAsync(newRegion, token);
37 | return await Save(token);
38 | }
39 |
40 | public async Task UpdateRegion(Region region, CancellationToken token = default)
41 | {
42 | var result = await _context.Regions.FirstOrDefaultAsync(r =>
43 | r.Id == region.Id, cancellationToken: token);
44 |
45 | if (result != null)
46 | {
47 | result.RegionName = region.RegionName;
48 | }
49 | return await Save(token);
50 | }
51 |
52 | public async Task DeleteRegion(Guid id, CancellationToken token = default)
53 | {
54 | var result = await _context.Regions.FirstOrDefaultAsync(i =>
55 | i.Id == id, cancellationToken: token);
56 |
57 | if (result == null)
58 | {
59 | return false; // Region not found or already deleted
60 | }
61 | _context.Remove(result);
62 | return await Save(token);
63 | }
64 |
65 | public async Task RegionExists(Guid id, CancellationToken token = default)
66 | {
67 | var region = await _context.Regions.AnyAsync(r => r.Id == id, cancellationToken: token);
68 | return region;
69 | }
70 |
71 | public async Task RegionExistsByName(string regionName, CancellationToken token = default)
72 | {
73 | var region = await _context.Regions.AnyAsync(r => r.RegionName == regionName, cancellationToken: token);
74 | return region;
75 | }
76 |
77 | public async Task Save(CancellationToken token = default)
78 | {
79 | var saved = await _context.SaveChangesAsync(token);
80 | return saved > 0;
81 | }
82 | }
--------------------------------------------------------------------------------
/AccraCityApi/Controllers/AuthController.cs:
--------------------------------------------------------------------------------
1 | using AccraCity.Application.Dto;
2 | using AccraCity.Application.Interface;
3 | using Microsoft.AspNetCore.Mvc;
4 |
5 | namespace AccraCityApi.Controllers
6 | {
7 | [Route("api/[controller]")]
8 | [ApiController]
9 | public class AuthController : ControllerBase
10 | {
11 | private readonly IAuthRepository _authService;
12 |
13 | public AuthController(IAuthRepository authService)
14 | {
15 | _authService = authService;
16 | }
17 |
18 | // Route For Seeding My Roles to DB
19 | [HttpPost(ApiEndpoints.Auth.SeedRoles)]
20 | public async Task SeedRoles ()
21 | {
22 | var seedData = await _authService.SeedRolesAsync();
23 | return Ok(seedData);
24 | }
25 |
26 |
27 | // Route -> Register
28 | [HttpPost(ApiEndpoints.Auth.Register)]
29 | public async Task Register([FromBody] RegisterDto registerDto)
30 | {
31 | var user = await _authService.RegisterAsync(registerDto);
32 | return Ok(user);
33 | }
34 |
35 | // Route -> Login
36 | [HttpPost(ApiEndpoints.Auth.Login)]
37 | public async Task Login ([FromBody] LoginDto loginRequest)
38 | {
39 | var userLogin = await _authService.LoginAsync(loginRequest);
40 | return Ok(userLogin);
41 | }
42 |
43 |
44 | // Route -> Make User -> ADMIN
45 | [HttpPost(ApiEndpoints.Auth.MakeAdmin)]
46 | public async Task MakeAdmin([FromBody] UpdatePermissionDto updatePermissionRequest)
47 | {
48 | var user = await _authService.MakeAdminAsync(updatePermissionRequest);
49 | return Ok(user);
50 | }
51 |
52 |
53 | // Route -> Make User -> Owner
54 | [HttpPost(ApiEndpoints.Auth.MakeOwner)]
55 | public async Task MakeOwner([FromBody] UpdatePermissionDto updatePermissionRequest)
56 | {
57 | var user = await _authService.MakeOwnerAsync(updatePermissionRequest);
58 | return Ok(user);
59 | }
60 |
61 |
62 | // Route -> Remove Owner Role
63 | [HttpPost(ApiEndpoints.Auth.RemoveOwnerRole)]
64 | public async Task RemoveOwnerRole([FromBody] UpdatePermissionDto updatePermissionRequest)
65 | {
66 | var user = await _authService.RemoveOwnerRoleAsync(updatePermissionRequest);
67 | return Ok(user);
68 | }
69 |
70 |
71 | // Route -> Remove Admin Role
72 | [HttpPost(ApiEndpoints.Auth.RemoveAdminRole)]
73 | public async Task RemoveAdminRole([FromBody] UpdatePermissionDto updatePermissionRequest)
74 | {
75 | var user = await _authService.RemoveAdminRoleAsync(updatePermissionRequest);
76 | return Ok(user);
77 | }
78 | }
79 | }
--------------------------------------------------------------------------------
/AccraCity.Application/Repository/DistrictRepository.cs:
--------------------------------------------------------------------------------
1 | using System.Diagnostics;
2 | using AccraCity.Application.Database;
3 | using AccraCity.Application.Interface;
4 | using AccraCity.Application.Models;
5 | using Microsoft.EntityFrameworkCore;
6 |
7 | namespace AccraCity.Application.Repository;
8 |
9 |
10 | public class DistrictRepository : IDistrictRepository
11 | {
12 | private readonly AppDbContext _context;
13 |
14 | public DistrictRepository(AppDbContext context)
15 | {
16 | _context = context;
17 | }
18 |
19 |
20 | public async Task> GetDistrictAsync(CancellationToken token = default)
21 | {
22 | var district = await _context.Districts.ToListAsync(cancellationToken: token);
23 | return district;
24 | }
25 |
26 | public async Task GetDistrictById(Guid id, CancellationToken token = default)
27 | {
28 | var district = await _context.Districts.FirstOrDefaultAsync(i => i.Id == id, cancellationToken: token);
29 | return district;
30 | }
31 |
32 | public async Task CreateDistrict(District district, CancellationToken token = default)
33 | {
34 | var newDistrict = new District()
35 | {
36 | Id = district.Id,
37 | DistrictName = district.DistrictName,
38 | RegionId = district.RegionId
39 | };
40 | await _context.AddAsync(newDistrict, token);
41 | return await Save(token);
42 | }
43 |
44 | public async Task UpdateDistrict(District district, CancellationToken token = default)
45 | {
46 | var result = await _context.Districts.FirstOrDefaultAsync(d =>
47 | d.Id == district.Id, cancellationToken: token);
48 |
49 | if (result != null)
50 | {
51 | result.DistrictName = district.DistrictName;
52 | result.RegionId = district.RegionId;
53 | }
54 | return await Save(token);
55 | }
56 |
57 | public async Task DeleteDistrict(Guid id, CancellationToken token = default)
58 | {
59 | var result = await _context.Districts.FirstOrDefaultAsync(i =>
60 | i.Id == id, cancellationToken: token);
61 |
62 | if (result == null)
63 | {
64 | return false; // District not found or already deleted
65 | }
66 | _context.Remove(result);
67 | return await Save(token);
68 | }
69 |
70 | public async Task DistrictExists(Guid id, CancellationToken token = default)
71 | {
72 | var district = await _context.Districts.AnyAsync(r => r.Id == id, cancellationToken: token);
73 | return district;
74 | }
75 |
76 | public async Task DistrictExistsByName(string districtName, CancellationToken token = default)
77 | {
78 | var region = await _context.Districts.AnyAsync(r => r.DistrictName == districtName, cancellationToken: token);
79 | return region;
80 | }
81 |
82 | public async Task Save(CancellationToken token = default)
83 | {
84 | var saved = await _context.SaveChangesAsync(token);
85 | return saved > 0;
86 | }
87 | }
--------------------------------------------------------------------------------
/AccraCityApi/obj/AccraCityApi.csproj.nuget.g.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | True
5 | NuGet
6 | $(MSBuildThisFileDirectory)project.assets.json
7 | /Users/perigrinobruce/.nuget/packages/
8 | /Users/perigrinobruce/.nuget/packages/
9 | PackageReference
10 | 6.9.1
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | /Users/perigrinobruce/.nuget/packages/microsoft.extensions.apidescription.server/6.0.5
23 | /Users/perigrinobruce/.nuget/packages/awssdk.core/3.7.100.14
24 | /Users/perigrinobruce/.nuget/packages/awssdk.securitytoken/3.7.100.14
25 | /Users/perigrinobruce/.nuget/packages/microsoft.codeanalysis.analyzers/3.3.3
26 | /Users/perigrinobruce/.nuget/packages/microsoft.entityframeworkcore.tools/8.0.7
27 |
28 |
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.csproj.FileListAbsolute.txt:
--------------------------------------------------------------------------------
1 | /home/wade/Documents/acs work/c# api/AccraCity/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.csproj.AssemblyReference.cache
2 | /home/wade/Documents/acs work/c# api/AccraCity/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.GeneratedMSBuildEditorConfig.editorconfig
3 | /home/wade/Documents/acs work/c# api/AccraCity/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.AssemblyInfoInputs.cache
4 | /home/wade/Documents/acs work/c# api/AccraCity/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.AssemblyInfo.cs
5 | /home/wade/Documents/acs work/c# api/AccraCity/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.csproj.CoreCompileInputs.cache
6 | /home/wade/Documents/acs work/c# api/AccraCity/AccraCityApi.Contracts/bin/Debug/net7.0/AccraCityApi.Contracts.deps.json
7 | /home/wade/Documents/acs work/c# api/AccraCity/AccraCityApi.Contracts/bin/Debug/net7.0/AccraCityApi.Contracts.dll
8 | /home/wade/Documents/acs work/c# api/AccraCity/AccraCityApi.Contracts/bin/Debug/net7.0/AccraCityApi.Contracts.pdb
9 | /home/wade/Documents/acs work/c# api/AccraCity/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.dll
10 | /home/wade/Documents/acs work/c# api/AccraCity/AccraCityApi.Contracts/obj/Debug/net7.0/refint/AccraCityApi.Contracts.dll
11 | /home/wade/Documents/acs work/c# api/AccraCity/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.pdb
12 | /home/wade/Documents/acs work/c# api/AccraCity/AccraCityApi.Contracts/obj/Debug/net7.0/ref/AccraCityApi.Contracts.dll
13 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/bin/Debug/net7.0/AccraCityApi.Contracts.deps.json
14 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/bin/Debug/net7.0/AccraCityApi.Contracts.dll
15 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/bin/Debug/net7.0/AccraCityApi.Contracts.pdb
16 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.csproj.AssemblyReference.cache
17 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.GeneratedMSBuildEditorConfig.editorconfig
18 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.AssemblyInfoInputs.cache
19 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.AssemblyInfo.cs
20 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.csproj.CoreCompileInputs.cache
21 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.sourcelink.json
22 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.dll
23 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/obj/Debug/net7.0/refint/AccraCityApi.Contracts.dll
24 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCityApi.Contracts.pdb
25 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/obj/Debug/net7.0/ref/AccraCityApi.Contracts.dll
26 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/bin/Debug/net7.0/AccraCity.Application.dll
27 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/bin/Debug/net7.0/AccraCity.Application.pdb
28 | /Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/obj/Debug/net7.0/AccraCit.F3F06EC5.Up2Date
29 |
--------------------------------------------------------------------------------
/AccraCity.Application/obj/AccraCity.Application.csproj.nuget.dgspec.json:
--------------------------------------------------------------------------------
1 | {
2 | "format": 1,
3 | "restore": {
4 | "/Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/AccraCity.Application.csproj": {}
5 | },
6 | "projects": {
7 | "/Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/AccraCity.Application.csproj": {
8 | "version": "1.0.0",
9 | "restore": {
10 | "projectUniqueName": "/Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/AccraCity.Application.csproj",
11 | "projectName": "AccraCity.Application",
12 | "projectPath": "/Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/AccraCity.Application.csproj",
13 | "packagesPath": "/Users/perigrinobruce/.nuget/packages/",
14 | "outputPath": "/Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/obj/",
15 | "projectStyle": "PackageReference",
16 | "configFilePaths": [
17 | "/Users/perigrinobruce/.nuget/NuGet/NuGet.Config"
18 | ],
19 | "originalTargetFrameworks": [
20 | "net8.0"
21 | ],
22 | "sources": {
23 | "https://api.nuget.org/v3/index.json": {}
24 | },
25 | "frameworks": {
26 | "net8.0": {
27 | "targetAlias": "net8.0",
28 | "projectReferences": {}
29 | }
30 | },
31 | "warningProperties": {
32 | "warnAsError": [
33 | "NU1605"
34 | ]
35 | }
36 | },
37 | "frameworks": {
38 | "net8.0": {
39 | "targetAlias": "net8.0",
40 | "dependencies": {
41 | "Microsoft.AspNetCore.Authentication.JwtBearer": {
42 | "target": "Package",
43 | "version": "[8.0.7, )"
44 | },
45 | "Microsoft.AspNetCore.Identity.EntityFrameworkCore": {
46 | "target": "Package",
47 | "version": "[8.0.7, )"
48 | },
49 | "Microsoft.AspNetCore.Mvc.NewtonsoftJson": {
50 | "target": "Package",
51 | "version": "[8.0.7, )"
52 | },
53 | "Microsoft.EntityFrameworkCore": {
54 | "target": "Package",
55 | "version": "[8.0.7, )"
56 | },
57 | "Microsoft.EntityFrameworkCore.Design": {
58 | "include": "Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive",
59 | "suppressParent": "All",
60 | "target": "Package",
61 | "version": "[8.0.7, )"
62 | },
63 | "Microsoft.EntityFrameworkCore.Tools": {
64 | "include": "Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive",
65 | "suppressParent": "All",
66 | "target": "Package",
67 | "version": "[8.0.7, )"
68 | },
69 | "Npgsql.EntityFrameworkCore.PostgreSQL": {
70 | "target": "Package",
71 | "version": "[8.0.4, )"
72 | },
73 | "Serilog.AspNetCore": {
74 | "target": "Package",
75 | "version": "[5.0.0, )"
76 | }
77 | },
78 | "imports": [
79 | "net461",
80 | "net462",
81 | "net47",
82 | "net471",
83 | "net472",
84 | "net48",
85 | "net481"
86 | ],
87 | "assetTargetFallback": true,
88 | "warn": true,
89 | "frameworkReferences": {
90 | "Microsoft.NETCore.App": {
91 | "privateAssets": "all"
92 | }
93 | },
94 | "runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/8.0.302/PortableRuntimeIdentifierGraph.json"
95 | }
96 | }
97 | }
98 | }
99 | }
--------------------------------------------------------------------------------
/AccraCity.Application/Repository/TownRepository.cs:
--------------------------------------------------------------------------------
1 | using AccraCity.Application.Database;
2 | using AccraCity.Application.Interface;
3 | using AccraCity.Application.Models;
4 | using Microsoft.EntityFrameworkCore;
5 |
6 | namespace AccraCity.Application.Repository;
7 |
8 | public class TownRepository : ITownRepository
9 | {
10 | private readonly AppDbContext _context;
11 |
12 | public TownRepository(AppDbContext context)
13 | {
14 | _context = context;
15 | }
16 |
17 | public async Task> GetTownAsync(CancellationToken token = default)
18 | {
19 | var town = await _context.Town.ToListAsync(cancellationToken: token);
20 | return town;
21 | }
22 |
23 | public async Task GetTownById(Guid id, CancellationToken token = default)
24 | {
25 | var result = await _context.Town.FirstOrDefaultAsync(t => t.Id == id, cancellationToken:
26 | token);
27 | return result;
28 | }
29 |
30 | public async Task CreateTown(Town town, CancellationToken token = default)
31 | {
32 | var newTown = new Town()
33 | {
34 | Id = Guid.NewGuid(),
35 | TownName = town.TownName,
36 | Category = town.Category,
37 | Population =town.Population,
38 | Latitude = town.Latitude,
39 | Longitude =town.Longitude,
40 | CreatedAt = town.CreatedAt,
41 | //LastModifiedAt = town.LastModifiedAt,
42 | NearbyTowns = town.NearbyTowns,
43 | NotableLandMarks = town.NotableLandMarks,
44 | DistrictId = town.DistrictId,
45 | RegionId = town.RegionId
46 | };
47 | await _context.AddAsync(newTown, token);
48 | return await Save(token);
49 | }
50 |
51 | public async Task UpdateTown(Town town, CancellationToken token = default)
52 | {
53 | var result = await _context.Town.FirstOrDefaultAsync(t =>
54 | t.Id == town.Id, cancellationToken: token);
55 |
56 | if (result != null)
57 | {
58 | result.Id = town.Id;
59 | result.TownName = town.TownName;
60 | result.Category = town.Category;
61 | result.Population =town.Population;
62 | result.Latitude = town.Latitude;
63 | result.Longitude =town.Longitude;
64 | //result.CreatedAt = town.CreatedAt;
65 | result.LastModifiedAt = town.LastModifiedAt;
66 | result.NearbyTowns = town.NearbyTowns;
67 | result.NotableLandMarks = town.NotableLandMarks;
68 | result.DistrictId = town.DistrictId;
69 | result.RegionId = town.RegionId;
70 | }
71 | return await Save(token);
72 | }
73 |
74 | public async Task DeleteTown(Guid id, CancellationToken token = default)
75 | {
76 | var result = await _context.Town.FirstOrDefaultAsync(i =>
77 | i.Id == id, cancellationToken: token);
78 |
79 | if (result == null)
80 | {
81 | return false; // Town not found or already deleted
82 | }
83 | _context.Remove(result);
84 | return await Save(token);
85 | }
86 |
87 | public async Task TownExists(Guid id, CancellationToken token = default)
88 | {
89 | var town = await _context.Town.AnyAsync(r => r.Id == id, cancellationToken: token);
90 | return town;
91 | }
92 |
93 | public async Task TownExistsByName(string townName, CancellationToken token = default)
94 | {
95 | var town = await _context.Town.AnyAsync(r => r.TownName == townName, cancellationToken: token);
96 | return town;
97 | }
98 |
99 | public async Task Save(CancellationToken token = default)
100 | {
101 | var saved = await _context.SaveChangesAsync(token);
102 | return saved > 0;
103 | }
104 | }
--------------------------------------------------------------------------------
/AccraCityApi/Program.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using System.Text.Json.Serialization;
3 | using AccraCity.Application;
4 | using AccraCity.Application.Database;
5 | using AccraCity.Application.Models;
6 | using Microsoft.AspNetCore.Authentication.JwtBearer;
7 | using Microsoft.AspNetCore.Identity;
8 | using Microsoft.EntityFrameworkCore;
9 | using Microsoft.IdentityModel.Tokens;
10 | using Microsoft.OpenApi.Models;
11 | using Serilog;
12 |
13 |
14 | var builder = WebApplication.CreateBuilder(args);
15 |
16 | builder.Services.AddApplication();
17 | builder.Services.AddDbContext(options => options.UseNpgsql(builder.Configuration.GetConnectionString("Default")));
18 | builder.Services.AddControllers().AddNewtonsoftJson(options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);
19 | builder.Services.Configure(options => { options.SerializerOptions.ReferenceHandler = ReferenceHandler.IgnoreCycles; });
20 |
21 | //Serilog Config
22 | var logger = new LoggerConfiguration().ReadFrom.Configuration(builder.Configuration).Enrich.FromLogContext().CreateLogger(); ;
23 | builder.Logging.AddSerilog(logger);
24 |
25 | // Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
26 | builder.Services.AddEndpointsApiExplorer();
27 | builder.Services.AddSwaggerGen(opt =>
28 | {
29 | opt.SwaggerDoc("v1", new OpenApiInfo { Title = "AccraCity_API", Version = "v1" });
30 | opt.AddSecurityDefinition("Bearer", new OpenApiSecurityScheme
31 | {
32 | In = ParameterLocation.Header,
33 | Description = "Please enter token",
34 | Name = "Authorization",
35 | Type = SecuritySchemeType.Http,
36 | BearerFormat = "JWT",
37 | Scheme = "bearer"
38 | });
39 | opt.AddSecurityRequirement(new OpenApiSecurityRequirement
40 | {
41 | {
42 | new OpenApiSecurityScheme
43 | {
44 | Reference = new OpenApiReference
45 | {
46 | Type=ReferenceType.SecurityScheme,
47 | Id="Bearer"
48 | }
49 | },
50 | new string[]{}
51 | }
52 | });
53 | });;
54 |
55 |
56 | // Add Identity
57 | builder.Services
58 | .AddIdentity() //User in this case is adding more custom fields to the Identity
59 | .AddEntityFrameworkStores()
60 | .AddDefaultTokenProviders();
61 |
62 | // Config Identity
63 | builder.Services.Configure(options =>
64 | {
65 | options.Password.RequiredLength = 8;
66 | options.Password.RequireDigit = false;
67 | options.Password.RequireLowercase = false;
68 | options.Password.RequireNonAlphanumeric = false;
69 | options.Password.RequireUppercase = false;
70 | options.Password.RequiredUniqueChars = 0;
71 | options.SignIn.RequireConfirmedEmail = false;
72 | });
73 |
74 |
75 | // Add Authentication and JwtBearer
76 | builder.Services.AddAuthentication(options =>
77 | {
78 | options.DefaultScheme = JwtBearerDefaults.AuthenticationScheme;
79 | options.DefaultAuthenticateScheme = JwtBearerDefaults.AuthenticationScheme;
80 | options.DefaultChallengeScheme = JwtBearerDefaults.AuthenticationScheme;
81 | })
82 | .AddJwtBearer(options =>
83 | {
84 | options.SaveToken = true;
85 | options.RequireHttpsMetadata = false;
86 | options.TokenValidationParameters = new TokenValidationParameters
87 | {
88 | ValidateIssuer = true,
89 | ValidateAudience = true,
90 | ValidateLifetime = true,
91 | ValidateIssuerSigningKey = true,
92 | ValidIssuer = builder.Configuration["JWT:Issuer"],
93 | ValidAudience = builder.Configuration["JWT:Audience"],
94 | IssuerSigningKey = new SymmetricSecurityKey(Encoding.ASCII.GetBytes(builder.Configuration["JWT:SecretKey"] ?? throw new InvalidOperationException()))
95 | };
96 | });
97 |
98 |
99 | var app = builder.Build();
100 |
101 | // Configure the HTTP request pipeline.
102 | if (app.Environment.IsDevelopment())
103 | {
104 | app.UseSwagger();
105 | app.UseSwaggerUI();
106 | }
107 |
108 | app.UseHttpsRedirection();
109 | app.UseAuthentication();
110 | app.UseAuthorization();
111 | app.MapControllers();
112 | app.Run();
--------------------------------------------------------------------------------
/Docs/Api.md:
--------------------------------------------------------------------------------
1 | # Accra City Api
2 |
3 |
4 | The Accra-City-Towns API is a RESTful web service that offers comprehensive information about towns across various regions.
5 | It allows users to retrieve data such as population, geographical coordinates, notable landmarks, demographics, and more for a wide range of towns.
6 | Whether you need to research towns for travel planning, business expansion, or demographic analysis, this API provides access to valuable town-specific data to meet your informational needs.
7 | Explore and access town details effortlessly with this API to make informed decisions and gain insights into different townships.
8 |
9 | - [Accra City Api](#accra-city-api)
10 | - [Create Town](#create-town)
11 | - [Create Town Request](#create-town-request)
12 | - [Create Town Response](#create-town-response)
13 | - [Get Towns](#get-towns)
14 | - [Get Towns Request](#get-towns-request)
15 | - [Get Towns Response](#get-towns-response)
16 | - [Update Town](#update-town)
17 | - [Update Town Request](#update-town-request)
18 | - [Update Towns Response](#update-towns-response)
19 | - [Delete Town](#delete-town)
20 | - [Delete Town Request](#delete-town-request)
21 | - [Delete Town Response](#delete-town-response)
22 |
23 | ## Create Town
24 |
25 | ### Create Town Request
26 |
27 | ```js
28 | POST /api/town
29 | ```
30 |
31 | ```json
32 | {
33 | "townName": "API Town",
34 | "category": "",
35 | "population": "",
36 | "latitude": "",
37 | "longitude": "",
38 | "createdAt": "",
39 | "nearbyTowns": [
40 | "",
41 | ""
42 | ],
43 | "notableLandMarks": [
44 | "",
45 | ""
46 | ],
47 | "districtId": "",
48 | "regionId": ""
49 | }
50 | ```
51 |
52 | ### Create Town Response
53 |
54 | ```js
55 | 201 Created
56 | ```
57 |
58 | ```yml
59 | Location: {{host}}/api/town/{{id}}
60 | ```
61 |
62 | ```json
63 | {
64 | "statusCode": 201,
65 | "message": "Town retrieved successfully.",
66 | "data": {
67 | "id": "79282fbd-e975-4574-9449-2d5808439754",
68 | "townName": "Gold Town",
69 | "category": "",
70 | "population": 4444444,
71 | "latitude": 37.421024,
72 | "longitude": 122.142105,
73 | "createdAt": "2023-09-27T02:43:16.379Z",
74 | "lastModifiedAt": "2023-09-27T02:43:16.379Z",
75 | "nearbyTowns": [
76 | "nearbyTowns 1",
77 | "nearbyTowns 2",
78 | "nearbyTowns 3"
79 | ],
80 | "notableLandMarks": [
81 | "notableLandMarks 1",
82 | "notableLandMarks 2",
83 | "notableLandMarks 3"
84 | ],
85 | "districtId": "3cc068fd-e22d-4dd2-81fb-8775de3d2fe9",
86 | "regionId": "7e05c998-d190-4381-bc8a-08d1e41ba624"
87 | }
88 | }
89 | ```
90 |
91 | ## Get Towns
92 |
93 | ### Get Towns Request
94 |
95 | ```js
96 | GET /api/town/town/id
97 | ```
98 |
99 | ### Get Towns Response
100 |
101 | ```js
102 | 200 Ok
103 | ```
104 |
105 | ```json
106 | {
107 | "statusCode": 200,
108 | "message": "Towns retrieved successfully.",
109 | "data": {
110 | "towns": [
111 | {
112 | "id": "79282fbd-e975-4574-9449-2d5808439754",
113 | "townName": "Gold Town",
114 | "category": "",
115 | "population": 4444444,
116 | "latitude": 37.421024,
117 | "longitude": 122.142105,
118 | "createdAt": "2023-09-27T02:43:16.379Z",
119 | "lastModifiedAt": "2023-09-27T02:43:16.379Z",
120 | "nearbyTowns": [
121 | "nearbyTowns 1",
122 | "nearbyTowns 2",
123 | "nearbyTowns 3"
124 | ],
125 | "notableLandMarks": [
126 | "notableLandMarks 1",
127 | "notableLandMarks 2",
128 | "notableLandMarks 3"
129 | ],
130 | "districtId": "3cc068fd-e22d-4dd2-81fb-8775de3d2fe9",
131 | "regionId": "7e05c998-d190-4381-bc8a-08d1e41ba624"
132 | },
133 | {
134 | "id": "60cd59d5-b2fe-481b-9bc9-024310a4e7b6",
135 | "townName": "Sliver-Town",
136 | "category": "",
137 | "population": 50000,
138 | "latitude": 334.998,
139 | "longitude": 223.889,
140 | "createdAt": "2023-09-29T11:48:42.919355Z",
141 | "lastModifiedAt": "0001-01-01T00:00:00",
142 | "nearbyTowns": [
143 | "nearbyTowns 1",
144 | "nearbyTowns 2",
145 | "nearbyTowns 3"
146 | ],
147 | "notableLandMarks": [
148 | "notableLandMarks 1",
149 | "notableLandMarks 2"
150 | ],
151 | "districtId": "b5dcafed-fff1-4326-b3d2-5e53f31c8bee",
152 | "regionId": "8f531844-4f73-4271-9d40-c98cda9a856f"
153 | }
154 | ]
155 | }
156 | }
157 | ```
158 |
159 | ## Update Town
160 |
161 | ### Update Town Request
162 |
163 | ```js
164 | PUT /api/town/id
165 | ```
166 |
167 | ```json
168 | {
169 | "townName": "API Town",
170 | "category": "",
171 | "population": "",
172 | "latitude": "",
173 | "longitude": "",
174 | "lastModifiedAt": "",
175 | "nearbyTowns": [
176 | "",
177 | ""
178 | ],
179 | "notableLandMarks": [
180 | "",
181 | ""
182 | ],
183 | "districtId": "",
184 | "regionId": ""
185 | }
186 | ```
187 |
188 | ### Update Towns Response
189 |
190 | ```js
191 | 204 No Content
192 | ```
193 |
194 | or
195 |
196 | ```js
197 | 201 Created
198 | ```
199 |
200 | ```yml
201 | Location: {{host}}/town/{{id}}
202 | ```
203 |
204 | ## Delete Town
205 |
206 | ### Delete Town Request
207 |
208 | ```js
209 | DELETE /api/town/id
210 | ```
211 |
212 | ### Delete Town Response
213 |
214 | ```js
215 | 204 No Content
216 | ```
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Accra-City-Towns-Api
2 | The Accra-City-Towns API is a RESTful web service that offers comprehensive information about towns across various regions. It allows users to retrieve data such as population, geographical coordinates, notable landmarks, demographics, and more for a wide range of towns. Whether you need to research towns for travel planning, business expansion, or demographic analysis, this API provides access to valuable town-specific data to meet your informational needs. Explore and access town details effortlessly with this API to make informed decisions and gain insights into different townships.
3 |
4 | # Accra City Api
5 |
6 | - [Accra City Api](#accra-city-api)
7 | - [Create Town](#create-town)
8 | - [Create Town Request](#create-town-request)
9 | - [Create Town Response](#create-town-response)
10 | - [Get Towns](#get-towns)
11 | - [Get Towns Request](#get-towns-request)
12 | - [Get Towns Response](#get-towns-response)
13 | - [Update Town](#update-town)
14 | - [Update Town Request](#update-town-request)
15 | - [Update Towns Response](#update-towns-response)
16 | - [Delete Town](#delete-town)
17 | - [Delete Town Request](#delete-town-request)
18 | - [Delete Town Response](#delete-town-response)
19 |
20 | ## Create Town
21 |
22 | ### Create Town Request
23 |
24 | ```js
25 | POST api/town
26 | ```
27 |
28 | ```json
29 | {
30 | "townName": "API Town",
31 | "category": "",
32 | "population": "",
33 | "latitude": "",
34 | "longitude": "",
35 | "createdAt": "",
36 | "nearbyTowns": [
37 | "",
38 | ""
39 | ],
40 | "notableLandMarks": [
41 | "",
42 | ""
43 | ],
44 | "districtId": "",
45 | "regionId": ""
46 | }
47 | ```
48 |
49 | ### Create Town Response
50 |
51 | ```js
52 | 201 Created
53 | ```
54 |
55 | ```yml
56 | Location: {{host}}/town/{{id}}
57 | ```
58 |
59 | ```json
60 | {
61 | "statusCode": 201,
62 | "message": "Town retrieved successfully.",
63 | "data": {
64 | "id": "79282fbd-e975-4574-9449-2d5808439754",
65 | "townName": "Gold Town",
66 | "category": "",
67 | "population": 4444444,
68 | "latitude": 37.421024,
69 | "longitude": 122.142105,
70 | "createdAt": "2023-09-27T02:43:16.379Z",
71 | "lastModifiedAt": "2023-09-27T02:43:16.379Z",
72 | "nearbyTowns": [
73 | "nearbyTowns 1",
74 | "nearbyTowns 2",
75 | "nearbyTowns 3"
76 | ],
77 | "notableLandMarks": [
78 | "notableLandMarks 1",
79 | "notableLandMarks 2",
80 | "notableLandMarks 3"
81 | ],
82 | "districtId": "3cc068fd-e22d-4dd2-81fb-8775de3d2fe9",
83 | "regionId": "7e05c998-d190-4381-bc8a-08d1e41ba624"
84 | }
85 | ```
86 |
87 | ## Get Towns
88 |
89 | ### Get Towns Request
90 |
91 | ```js
92 | GET api/town/{{id}}
93 | ```
94 |
95 | ### Get Towns Response
96 |
97 | ```js
98 | 200 Ok
99 | ```
100 |
101 | ```json
102 | {
103 | "statusCode": 200,
104 | "message": "Towns retrieved successfully.",
105 | "data": {
106 | "towns": [
107 | {
108 | "id": "79282fbd-e975-4574-9449-2d5808439754",
109 | "townName": "Gold Town",
110 | "category": "",
111 | "population": 4444444,
112 | "latitude": 37.421024,
113 | "longitude": 122.142105,
114 | "createdAt": "2023-09-27T02:43:16.379Z",
115 | "lastModifiedAt": "2023-09-27T02:43:16.379Z",
116 | "nearbyTowns": [
117 | "nearbyTowns 1",
118 | "nearbyTowns 2",
119 | "nearbyTowns 3"
120 | ],
121 | "notableLandMarks": [
122 | "notableLandMarks 1",
123 | "notableLandMarks 2",
124 | "notableLandMarks 3"
125 | ],
126 | "districtId": "3cc068fd-e22d-4dd2-81fb-8775de3d2fe9",
127 | "regionId": "7e05c998-d190-4381-bc8a-08d1e41ba624"
128 | },
129 | {
130 | "id": "60cd59d5-b2fe-481b-9bc9-024310a4e7b6",
131 | "townName": "Sliver-Town",
132 | "category": "",
133 | "population": 50000,
134 | "latitude": 334.998,
135 | "longitude": 223.889,
136 | "createdAt": "2023-09-29T11:48:42.919355Z",
137 | "lastModifiedAt": "0001-01-01T00:00:00",
138 | "nearbyTowns": [
139 | "nearbyTowns 1",
140 | "nearbyTowns 2",
141 | "nearbyTowns 3"
142 | ],
143 | "notableLandMarks": [
144 | "notableLandMarks 1",
145 | "notableLandMarks 2"
146 | ],
147 | "districtId": "b5dcafed-fff1-4326-b3d2-5e53f31c8bee",
148 | "regionId": "8f531844-4f73-4271-9d40-c98cda9a856f"
149 | }
150 | ]
151 | }
152 | }
153 | ```
154 |
155 | ## Update Town
156 |
157 | ### Update Town Request
158 |
159 | ```js
160 | PUT api/town/{{id}}
161 | ```
162 |
163 | ```json
164 | {
165 | "townName": "API Town",
166 | "category": "",
167 | "population": "",
168 | "latitude": "",
169 | "longitude": "",
170 | "lastModifiedAt": "",
171 | "nearbyTowns": [
172 | "",
173 | ""
174 | ],
175 | "notableLandMarks": [
176 | "",
177 | ""
178 | ],
179 | "districtId": "",
180 | "regionId": ""
181 | }
182 | ```
183 |
184 | ### Update Towns Response
185 |
186 | ```js
187 | 204 No Content
188 | ```
189 |
190 | or
191 |
192 | ```js
193 | 201 Created
194 | ```
195 |
196 | ```yml
197 | Location: {{host}}/api/town/{{id}}
198 | ```
199 |
200 | ## Delete Town
201 |
202 | ### Delete Town Request
203 |
204 | ```js
205 | DELETE api/town/{{id}}
206 | ```
207 |
208 | ### Delete Town Response
209 |
210 | ```js
211 | 204 No Content
212 | ```
213 |
--------------------------------------------------------------------------------
/CODE_OF_CONDUCT.md:
--------------------------------------------------------------------------------
1 | # Contributor Covenant Code of Conduct
2 |
3 | ## Our Pledge
4 |
5 | We as members, contributors, and leaders pledge to make participation in our
6 | community a harassment-free experience for everyone, regardless of age, body
7 | size, visible or invisible disability, ethnicity, sex characteristics, gender
8 | identity and expression, level of experience, education, socio-economic status,
9 | nationality, personal appearance, race, religion, or sexual identity
10 | and orientation.
11 |
12 | We pledge to act and interact in ways that contribute to an open, welcoming,
13 | diverse, inclusive, and healthy community.
14 |
15 | ## Our Standards
16 |
17 | Examples of behavior that contributes to a positive environment for our
18 | community include:
19 |
20 | * Demonstrating empathy and kindness toward other people
21 | * Being respectful of differing opinions, viewpoints, and experiences
22 | * Giving and gracefully accepting constructive feedback
23 | * Accepting responsibility and apologizing to those affected by our mistakes,
24 | and learning from the experience
25 | * Focusing on what is best not just for us as individuals, but for the
26 | overall community
27 |
28 | Examples of unacceptable behavior include:
29 |
30 | * The use of sexualized language or imagery, and sexual attention or
31 | advances of any kind
32 | * Trolling, insulting or derogatory comments, and personal or political attacks
33 | * Public or private harassment
34 | * Publishing others' private information, such as a physical or email
35 | address, without their explicit permission
36 | * Other conduct which could reasonably be considered inappropriate in a
37 | professional setting
38 |
39 | ## Enforcement Responsibilities
40 |
41 | Community leaders are responsible for clarifying and enforcing our standards of
42 | acceptable behavior and will take appropriate and fair corrective action in
43 | response to any behavior that they deem inappropriate, threatening, offensive,
44 | or harmful.
45 |
46 | Community leaders have the right and responsibility to remove, edit, or reject
47 | comments, commits, code, wiki edits, issues, and other contributions that are
48 | not aligned to this Code of Conduct, and will communicate reasons for moderation
49 | decisions when appropriate.
50 |
51 | ## Scope
52 |
53 | This Code of Conduct applies within all community spaces, and also applies when
54 | an individual is officially representing the community in public spaces.
55 | Examples of representing our community include using an official e-mail address,
56 | posting via an official social media account, or acting as an appointed
57 | representative at an online or offline event.
58 |
59 | ## Enforcement
60 |
61 | Instances of abusive, harassing, or otherwise unacceptable behavior may be
62 | reported to the community leaders responsible for enforcement at
63 | .
64 | All complaints will be reviewed and investigated promptly and fairly.
65 |
66 | All community leaders are obligated to respect the privacy and security of the
67 | reporter of any incident.
68 |
69 | ## Enforcement Guidelines
70 |
71 | Community leaders will follow these Community Impact Guidelines in determining
72 | the consequences for any action they deem in violation of this Code of Conduct:
73 |
74 | ### 1. Correction
75 |
76 | **Community Impact**: Use of inappropriate language or other behavior deemed
77 | unprofessional or unwelcome in the community.
78 |
79 | **Consequence**: A private, written warning from community leaders, providing
80 | clarity around the nature of the violation and an explanation of why the
81 | behavior was inappropriate. A public apology may be requested.
82 |
83 | ### 2. Warning
84 |
85 | **Community Impact**: A violation through a single incident or series
86 | of actions.
87 |
88 | **Consequence**: A warning with consequences for continued behavior. No
89 | interaction with the people involved, including unsolicited interaction with
90 | those enforcing the Code of Conduct, for a specified period of time. This
91 | includes avoiding interactions in community spaces as well as external channels
92 | like social media. Violating these terms may lead to a temporary or
93 | permanent ban.
94 |
95 | ### 3. Temporary Ban
96 |
97 | **Community Impact**: A serious violation of community standards, including
98 | sustained inappropriate behavior.
99 |
100 | **Consequence**: A temporary ban from any sort of interaction or public
101 | communication with the community for a specified period of time. No public or
102 | private interaction with the people involved, including unsolicited interaction
103 | with those enforcing the Code of Conduct, is allowed during this period.
104 | Violating these terms may lead to a permanent ban.
105 |
106 | ### 4. Permanent Ban
107 |
108 | **Community Impact**: Demonstrating a pattern of violation of community
109 | standards, including sustained inappropriate behavior, harassment of an
110 | individual, or aggression toward or disparagement of classes of individuals.
111 |
112 | **Consequence**: A permanent ban from any sort of public interaction within
113 | the community.
114 |
115 | ## Attribution
116 |
117 | This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118 | version 2.0, available at
119 | https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
120 |
121 | Community Impact Guidelines were inspired by [Mozilla's code of conduct
122 | enforcement ladder](https://github.com/mozilla/diversity).
123 |
124 | [homepage]: https://www.contributor-covenant.org
125 |
126 | For answers to common questions about this code of conduct, see the FAQ at
127 | https://www.contributor-covenant.org/faq. Translations are available at
128 | https://www.contributor-covenant.org/translations.
129 |
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/obj/AccraCityApi.Contracts.csproj.nuget.dgspec.json:
--------------------------------------------------------------------------------
1 | {
2 | "format": 1,
3 | "restore": {
4 | "/Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/AccraCityApi.Contracts.csproj": {}
5 | },
6 | "projects": {
7 | "/Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/AccraCity.Application.csproj": {
8 | "version": "1.0.0",
9 | "restore": {
10 | "projectUniqueName": "/Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/AccraCity.Application.csproj",
11 | "projectName": "AccraCity.Application",
12 | "projectPath": "/Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/AccraCity.Application.csproj",
13 | "packagesPath": "/Users/perigrinobruce/.nuget/packages/",
14 | "outputPath": "/Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/obj/",
15 | "projectStyle": "PackageReference",
16 | "configFilePaths": [
17 | "/Users/perigrinobruce/.nuget/NuGet/NuGet.Config"
18 | ],
19 | "originalTargetFrameworks": [
20 | "net8.0"
21 | ],
22 | "sources": {
23 | "https://api.nuget.org/v3/index.json": {}
24 | },
25 | "frameworks": {
26 | "net8.0": {
27 | "targetAlias": "net8.0",
28 | "projectReferences": {}
29 | }
30 | },
31 | "warningProperties": {
32 | "warnAsError": [
33 | "NU1605"
34 | ]
35 | }
36 | },
37 | "frameworks": {
38 | "net8.0": {
39 | "targetAlias": "net8.0",
40 | "dependencies": {
41 | "Microsoft.AspNetCore.Authentication.JwtBearer": {
42 | "target": "Package",
43 | "version": "[8.0.7, )"
44 | },
45 | "Microsoft.AspNetCore.Identity.EntityFrameworkCore": {
46 | "target": "Package",
47 | "version": "[8.0.7, )"
48 | },
49 | "Microsoft.AspNetCore.Mvc.NewtonsoftJson": {
50 | "target": "Package",
51 | "version": "[8.0.7, )"
52 | },
53 | "Microsoft.EntityFrameworkCore": {
54 | "target": "Package",
55 | "version": "[8.0.7, )"
56 | },
57 | "Microsoft.EntityFrameworkCore.Design": {
58 | "include": "Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive",
59 | "suppressParent": "All",
60 | "target": "Package",
61 | "version": "[8.0.7, )"
62 | },
63 | "Microsoft.EntityFrameworkCore.Tools": {
64 | "include": "Runtime, Build, Native, ContentFiles, Analyzers, BuildTransitive",
65 | "suppressParent": "All",
66 | "target": "Package",
67 | "version": "[8.0.7, )"
68 | },
69 | "Npgsql.EntityFrameworkCore.PostgreSQL": {
70 | "target": "Package",
71 | "version": "[8.0.4, )"
72 | },
73 | "Serilog.AspNetCore": {
74 | "target": "Package",
75 | "version": "[5.0.0, )"
76 | }
77 | },
78 | "imports": [
79 | "net461",
80 | "net462",
81 | "net47",
82 | "net471",
83 | "net472",
84 | "net48",
85 | "net481"
86 | ],
87 | "assetTargetFallback": true,
88 | "warn": true,
89 | "frameworkReferences": {
90 | "Microsoft.NETCore.App": {
91 | "privateAssets": "all"
92 | }
93 | },
94 | "runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/8.0.302/PortableRuntimeIdentifierGraph.json"
95 | }
96 | }
97 | },
98 | "/Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/AccraCityApi.Contracts.csproj": {
99 | "version": "1.0.0",
100 | "restore": {
101 | "projectUniqueName": "/Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/AccraCityApi.Contracts.csproj",
102 | "projectName": "AccraCityApi.Contracts",
103 | "projectPath": "/Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/AccraCityApi.Contracts.csproj",
104 | "packagesPath": "/Users/perigrinobruce/.nuget/packages/",
105 | "outputPath": "/Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/obj/",
106 | "projectStyle": "PackageReference",
107 | "configFilePaths": [
108 | "/Users/perigrinobruce/.nuget/NuGet/NuGet.Config"
109 | ],
110 | "originalTargetFrameworks": [
111 | "net8.0"
112 | ],
113 | "sources": {
114 | "https://api.nuget.org/v3/index.json": {}
115 | },
116 | "frameworks": {
117 | "net8.0": {
118 | "targetAlias": "net8.0",
119 | "projectReferences": {
120 | "/Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/AccraCity.Application.csproj": {
121 | "projectPath": "/Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCity.Application/AccraCity.Application.csproj"
122 | }
123 | }
124 | }
125 | },
126 | "warningProperties": {
127 | "warnAsError": [
128 | "NU1605"
129 | ]
130 | }
131 | },
132 | "frameworks": {
133 | "net8.0": {
134 | "targetAlias": "net8.0",
135 | "imports": [
136 | "net461",
137 | "net462",
138 | "net47",
139 | "net471",
140 | "net472",
141 | "net48",
142 | "net481"
143 | ],
144 | "assetTargetFallback": true,
145 | "warn": true,
146 | "frameworkReferences": {
147 | "Microsoft.NETCore.App": {
148 | "privateAssets": "all"
149 | }
150 | },
151 | "runtimeIdentifierGraphPath": "/usr/local/share/dotnet/sdk/8.0.302/PortableRuntimeIdentifierGraph.json"
152 | }
153 | }
154 | }
155 | }
156 | }
--------------------------------------------------------------------------------
/AccraCityApi.Contracts/obj/project.nuget.cache:
--------------------------------------------------------------------------------
1 | {
2 | "version": 2,
3 | "dgSpecHash": "/FgfQ87bo6OkK62JzpSH8Kw6kr6hpbuJuMFHp6P3RSw1DM5lNX17RGfmrS09DSmujiRtHfWwapCgaZAuf9Braw==",
4 | "success": true,
5 | "projectFilePath": "/Users/perigrinobruce/RiderProjects/Accra-City-Towns-Api/AccraCityApi.Contracts/AccraCityApi.Contracts.csproj",
6 | "expectedPackageFiles": [
7 | "/Users/perigrinobruce/.nuget/packages/microsoft.aspnetcore.authentication.jwtbearer/8.0.7/microsoft.aspnetcore.authentication.jwtbearer.8.0.7.nupkg.sha512",
8 | "/Users/perigrinobruce/.nuget/packages/microsoft.aspnetcore.cryptography.internal/8.0.7/microsoft.aspnetcore.cryptography.internal.8.0.7.nupkg.sha512",
9 | "/Users/perigrinobruce/.nuget/packages/microsoft.aspnetcore.cryptography.keyderivation/8.0.7/microsoft.aspnetcore.cryptography.keyderivation.8.0.7.nupkg.sha512",
10 | "/Users/perigrinobruce/.nuget/packages/microsoft.aspnetcore.identity.entityframeworkcore/8.0.7/microsoft.aspnetcore.identity.entityframeworkcore.8.0.7.nupkg.sha512",
11 | "/Users/perigrinobruce/.nuget/packages/microsoft.aspnetcore.jsonpatch/8.0.7/microsoft.aspnetcore.jsonpatch.8.0.7.nupkg.sha512",
12 | "/Users/perigrinobruce/.nuget/packages/microsoft.aspnetcore.mvc.newtonsoftjson/8.0.7/microsoft.aspnetcore.mvc.newtonsoftjson.8.0.7.nupkg.sha512",
13 | "/Users/perigrinobruce/.nuget/packages/microsoft.csharp/4.7.0/microsoft.csharp.4.7.0.nupkg.sha512",
14 | "/Users/perigrinobruce/.nuget/packages/microsoft.entityframeworkcore/8.0.7/microsoft.entityframeworkcore.8.0.7.nupkg.sha512",
15 | "/Users/perigrinobruce/.nuget/packages/microsoft.entityframeworkcore.abstractions/8.0.7/microsoft.entityframeworkcore.abstractions.8.0.7.nupkg.sha512",
16 | "/Users/perigrinobruce/.nuget/packages/microsoft.entityframeworkcore.analyzers/8.0.7/microsoft.entityframeworkcore.analyzers.8.0.7.nupkg.sha512",
17 | "/Users/perigrinobruce/.nuget/packages/microsoft.entityframeworkcore.relational/8.0.7/microsoft.entityframeworkcore.relational.8.0.7.nupkg.sha512",
18 | "/Users/perigrinobruce/.nuget/packages/microsoft.extensions.caching.abstractions/8.0.0/microsoft.extensions.caching.abstractions.8.0.0.nupkg.sha512",
19 | "/Users/perigrinobruce/.nuget/packages/microsoft.extensions.caching.memory/8.0.0/microsoft.extensions.caching.memory.8.0.0.nupkg.sha512",
20 | "/Users/perigrinobruce/.nuget/packages/microsoft.extensions.configuration/2.0.0/microsoft.extensions.configuration.2.0.0.nupkg.sha512",
21 | "/Users/perigrinobruce/.nuget/packages/microsoft.extensions.configuration.abstractions/8.0.0/microsoft.extensions.configuration.abstractions.8.0.0.nupkg.sha512",
22 | "/Users/perigrinobruce/.nuget/packages/microsoft.extensions.configuration.binder/2.0.0/microsoft.extensions.configuration.binder.2.0.0.nupkg.sha512",
23 | "/Users/perigrinobruce/.nuget/packages/microsoft.extensions.dependencyinjection/8.0.0/microsoft.extensions.dependencyinjection.8.0.0.nupkg.sha512",
24 | "/Users/perigrinobruce/.nuget/packages/microsoft.extensions.dependencyinjection.abstractions/8.0.0/microsoft.extensions.dependencyinjection.abstractions.8.0.0.nupkg.sha512",
25 | "/Users/perigrinobruce/.nuget/packages/microsoft.extensions.dependencymodel/3.0.0/microsoft.extensions.dependencymodel.3.0.0.nupkg.sha512",
26 | "/Users/perigrinobruce/.nuget/packages/microsoft.extensions.fileproviders.abstractions/3.1.8/microsoft.extensions.fileproviders.abstractions.3.1.8.nupkg.sha512",
27 | "/Users/perigrinobruce/.nuget/packages/microsoft.extensions.hosting.abstractions/3.1.8/microsoft.extensions.hosting.abstractions.3.1.8.nupkg.sha512",
28 | "/Users/perigrinobruce/.nuget/packages/microsoft.extensions.identity.core/8.0.7/microsoft.extensions.identity.core.8.0.7.nupkg.sha512",
29 | "/Users/perigrinobruce/.nuget/packages/microsoft.extensions.identity.stores/8.0.7/microsoft.extensions.identity.stores.8.0.7.nupkg.sha512",
30 | "/Users/perigrinobruce/.nuget/packages/microsoft.extensions.logging/8.0.0/microsoft.extensions.logging.8.0.0.nupkg.sha512",
31 | "/Users/perigrinobruce/.nuget/packages/microsoft.extensions.logging.abstractions/8.0.0/microsoft.extensions.logging.abstractions.8.0.0.nupkg.sha512",
32 | "/Users/perigrinobruce/.nuget/packages/microsoft.extensions.options/8.0.2/microsoft.extensions.options.8.0.2.nupkg.sha512",
33 | "/Users/perigrinobruce/.nuget/packages/microsoft.extensions.options.configurationextensions/2.0.0/microsoft.extensions.options.configurationextensions.2.0.0.nupkg.sha512",
34 | "/Users/perigrinobruce/.nuget/packages/microsoft.extensions.primitives/8.0.0/microsoft.extensions.primitives.8.0.0.nupkg.sha512",
35 | "/Users/perigrinobruce/.nuget/packages/microsoft.identitymodel.abstractions/7.1.2/microsoft.identitymodel.abstractions.7.1.2.nupkg.sha512",
36 | "/Users/perigrinobruce/.nuget/packages/microsoft.identitymodel.jsonwebtokens/7.1.2/microsoft.identitymodel.jsonwebtokens.7.1.2.nupkg.sha512",
37 | "/Users/perigrinobruce/.nuget/packages/microsoft.identitymodel.logging/7.1.2/microsoft.identitymodel.logging.7.1.2.nupkg.sha512",
38 | "/Users/perigrinobruce/.nuget/packages/microsoft.identitymodel.protocols/7.1.2/microsoft.identitymodel.protocols.7.1.2.nupkg.sha512",
39 | "/Users/perigrinobruce/.nuget/packages/microsoft.identitymodel.protocols.openidconnect/7.1.2/microsoft.identitymodel.protocols.openidconnect.7.1.2.nupkg.sha512",
40 | "/Users/perigrinobruce/.nuget/packages/microsoft.identitymodel.tokens/7.1.2/microsoft.identitymodel.tokens.7.1.2.nupkg.sha512",
41 | "/Users/perigrinobruce/.nuget/packages/newtonsoft.json/13.0.3/newtonsoft.json.13.0.3.nupkg.sha512",
42 | "/Users/perigrinobruce/.nuget/packages/newtonsoft.json.bson/1.0.2/newtonsoft.json.bson.1.0.2.nupkg.sha512",
43 | "/Users/perigrinobruce/.nuget/packages/npgsql/8.0.3/npgsql.8.0.3.nupkg.sha512",
44 | "/Users/perigrinobruce/.nuget/packages/npgsql.entityframeworkcore.postgresql/8.0.4/npgsql.entityframeworkcore.postgresql.8.0.4.nupkg.sha512",
45 | "/Users/perigrinobruce/.nuget/packages/serilog/2.10.0/serilog.2.10.0.nupkg.sha512",
46 | "/Users/perigrinobruce/.nuget/packages/serilog.aspnetcore/5.0.0/serilog.aspnetcore.5.0.0.nupkg.sha512",
47 | "/Users/perigrinobruce/.nuget/packages/serilog.extensions.hosting/4.2.0/serilog.extensions.hosting.4.2.0.nupkg.sha512",
48 | "/Users/perigrinobruce/.nuget/packages/serilog.extensions.logging/3.1.0/serilog.extensions.logging.3.1.0.nupkg.sha512",
49 | "/Users/perigrinobruce/.nuget/packages/serilog.formatting.compact/1.1.0/serilog.formatting.compact.1.1.0.nupkg.sha512",
50 | "/Users/perigrinobruce/.nuget/packages/serilog.settings.configuration/3.3.0/serilog.settings.configuration.3.3.0.nupkg.sha512",
51 | "/Users/perigrinobruce/.nuget/packages/serilog.sinks.console/4.0.1/serilog.sinks.console.4.0.1.nupkg.sha512",
52 | "/Users/perigrinobruce/.nuget/packages/serilog.sinks.debug/2.0.0/serilog.sinks.debug.2.0.0.nupkg.sha512",
53 | "/Users/perigrinobruce/.nuget/packages/serilog.sinks.file/5.0.0/serilog.sinks.file.5.0.0.nupkg.sha512",
54 | "/Users/perigrinobruce/.nuget/packages/system.identitymodel.tokens.jwt/7.1.2/system.identitymodel.tokens.jwt.7.1.2.nupkg.sha512",
55 | "/Users/perigrinobruce/.nuget/packages/system.text.json/4.6.0/system.text.json.4.6.0.nupkg.sha512"
56 | ],
57 | "logs": []
58 | }
--------------------------------------------------------------------------------
/AccraCityApi/Controllers/TownController.cs:
--------------------------------------------------------------------------------
1 | using AccraCity.Application.Interface;
2 | using AccraCityApi.ContractMappings;
3 | using AccraCityApi.Contracts.AccraCity;
4 | using AccraCityApi.Contracts.Requests.TownRequests;
5 | using AccraCityApi.Contracts.Response;
6 | using AccraCityApi.Contracts.Response.TownResponses;
7 | using Microsoft.AspNetCore.Mvc;
8 |
9 | namespace AccraCityApi.Controllers;
10 |
11 |
12 | [ApiController]
13 | public class TownController : Controller
14 | {
15 | private readonly ITownRepository _townRepository;
16 | private readonly ILogger _logger;
17 |
18 |
19 | public TownController(ITownRepository townRepository, ILogger logger)
20 | {
21 | _townRepository = townRepository;
22 | _logger = logger;
23 | }
24 |
25 | //GET all Towns
26 | [HttpGet(ApiEndpoints.Town.GetAll)]
27 | public async Task GetTowns(CancellationToken token)
28 | {
29 | try
30 | {
31 | _logger.LogInformation("Get All towns method executing");
32 | var towns = await _townRepository.GetTownAsync(token);
33 | var townsResponse = new FinalResponse
34 | {
35 | StatusCode = 200,
36 | Message = "Towns retrieved successfully.",
37 | Data = towns.MapsToResponse()
38 | };
39 | _logger.LogInformation("Get All towns method successful");
40 | return Ok(townsResponse);
41 | }
42 | catch (Exception ex)
43 | {
44 | _logger.LogInformation("Error in Get Towns Method");
45 | _logger.LogError(ex, "Error in Get Towns Method");
46 | return Ok();
47 | }
48 | }
49 |
50 | //GET TownById
51 | [HttpGet(ApiEndpoints.Town.GetTown)]
52 | public async Task GetTown([FromRoute] Guid id, CancellationToken token)
53 | {
54 | try
55 | {
56 | _logger.LogInformation("GetTown method executing");
57 | var town = await _townRepository.GetTownById(id, token);
58 | if (town == null)
59 | {
60 | return NotFound(new FinalResponse