From 7fa1811586ebdf95ec955f755dc6282448c95141 Mon Sep 17 00:00:00 2001 From: Stedoss <29103029+Stedoss@users.noreply.github.com> Date: Sat, 29 Oct 2022 03:13:30 +0100 Subject: [PATCH] First example of Venue endpoint --- backend/LeedsBeerQuest.API/.gitignore | 6 + .../Controllers/VenueController.cs | 26 ++++ .../Data/Contexts/LeedsBeerQuestDbContext.cs | 18 ++- .../20221029013630_InitialCreate.Designer.cs | 144 +++++++++++++++++ .../20221029013630_InitialCreate.cs | 100 ++++++++++++ ...9020048_Categories_Name_String.Designer.cs | 145 ++++++++++++++++++ .../20221029020048_Categories_Name_String.cs | 31 ++++ .../LeedsBeerQuestDbContextModelSnapshot.cs | 143 +++++++++++++++++ .../Data/Models/Category.cs | 10 ++ .../LeedsBeerQuest.API/Data/Models/Tag.cs | 10 ++ .../LeedsBeerQuest.API/Data/Models/Venue.cs | 26 ++++ .../LeedsBeerQuest.API.csproj | 9 +- .../LeedsBeerQuest.API/Program.cs | 5 + 13 files changed, 670 insertions(+), 3 deletions(-) create mode 100644 backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Controllers/VenueController.cs create mode 100644 backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/20221029013630_InitialCreate.Designer.cs create mode 100644 backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/20221029013630_InitialCreate.cs create mode 100644 backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/20221029020048_Categories_Name_String.Designer.cs create mode 100644 backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/20221029020048_Categories_Name_String.cs create mode 100644 backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/LeedsBeerQuestDbContextModelSnapshot.cs create mode 100644 backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Models/Category.cs create mode 100644 backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Models/Tag.cs create mode 100644 backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Models/Venue.cs diff --git a/backend/LeedsBeerQuest.API/.gitignore b/backend/LeedsBeerQuest.API/.gitignore index 5b1ddcc..4753fe3 100644 --- a/backend/LeedsBeerQuest.API/.gitignore +++ b/backend/LeedsBeerQuest.API/.gitignore @@ -603,3 +603,9 @@ fabric.properties .idea/caches/build_file_checksums.ser # End of https://www.toptal.com/developers/gitignore/api/aspnetcore,csharp,rider + +*.csv# +*.db +*.db-shm +*.db-wal +*.swp diff --git a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Controllers/VenueController.cs b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Controllers/VenueController.cs new file mode 100644 index 0000000..4a51204 --- /dev/null +++ b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Controllers/VenueController.cs @@ -0,0 +1,26 @@ +using LeedsBeerQuest.API.Data.Contexts; +using LeedsBeerQuest.API.Data.Models; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; + +namespace LeedsBeerQuest.API.Controllers; + +[ApiController] +[Route("[controller]")] +public class VenueController +{ + private readonly LeedsBeerQuestDbContext _lbqContext; + + public VenueController(LeedsBeerQuestDbContext lbqContext) + { + _lbqContext = lbqContext; + } + + [HttpGet] + public async Task> Get() + { + return await _lbqContext.Venues + .Include(v => v.Category) + .ToListAsync(); + } +} \ No newline at end of file diff --git a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Contexts/LeedsBeerQuestDbContext.cs b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Contexts/LeedsBeerQuestDbContext.cs index af3685a..5200338 100644 --- a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Contexts/LeedsBeerQuestDbContext.cs +++ b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Contexts/LeedsBeerQuestDbContext.cs @@ -1,6 +1,20 @@ -namespace LeedsBeerQuest.API.Data.Contexts; +using LeedsBeerQuest.API.Data.Models; +using Microsoft.EntityFrameworkCore; -public class LeedsBeerQuestDbContext +namespace LeedsBeerQuest.API.Data.Contexts; + +public class LeedsBeerQuestDbContext : DbContext { + public LeedsBeerQuestDbContext() + { + } + public DbSet Venues { get; set; } + + // Don't need to define these, but explicitly adding them makes them a little more discoverable. + public DbSet Categories { get; set; } + public DbSet Tags { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder options) + => options.UseSqlite("Data Source=lbq.db"); } \ No newline at end of file diff --git a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/20221029013630_InitialCreate.Designer.cs b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/20221029013630_InitialCreate.Designer.cs new file mode 100644 index 0000000..9d8f7c6 --- /dev/null +++ b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/20221029013630_InitialCreate.Designer.cs @@ -0,0 +1,144 @@ +// +using System; +using LeedsBeerQuest.API.Data.Contexts; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace LeedsBeerQuest.API.Data.Migrations +{ + [DbContext(typeof(LeedsBeerQuestDbContext))] + [Migration("20221029013630_InitialCreate")] + partial class InitialCreate + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.10"); + + modelBuilder.Entity("LeedsBeerQuest.API.Data.Models.Category", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Name") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.ToTable("Categories"); + }); + + modelBuilder.Entity("LeedsBeerQuest.API.Data.Models.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("VenueId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VenueId"); + + b.ToTable("Tags"); + }); + + modelBuilder.Entity("LeedsBeerQuest.API.Data.Models.Venue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Address") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CategoryId") + .HasColumnType("INTEGER"); + + b.Property("DateAttended") + .HasColumnType("TEXT"); + + b.Property("Excerpt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Latitude") + .HasColumnType("TEXT"); + + b.Property("Longitude") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Phone") + .HasColumnType("TEXT"); + + b.Property("StarsAmenities") + .HasColumnType("TEXT"); + + b.Property("StarsAtmosphere") + .HasColumnType("TEXT"); + + b.Property("StarsBeer") + .HasColumnType("TEXT"); + + b.Property("StarsValue") + .HasColumnType("TEXT"); + + b.Property("Thumbnail") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Twitter") + .HasColumnType("TEXT"); + + b.Property("Url") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.ToTable("Venues"); + }); + + modelBuilder.Entity("LeedsBeerQuest.API.Data.Models.Tag", b => + { + b.HasOne("LeedsBeerQuest.API.Data.Models.Venue", null) + .WithMany("Tags") + .HasForeignKey("VenueId"); + }); + + modelBuilder.Entity("LeedsBeerQuest.API.Data.Models.Venue", b => + { + b.HasOne("LeedsBeerQuest.API.Data.Models.Category", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("LeedsBeerQuest.API.Data.Models.Venue", b => + { + b.Navigation("Tags"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/20221029013630_InitialCreate.cs b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/20221029013630_InitialCreate.cs new file mode 100644 index 0000000..b8e5a7d --- /dev/null +++ b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/20221029013630_InitialCreate.cs @@ -0,0 +1,100 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace LeedsBeerQuest.API.Data.Migrations +{ + public partial class InitialCreate : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Categories", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Categories", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Venues", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "TEXT", nullable: false), + CategoryId = table.Column(type: "INTEGER", nullable: false), + Url = table.Column(type: "TEXT", nullable: false), + DateAttended = table.Column(type: "TEXT", nullable: false), + Excerpt = table.Column(type: "TEXT", nullable: false), + Thumbnail = table.Column(type: "TEXT", nullable: false), + Latitude = table.Column(type: "TEXT", nullable: false), + Longitude = table.Column(type: "TEXT", nullable: false), + Address = table.Column(type: "TEXT", nullable: false), + Phone = table.Column(type: "TEXT", nullable: true), + Twitter = table.Column(type: "TEXT", nullable: true), + StarsBeer = table.Column(type: "TEXT", nullable: false), + StarsAtmosphere = table.Column(type: "TEXT", nullable: false), + StarsAmenities = table.Column(type: "TEXT", nullable: false), + StarsValue = table.Column(type: "TEXT", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Venues", x => x.Id); + table.ForeignKey( + name: "FK_Venues_Categories_CategoryId", + column: x => x.CategoryId, + principalTable: "Categories", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Tags", + columns: table => new + { + Id = table.Column(type: "INTEGER", nullable: false) + .Annotation("Sqlite:Autoincrement", true), + Name = table.Column(type: "TEXT", nullable: false), + VenueId = table.Column(type: "INTEGER", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Tags", x => x.Id); + table.ForeignKey( + name: "FK_Tags_Venues_VenueId", + column: x => x.VenueId, + principalTable: "Venues", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_Tags_VenueId", + table: "Tags", + column: "VenueId"); + + migrationBuilder.CreateIndex( + name: "IX_Venues_CategoryId", + table: "Venues", + column: "CategoryId"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Tags"); + + migrationBuilder.DropTable( + name: "Venues"); + + migrationBuilder.DropTable( + name: "Categories"); + } + } +} diff --git a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/20221029020048_Categories_Name_String.Designer.cs b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/20221029020048_Categories_Name_String.Designer.cs new file mode 100644 index 0000000..be1834d --- /dev/null +++ b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/20221029020048_Categories_Name_String.Designer.cs @@ -0,0 +1,145 @@ +// +using System; +using LeedsBeerQuest.API.Data.Contexts; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace LeedsBeerQuest.API.Data.Migrations +{ + [DbContext(typeof(LeedsBeerQuestDbContext))] + [Migration("20221029020048_Categories_Name_String")] + partial class Categories_Name_String + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.10"); + + modelBuilder.Entity("LeedsBeerQuest.API.Data.Models.Category", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Categories"); + }); + + modelBuilder.Entity("LeedsBeerQuest.API.Data.Models.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("VenueId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VenueId"); + + b.ToTable("Tags"); + }); + + modelBuilder.Entity("LeedsBeerQuest.API.Data.Models.Venue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Address") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CategoryId") + .HasColumnType("INTEGER"); + + b.Property("DateAttended") + .HasColumnType("TEXT"); + + b.Property("Excerpt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Latitude") + .HasColumnType("TEXT"); + + b.Property("Longitude") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Phone") + .HasColumnType("TEXT"); + + b.Property("StarsAmenities") + .HasColumnType("TEXT"); + + b.Property("StarsAtmosphere") + .HasColumnType("TEXT"); + + b.Property("StarsBeer") + .HasColumnType("TEXT"); + + b.Property("StarsValue") + .HasColumnType("TEXT"); + + b.Property("Thumbnail") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Twitter") + .HasColumnType("TEXT"); + + b.Property("Url") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.ToTable("Venues"); + }); + + modelBuilder.Entity("LeedsBeerQuest.API.Data.Models.Tag", b => + { + b.HasOne("LeedsBeerQuest.API.Data.Models.Venue", null) + .WithMany("Tags") + .HasForeignKey("VenueId"); + }); + + modelBuilder.Entity("LeedsBeerQuest.API.Data.Models.Venue", b => + { + b.HasOne("LeedsBeerQuest.API.Data.Models.Category", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("LeedsBeerQuest.API.Data.Models.Venue", b => + { + b.Navigation("Tags"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/20221029020048_Categories_Name_String.cs b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/20221029020048_Categories_Name_String.cs new file mode 100644 index 0000000..5c2d5cb --- /dev/null +++ b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/20221029020048_Categories_Name_String.cs @@ -0,0 +1,31 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace LeedsBeerQuest.API.Data.Migrations +{ + public partial class Categories_Name_String : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Name", + table: "Categories", + type: "TEXT", + nullable: false, + oldClrType: typeof(int), + oldType: "INTEGER"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "Name", + table: "Categories", + type: "INTEGER", + nullable: false, + oldClrType: typeof(string), + oldType: "TEXT"); + } + } +} diff --git a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/LeedsBeerQuestDbContextModelSnapshot.cs b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/LeedsBeerQuestDbContextModelSnapshot.cs new file mode 100644 index 0000000..77f8d17 --- /dev/null +++ b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Migrations/LeedsBeerQuestDbContextModelSnapshot.cs @@ -0,0 +1,143 @@ +// +using System; +using LeedsBeerQuest.API.Data.Contexts; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace LeedsBeerQuest.API.Data.Migrations +{ + [DbContext(typeof(LeedsBeerQuestDbContext))] + partial class LeedsBeerQuestDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder.HasAnnotation("ProductVersion", "6.0.10"); + + modelBuilder.Entity("LeedsBeerQuest.API.Data.Models.Category", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.ToTable("Categories"); + }); + + modelBuilder.Entity("LeedsBeerQuest.API.Data.Models.Tag", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("VenueId") + .HasColumnType("INTEGER"); + + b.HasKey("Id"); + + b.HasIndex("VenueId"); + + b.ToTable("Tags"); + }); + + modelBuilder.Entity("LeedsBeerQuest.API.Data.Models.Venue", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("Address") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("CategoryId") + .HasColumnType("INTEGER"); + + b.Property("DateAttended") + .HasColumnType("TEXT"); + + b.Property("Excerpt") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Latitude") + .HasColumnType("TEXT"); + + b.Property("Longitude") + .HasColumnType("TEXT"); + + b.Property("Name") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Phone") + .HasColumnType("TEXT"); + + b.Property("StarsAmenities") + .HasColumnType("TEXT"); + + b.Property("StarsAtmosphere") + .HasColumnType("TEXT"); + + b.Property("StarsBeer") + .HasColumnType("TEXT"); + + b.Property("StarsValue") + .HasColumnType("TEXT"); + + b.Property("Thumbnail") + .IsRequired() + .HasColumnType("TEXT"); + + b.Property("Twitter") + .HasColumnType("TEXT"); + + b.Property("Url") + .IsRequired() + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.ToTable("Venues"); + }); + + modelBuilder.Entity("LeedsBeerQuest.API.Data.Models.Tag", b => + { + b.HasOne("LeedsBeerQuest.API.Data.Models.Venue", null) + .WithMany("Tags") + .HasForeignKey("VenueId"); + }); + + modelBuilder.Entity("LeedsBeerQuest.API.Data.Models.Venue", b => + { + b.HasOne("LeedsBeerQuest.API.Data.Models.Category", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("LeedsBeerQuest.API.Data.Models.Venue", b => + { + b.Navigation("Tags"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Models/Category.cs b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Models/Category.cs new file mode 100644 index 0000000..cbddc5f --- /dev/null +++ b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Models/Category.cs @@ -0,0 +1,10 @@ +using System.ComponentModel.DataAnnotations; + +namespace LeedsBeerQuest.API.Data.Models; + +public class Category +{ + [Key] + public int Id { get; set; } + public string Name { get; set; } +} \ No newline at end of file diff --git a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Models/Tag.cs b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Models/Tag.cs new file mode 100644 index 0000000..425c822 --- /dev/null +++ b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Models/Tag.cs @@ -0,0 +1,10 @@ +using System.ComponentModel.DataAnnotations; + +namespace LeedsBeerQuest.API.Data.Models; + +public class Tag +{ + [Key] + public int Id { get; set; } + public string Name { get; set; } +} \ No newline at end of file diff --git a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Models/Venue.cs b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Models/Venue.cs new file mode 100644 index 0000000..9d4abd5 --- /dev/null +++ b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Data/Models/Venue.cs @@ -0,0 +1,26 @@ +using System.ComponentModel.DataAnnotations; + +namespace LeedsBeerQuest.API.Data.Models; + +public class Venue +{ + [Key] + public int Id { get; set; } + public string Name { get; set; } + public int CategoryId { get; set; } + public Category Category { get; set; } + public string Url { get; set; } + public DateTime DateAttended { get; set; } + public string Excerpt { get; set; } + public string Thumbnail { get; set; } + public decimal Latitude { get; set; } + public decimal Longitude { get; set; } + public string Address { get; set; } + public string? Phone { get; set; } + public string? Twitter { get; set; } + public decimal StarsBeer { get; set; } + public decimal StarsAtmosphere { get; set; } + public decimal StarsAmenities { get; set; } + public decimal StarsValue { get; set; } + public ICollection Tags { get; set; } +} \ No newline at end of file diff --git a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/LeedsBeerQuest.API.csproj b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/LeedsBeerQuest.API.csproj index a53a185..2fc857a 100644 --- a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/LeedsBeerQuest.API.csproj +++ b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/LeedsBeerQuest.API.csproj @@ -7,11 +7,18 @@ + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + - + diff --git a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Program.cs b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Program.cs index 8264bac..383db7c 100644 --- a/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Program.cs +++ b/backend/LeedsBeerQuest.API/LeedsBeerQuest.API/Program.cs @@ -1,3 +1,5 @@ +using LeedsBeerQuest.API.Data.Contexts; + var builder = WebApplication.CreateBuilder(args); // Add services to the container. @@ -7,6 +9,9 @@ builder.Services.AddControllers(); builder.Services.AddEndpointsApiExplorer(); builder.Services.AddSwaggerGen(); +// App services +builder.Services.AddScoped(); + var app = builder.Build(); // Configure the HTTP request pipeline.