From 4c4036a266458638bc2e9144e7b3089878ad0531 Mon Sep 17 00:00:00 2001 From: Jose Henrique Date: Fri, 31 Jan 2025 23:41:30 -0300 Subject: [PATCH] initial commit --- .dockerignore | 30 +++++ .gitignore | 8 ++ Controllers/PetController.cs | 26 ++++ Data/ApplicationDbContext.cs | 16 +++ Dockerfile | 30 +++++ .../20250201022754_InitialCreate.Designer.cs | 116 ++++++++++++++++++ Migrations/20250201022754_InitialCreate.cs | 83 +++++++++++++ .../ApplicationDbContextModelSnapshot.cs | 113 +++++++++++++++++ Models/Pet.cs | 16 +++ Models/PetClass.cs | 13 ++ Models/PetClassInfo.cs | 12 ++ Models/PetStats.cs | 66 ++++++++++ Models/Resources.cs | 15 +++ Program.cs | 42 +++++++ Properties/launchSettings.json | 52 ++++++++ README.md | 42 +++++++ Repositories/PetRepository.cs | 32 +++++ Services/PetService.cs | 31 +++++ appsettings.json | 12 ++ pet-companion-api.csproj | 24 ++++ pet-companion-api.http | 6 + pet-companion-api.sln | 25 ++++ 22 files changed, 810 insertions(+) create mode 100644 .dockerignore create mode 100644 .gitignore create mode 100644 Controllers/PetController.cs create mode 100644 Data/ApplicationDbContext.cs create mode 100644 Dockerfile create mode 100644 Migrations/20250201022754_InitialCreate.Designer.cs create mode 100644 Migrations/20250201022754_InitialCreate.cs create mode 100644 Migrations/ApplicationDbContextModelSnapshot.cs create mode 100644 Models/Pet.cs create mode 100644 Models/PetClass.cs create mode 100644 Models/PetClassInfo.cs create mode 100644 Models/PetStats.cs create mode 100644 Models/Resources.cs create mode 100644 Program.cs create mode 100644 Properties/launchSettings.json create mode 100644 README.md create mode 100644 Repositories/PetRepository.cs create mode 100644 Services/PetService.cs create mode 100644 appsettings.json create mode 100644 pet-companion-api.csproj create mode 100644 pet-companion-api.http create mode 100644 pet-companion-api.sln diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..fe1152b --- /dev/null +++ b/.dockerignore @@ -0,0 +1,30 @@ +**/.classpath +**/.dockerignore +**/.env +**/.git +**/.gitignore +**/.project +**/.settings +**/.toolstarget +**/.vs +**/.vscode +**/*.*proj.user +**/*.dbmdl +**/*.jfm +**/azds.yaml +**/bin +**/charts +**/docker-compose* +**/Dockerfile* +**/node_modules +**/npm-debug.log +**/obj +**/secrets.dev.yaml +**/values.dev.yaml +LICENSE +README.md +!**/.gitignore +!.git/HEAD +!.git/config +!.git/packed-refs +!.git/refs/heads/** \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a01ec03 --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +.vs +bin +obj + +appsettings.Development.json +*.db +*.db-shm +*.csproj.user \ No newline at end of file diff --git a/Controllers/PetController.cs b/Controllers/PetController.cs new file mode 100644 index 0000000..7659e8a --- /dev/null +++ b/Controllers/PetController.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Mvc; +using pet_companion_api.Services; + +namespace pet_companion_api.Controllers +{ + [ApiController] + [Route("api/v1/[controller]")] + public class PetController : ControllerBase + { + private readonly PetService petService; + private readonly ILogger logger; + private Guid userId = Guid.Parse("f5f4b3b3-3b7b-4b7b-8b7b-7b7b7b7b7b7b"); + + public PetController(ILogger logger, PetService petService) + { + this.logger = logger; + this.petService = petService; + } + + [HttpGet("")] + public IActionResult GetAllPets() + { + return Ok(petService.GetAllPets(userId)); + } + } +} diff --git a/Data/ApplicationDbContext.cs b/Data/ApplicationDbContext.cs new file mode 100644 index 0000000..ece3bd8 --- /dev/null +++ b/Data/ApplicationDbContext.cs @@ -0,0 +1,16 @@ +using Microsoft.EntityFrameworkCore; +using pet_companion_api.Models; + +namespace pet_companion_api.Data +{ + public class ApplicationDbContext : DbContext + { + public ApplicationDbContext(DbContextOptions options) : base(options) + { + } + + public DbSet Pets { get; set; } + public DbSet PetStats { get; set; } + public DbSet Resources { get; set; } + } +} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..03dbd9c --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +# See https://aka.ms/customizecontainer to learn how to customize your debug container and how Visual Studio uses this Dockerfile to build your images for faster debugging. + +# This stage is used when running from VS in fast mode (Default for Debug configuration) +FROM mcr.microsoft.com/dotnet/aspnet:8.0 AS base +USER app +WORKDIR /app +EXPOSE 8080 +EXPOSE 8081 + + +# This stage is used to build the service project +FROM mcr.microsoft.com/dotnet/sdk:8.0 AS build +ARG BUILD_CONFIGURATION=Release +WORKDIR /src +COPY ["pet-companion-api.csproj", "."] +RUN dotnet restore "./pet-companion-api.csproj" +COPY . . +WORKDIR "/src/." +RUN dotnet build "./pet-companion-api.csproj" -c $BUILD_CONFIGURATION -o /app/build + +# This stage is used to publish the service project to be copied to the final stage +FROM build AS publish +ARG BUILD_CONFIGURATION=Release +RUN dotnet publish "./pet-companion-api.csproj" -c $BUILD_CONFIGURATION -o /app/publish /p:UseAppHost=false + +# This stage is used in production or when running from VS in regular mode (Default when not using the Debug configuration) +FROM base AS final +WORKDIR /app +COPY --from=publish /app/publish . +ENTRYPOINT ["dotnet", "pet-companion-api.dll"] \ No newline at end of file diff --git a/Migrations/20250201022754_InitialCreate.Designer.cs b/Migrations/20250201022754_InitialCreate.Designer.cs new file mode 100644 index 0000000..98a8957 --- /dev/null +++ b/Migrations/20250201022754_InitialCreate.Designer.cs @@ -0,0 +1,116 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using pet_companion_api.Data; + +#nullable disable + +namespace pet_companion_api.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + [Migration("20250201022754_InitialCreate")] + partial class InitialCreate + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "9.0.1"); + + modelBuilder.Entity("pet_companion_api.Models.Pet", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Class") + .HasColumnType("INTEGER"); + + b.Property("Level") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Pets"); + }); + + modelBuilder.Entity("pet_companion_api.Models.PetStats", b => + { + b.Property("PetId") + .HasColumnType("TEXT"); + + b.Property("Charisma") + .HasColumnType("INTEGER"); + + b.Property("Intelligence") + .HasColumnType("INTEGER"); + + b.Property("Strength") + .HasColumnType("INTEGER"); + + b.HasKey("PetId"); + + b.ToTable("PetStats"); + }); + + modelBuilder.Entity("pet_companion_api.Models.Resources", b => + { + b.Property("PetId") + .HasColumnType("TEXT"); + + b.Property("Food") + .HasColumnType("INTEGER"); + + b.Property("Gold") + .HasColumnType("INTEGER"); + + b.Property("Junk") + .HasColumnType("INTEGER"); + + b.Property("Wisdom") + .HasColumnType("INTEGER"); + + b.HasKey("PetId"); + + b.ToTable("Resources"); + }); + + modelBuilder.Entity("pet_companion_api.Models.PetStats", b => + { + b.HasOne("pet_companion_api.Models.Pet", null) + .WithOne("Stats") + .HasForeignKey("pet_companion_api.Models.PetStats", "PetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("pet_companion_api.Models.Resources", b => + { + b.HasOne("pet_companion_api.Models.Pet", null) + .WithOne("Resources") + .HasForeignKey("pet_companion_api.Models.Resources", "PetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("pet_companion_api.Models.Pet", b => + { + b.Navigation("Resources") + .IsRequired(); + + b.Navigation("Stats") + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Migrations/20250201022754_InitialCreate.cs b/Migrations/20250201022754_InitialCreate.cs new file mode 100644 index 0000000..35b8e48 --- /dev/null +++ b/Migrations/20250201022754_InitialCreate.cs @@ -0,0 +1,83 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace pet_companion_api.Migrations +{ + /// + public partial class InitialCreate : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Pets", + columns: table => new + { + Id = table.Column(type: "TEXT", nullable: false), + Name = table.Column(type: "TEXT", nullable: false), + Class = table.Column(type: "INTEGER", nullable: false), + Level = table.Column(type: "INTEGER", nullable: false), + UserId = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Pets", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "PetStats", + columns: table => new + { + PetId = table.Column(type: "TEXT", nullable: false), + Intelligence = table.Column(type: "INTEGER", nullable: false), + Strength = table.Column(type: "INTEGER", nullable: false), + Charisma = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_PetStats", x => x.PetId); + table.ForeignKey( + name: "FK_PetStats_Pets_PetId", + column: x => x.PetId, + principalTable: "Pets", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Resources", + columns: table => new + { + PetId = table.Column(type: "TEXT", nullable: false), + Wisdom = table.Column(type: "INTEGER", nullable: false), + Gold = table.Column(type: "INTEGER", nullable: false), + Food = table.Column(type: "INTEGER", nullable: false), + Junk = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Resources", x => x.PetId); + table.ForeignKey( + name: "FK_Resources_Pets_PetId", + column: x => x.PetId, + principalTable: "Pets", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "PetStats"); + + migrationBuilder.DropTable( + name: "Resources"); + + migrationBuilder.DropTable( + name: "Pets"); + } + } +} diff --git a/Migrations/ApplicationDbContextModelSnapshot.cs b/Migrations/ApplicationDbContextModelSnapshot.cs new file mode 100644 index 0000000..2201878 --- /dev/null +++ b/Migrations/ApplicationDbContextModelSnapshot.cs @@ -0,0 +1,113 @@ +// +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using pet_companion_api.Data; + +#nullable disable + +namespace pet_companion_api.Migrations +{ + [DbContext(typeof(ApplicationDbContext))] + partial class ApplicationDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "9.0.1"); + + modelBuilder.Entity("pet_companion_api.Models.Pet", b => + { + b.Property("Id") + .HasColumnType("TEXT"); + + b.Property("Class") + .HasColumnType("INTEGER"); + + b.Property("Level") + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("UserId") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Pets"); + }); + + modelBuilder.Entity("pet_companion_api.Models.PetStats", b => + { + b.Property("PetId") + .HasColumnType("TEXT"); + + b.Property("Charisma") + .HasColumnType("INTEGER"); + + b.Property("Intelligence") + .HasColumnType("INTEGER"); + + b.Property("Strength") + .HasColumnType("INTEGER"); + + b.HasKey("PetId"); + + b.ToTable("PetStats"); + }); + + modelBuilder.Entity("pet_companion_api.Models.Resources", b => + { + b.Property("PetId") + .HasColumnType("TEXT"); + + b.Property("Food") + .HasColumnType("INTEGER"); + + b.Property("Gold") + .HasColumnType("INTEGER"); + + b.Property("Junk") + .HasColumnType("INTEGER"); + + b.Property("Wisdom") + .HasColumnType("INTEGER"); + + b.HasKey("PetId"); + + b.ToTable("Resources"); + }); + + modelBuilder.Entity("pet_companion_api.Models.PetStats", b => + { + b.HasOne("pet_companion_api.Models.Pet", null) + .WithOne("Stats") + .HasForeignKey("pet_companion_api.Models.PetStats", "PetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("pet_companion_api.Models.Resources", b => + { + b.HasOne("pet_companion_api.Models.Pet", null) + .WithOne("Resources") + .HasForeignKey("pet_companion_api.Models.Resources", "PetId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("pet_companion_api.Models.Pet", b => + { + b.Navigation("Resources") + .IsRequired(); + + b.Navigation("Stats") + .IsRequired(); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Models/Pet.cs b/Models/Pet.cs new file mode 100644 index 0000000..4a25790 --- /dev/null +++ b/Models/Pet.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace pet_companion_api.Models +{ + public class Pet + { + [Key] + public string Id { get; set; } + public string Name { get; set; } + public PetClass Class { get; set; } + public PetStats Stats { get; set; } + public Resources Resources { get; set; } + public int Level { get; set; } + public string UserId { get; set; } + } +} diff --git a/Models/PetClass.cs b/Models/PetClass.cs new file mode 100644 index 0000000..3c06f6d --- /dev/null +++ b/Models/PetClass.cs @@ -0,0 +1,13 @@ +namespace pet_companion_api.Models +{ + public enum PetClass + { + FOREST_SPIRIT, + OCEAN_GUARDIAN, + FIRE_ELEMENTAL, + MYTHICAL_BEAST, + SHADOW_WALKER, + CYBER_PET, + BIO_MECHANICAL + } +} diff --git a/Models/PetClassInfo.cs b/Models/PetClassInfo.cs new file mode 100644 index 0000000..d21fa9c --- /dev/null +++ b/Models/PetClassInfo.cs @@ -0,0 +1,12 @@ + +namespace pet_companion_api.Models +{ + public class PetClassInfo + { + public string Name { get; set; } + public string Description { get; set; } + public string[] Modifiers { get; set; } + public string Color { get; set; } + public string Emoji { get; set; } + } +} \ No newline at end of file diff --git a/Models/PetStats.cs b/Models/PetStats.cs new file mode 100644 index 0000000..a5ea3e5 --- /dev/null +++ b/Models/PetStats.cs @@ -0,0 +1,66 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace pet_companion_api.Models +{ + public class PetStats + { + [Key, ForeignKey("Pet")] + public string PetId { get; set; } + public int Intelligence { get; set; } + public int Strength { get; set; } + public int Charisma { get; set; } + + public PetStats(PetClass petClass) + { + BuildFromClass(petClass); + } + + public void BuildFromClass(PetClass petClass) + { + switch (petClass) + { + case PetClass.FOREST_SPIRIT: + Intelligence = 10; + Strength = 5; + Charisma = 5; + break; + case PetClass.OCEAN_GUARDIAN: + Intelligence = 5; + Strength = 10; + Charisma = 5; + break; + case PetClass.FIRE_ELEMENTAL: + Intelligence = 5; + Strength = 5; + Charisma = 10; + break; + case PetClass.MYTHICAL_BEAST: + Intelligence = 7; + Strength = 7; + Charisma = 7; + break; + case PetClass.SHADOW_WALKER: + Intelligence = 8; + Strength = 6; + Charisma = 6; + break; + case PetClass.CYBER_PET: + Intelligence = 8; + Strength = 8; + Charisma = 6; + break; + case PetClass.BIO_MECHANICAL: + Intelligence = 8; + Strength = 6; + Charisma = 8; + break; + default: + Intelligence = 5; + Strength = 5; + Charisma = 5; + break; + } + } + } +} diff --git a/Models/Resources.cs b/Models/Resources.cs new file mode 100644 index 0000000..a0ac827 --- /dev/null +++ b/Models/Resources.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; + +namespace pet_companion_api.Models +{ + public class Resources + { + [Key, ForeignKey("Pet")] + public string PetId { get; set; } + public int Wisdom { get; set; } + public int Gold { get; set; } + public int Food { get; set; } + public int Junk { get; set; } + } +} diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..7680336 --- /dev/null +++ b/Program.cs @@ -0,0 +1,42 @@ +using Microsoft.EntityFrameworkCore; +using pet_companion_api.Data; +using pet_companion_api.Repositories; +using pet_companion_api.Services; + +namespace pet_companion_api +{ + public class Program + { + public static void Main(string[] args) + { + var builder = WebApplication.CreateBuilder(args); + + // Add services to the container. + builder.Services.AddControllers(); + builder.Services.AddEndpointsApiExplorer(); + builder.Services.AddSwaggerGen(); + + // Configure Entity Framework Core + var connectionString = builder.Configuration.GetConnectionString("DefaultConnection"); + builder.Services.AddDbContext(options => + options.UseSqlite(connectionString)); + + builder.Services.AddScoped(); + builder.Services.AddScoped(); + + var app = builder.Build(); + + // Configure the HTTP request pipeline. + if (app.Environment.IsDevelopment()) + { + app.UseSwagger(); + app.UseSwaggerUI(); + } + + app.UseHttpsRedirection(); + app.UseAuthorization(); + app.MapControllers(); + app.Run(); + } + } +} diff --git a/Properties/launchSettings.json b/Properties/launchSettings.json new file mode 100644 index 0000000..0883721 --- /dev/null +++ b/Properties/launchSettings.json @@ -0,0 +1,52 @@ +{ + "profiles": { + "http": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "http://localhost:5278" + }, + "https": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + }, + "dotnetRunMessages": true, + "applicationUrl": "https://localhost:7084;http://localhost:5278" + }, + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "swagger", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "Container (Dockerfile)": { + "commandName": "Docker", + "launchBrowser": true, + "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}/swagger", + "environmentVariables": { + "ASPNETCORE_HTTPS_PORTS": "8081", + "ASPNETCORE_HTTP_PORTS": "8080" + }, + "publishAllPorts": true, + "useSSL": true + } + }, + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:10272", + "sslPort": 44315 + } + } +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..7c1f33f --- /dev/null +++ b/README.md @@ -0,0 +1,42 @@ +# Database Setup and Migration Guide + +## Prerequisites +- .NET 8.0 SDK +- Entity Framework Core tools + +## Install EF Core Tools +```sh +dotnet tool install --global dotnet-ef +``` + +### Creating and Updating Database +1. Create initial migration: +dotnet ef migrations add InitialCreate + +2. Apply migrations to create/update database: +dotnet ef database update + +### Common Commands +1. Create new migration: +dotnet ef migrations add + +2. Remove last migration: +dotnet ef migrations remove + +3. Apply migrations to create/update database: +dotnet ef database update + +4. Revert last migration: +dotnet ef database update + +5. List all migrations: +dotnet ef migrations list + +6. Script migration: +dotnet ef migrations script + +7. Remove all migrations: +dotnet ef migrations remove + +8. Drop database: +dotnet ef database drop \ No newline at end of file diff --git a/Repositories/PetRepository.cs b/Repositories/PetRepository.cs new file mode 100644 index 0000000..ab54ad1 --- /dev/null +++ b/Repositories/PetRepository.cs @@ -0,0 +1,32 @@ +using Microsoft.EntityFrameworkCore; +using pet_companion_api.Data; +using pet_companion_api.Models; + +namespace pet_companion_api.Repositories +{ + public class PetRepository + { + private readonly ApplicationDbContext _context; + + public PetRepository(ApplicationDbContext context) + { + _context = context; + } + + public IEnumerable GetPetsByUserId(string userId) + { + return _context.Pets + .Where(p => p.UserId == userId) + .Include(p => p.Stats) + .Include(p => p.Resources) + .ToList(); + } + + public Pet CreatePet(Pet pet) + { + _context.Pets.Add(pet); + _context.SaveChanges(); + return pet; + } + } +} diff --git a/Services/PetService.cs b/Services/PetService.cs new file mode 100644 index 0000000..a6cb11b --- /dev/null +++ b/Services/PetService.cs @@ -0,0 +1,31 @@ +using pet_companion_api.Models; +using pet_companion_api.Repositories; + +namespace pet_companion_api.Services +{ + public class PetService + { + private readonly PetRepository petRepository; + + public PetService(PetRepository petRepository) + { + this.petRepository = petRepository; + } + + public IEnumerable GetAllPets(Guid userId) + { + return petRepository.GetPetsByUserId(userId.ToString()); + } + + public Pet CreatePet(Guid userId, Pet pet) + { + pet.Id = Guid.NewGuid().ToString(); + pet.UserId = userId.ToString(); + pet.Level = 1; + pet.Stats = new PetStats(pet.Class); + pet.Resources = new Resources(); + + return petRepository.CreatePet(pet); + } + } +} diff --git a/appsettings.json b/appsettings.json new file mode 100644 index 0000000..fe2d73e --- /dev/null +++ b/appsettings.json @@ -0,0 +1,12 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Information", + "Microsoft.AspNetCore": "Warning" + } + }, + "AllowedHosts": "*", + "ConnectionStrings": { + "DefaultConnection": "Data Source=petcompanion.db" + } +} diff --git a/pet-companion-api.csproj b/pet-companion-api.csproj new file mode 100644 index 0000000..02259d8 --- /dev/null +++ b/pet-companion-api.csproj @@ -0,0 +1,24 @@ + + + + net8.0 + enable + enable + pet_companion_api + fb7dfb2a-4bb7-4cd0-bc10-293410089f4b + Linux + . + + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + + + + diff --git a/pet-companion-api.http b/pet-companion-api.http new file mode 100644 index 0000000..be3ce9b --- /dev/null +++ b/pet-companion-api.http @@ -0,0 +1,6 @@ +@pet_companion_api_HostAddress = http://localhost:5278 + +GET {{pet_companion_api_HostAddress}}/weatherforecast/ +Accept: application/json + +### diff --git a/pet-companion-api.sln b/pet-companion-api.sln new file mode 100644 index 0000000..363623c --- /dev/null +++ b/pet-companion-api.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35431.28 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "pet-companion-api", "pet-companion-api.csproj", "{FC7D30C5-4ADA-4C80-B3AC-8D3EBBA33696}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {FC7D30C5-4ADA-4C80-B3AC-8D3EBBA33696}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FC7D30C5-4ADA-4C80-B3AC-8D3EBBA33696}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FC7D30C5-4ADA-4C80-B3AC-8D3EBBA33696}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FC7D30C5-4ADA-4C80-B3AC-8D3EBBA33696}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {1B269ACB-6192-4165-A30A-DED85F4A2877} + EndGlobalSection +EndGlobal