From afefdb9e3daff85cce89dbd9f93f3481ad15dde7 Mon Sep 17 00:00:00 2001 From: Aaron Po Date: Sat, 6 Dec 2025 22:15:00 -0500 Subject: [PATCH] Add WebAPI controllers for beers, breweries, and users; update Docker configuration and .gitignore --- .gitignore | 5 +- DataAccessLayer/UserAccountRepository.cs | 3 +- DataLayer/data_source/ontariobreweries.json | 578 ++++++++++++++++++++ WebAPI/Controllers/BeersController.cs | 75 +++ WebAPI/Controllers/BreweriesController.cs | 57 ++ WebAPI/Controllers/UsersController.cs | 26 + WebAPI/Program.cs | 7 +- WebAPI/WebAPI.csproj | 4 + WebCrawler/Program.cs | 2 + WebCrawler/WebCrawler.csproj | 10 + biergarten.sln | 14 + docker-compose.yml | 20 +- 12 files changed, 790 insertions(+), 11 deletions(-) create mode 100644 DataLayer/data_source/ontariobreweries.json create mode 100644 WebAPI/Controllers/BeersController.cs create mode 100644 WebAPI/Controllers/BreweriesController.cs create mode 100644 WebAPI/Controllers/UsersController.cs create mode 100644 WebCrawler/Program.cs create mode 100644 WebCrawler/WebCrawler.csproj diff --git a/.gitignore b/.gitignore index 53711ff..69bbe5d 100644 --- a/.gitignore +++ b/.gitignore @@ -427,4 +427,7 @@ FodyWeavers.xsd *.msm *.msp -.DS_Store \ No newline at end of file +.DS_Store + +*/data_source/other +.fake \ No newline at end of file diff --git a/DataAccessLayer/UserAccountRepository.cs b/DataAccessLayer/UserAccountRepository.cs index 143151d..d8c9aa3 100644 --- a/DataAccessLayer/UserAccountRepository.cs +++ b/DataAccessLayer/UserAccountRepository.cs @@ -21,8 +21,7 @@ namespace DataAccessLayer } - - + public void Add(UserAccount userAccount) { const string query = diff --git a/DataLayer/data_source/ontariobreweries.json b/DataLayer/data_source/ontariobreweries.json new file mode 100644 index 0000000..0fa6c80 --- /dev/null +++ b/DataLayer/data_source/ontariobreweries.json @@ -0,0 +1,578 @@ +[ + { + "text": "100 Acre Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/100-acre-brewing-company/" + }, + { + "text": "All My Friends Beer Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/all-my-friends-beer-co/" + }, + { + "text": "All or Nothing Brewhouse", + "href": "https://ontariocraftbrewers.com/brewery-profile/all-or-nothing-brewhouse/" + }, + { + "text": "Anderson Craft Ales", + "href": "https://ontariocraftbrewers.com/brewery-profile/anderson-craft-ales/" + }, + { + "text": "Badlands Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/badlands-brewing-company/" + }, + { + "text": "Bancroft Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/bancroft-brewing-co/" + }, + { + "text": "Banded Goose Brewing Comany", + "href": "https://ontariocraftbrewers.com/brewery-profile/banded-goose-brewing-comany/" + }, + { + "text": "Beau’s Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/beaus-brewery/" + }, + { + "text": "BeerLab! London", + "href": "https://ontariocraftbrewers.com/brewery-profile/beerlab-london/" + }, + { + "text": "Bellwoods Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/bellwoods-brewery/" + }, + { + "text": "Bench Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/bench-brewing/" + }, + { + "text": "Beyond The Pale Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/beyond-the-pale-brewing-co/" + }, + { + "text": "Bicycle Craft Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/bicycle-craft-brewery/" + }, + { + "text": "Big Rig Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/big-rig-brewery/" + }, + { + "text": "Big Rock Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/big-rock-brewery/" + }, + { + "text": "Black Gold Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/black-gold-brewery/" + }, + { + "text": "Black Oak Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/black-oak-brewing-co/" + }, + { + "text": "Block 3 Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/block-3-brewing-co/" + }, + { + "text": "Blood Brothers Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/blood-brothers-brewing/" + }, + { + "text": "Bobcaygeon Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/bobcaygeon-brewing-company/" + }, + { + "text": "Boshkung Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/boshkung-brewing-co/" + }, + { + "text": "Brauwerk Hoffman – Rockland", + "href": "https://ontariocraftbrewers.com/brewery-profile/brauwerk-hoffman-rockland/" + }, + { + "text": "Bridge Masters Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/bridge-masters-brewing-co/" + }, + { + "text": "Broadhead Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/broadhead-brewery/" + }, + { + "text": "Broken Rail Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/broken-rail-brewing/" + }, + { + "text": "Burdock Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/burdock-brewery/" + }, + { + "text": "C’est What Durham Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/cest-what-durham-brewing-company/" + }, + { + "text": "Calabogie Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/calabogie-brewing/" + }, + { + "text": "Cameron’s Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/camerons-brewing-company/" + }, + { + "text": "Canvas Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/canvas-brewing-co/" + }, + { + "text": "Caps Off Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/caps-off-brewing/" + }, + { + "text": "Century Barn Brewing & Beverage Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/century-barn-brewing-and-beverage-company/" + }, + { + "text": "Chronicle Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/chronicle-brewing-company/" + }, + { + "text": "Clifford Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/clifford-brewing-co/" + }, + { + "text": "Cold Bear Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/cold-bear-brewing-co/" + }, + { + "text": "Collective Arts Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/collective-arts-brewing-ltd/" + }, + { + "text": "Common Good Beer Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/common-good-beer-co/" + }, + { + "text": "Couchiching Craft Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/couchiching-craft-brewing-company/" + }, + { + "text": "Cowbell Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/cowbell-brewing-co/" + }, + { + "text": "Cured Craft Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/cured-craft-brewing-co/" + }, + { + "text": "Daft Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/daft-brewing-company/" + }, + { + "text": "Dog House Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/dog-house-brewing-company/" + }, + { + "text": "Dominion City Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/dominion-city-brewing-co/" + }, + { + "text": "Eastbound Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/eastbound-brewing-co/" + }, + { + "text": "Equals Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/equals-brewing-company/" + }, + { + "text": "Fairweather Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/fairweather-brewing-company/" + }, + { + "text": "Farm League Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/farm-league-brewing/" + }, + { + "text": "Fixed Gear Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/fixed-gear-brewing-co/" + }, + { + "text": "Flying Monkeys Craft Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/flying-monkeys-craft-brewery/" + }, + { + "text": "Focal Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/focal-brewing-co/" + }, + { + "text": "Foundry Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/foundry-brewing/" + }, + { + "text": "Four Fathers Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/four-fathers-brewing-co/" + }, + { + "text": "Frank Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/frank-brewing-co/" + }, + { + "text": "Freddy’s", + "href": "https://ontariocraftbrewers.com/brewery-profile/freddys/" + }, + { + "text": "Full Beard Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/1068-2/" + }, + { + "text": "Furnace Room Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/furnace-room-brewery/" + }, + { + "text": "Gateway City Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/gateway-city-brewery/" + }, + { + "text": "Glasstown Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/glasstown-brewing-company/" + }, + { + "text": "Godspeed Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/godspeed-brewery/" + }, + { + "text": "Goldenfield Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/goldenfield-brewing/" + }, + { + "text": "Grand River Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/grand-river-brewery/" + }, + { + "text": "Granite Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/granite-brewery/" + }, + { + "text": "Great Lakes Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/great-lakes-brewery/" + }, + { + "text": "Haliburton Highlands Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/haliburton-highlands-brewery/" + }, + { + "text": "Imperial City Brew House", + "href": "https://ontariocraftbrewers.com/brewery-profile/imperial-city-brew-house/" + }, + { + "text": "Indie Ale House", + "href": "https://ontariocraftbrewers.com/brewery-profile/indie-ale-house/" + }, + { + "text": "Jobsite Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/jobsite-brewing-co/" + }, + { + "text": "Kichesippi Beer Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/kichesippi-beer-co/" + }, + { + "text": "Kick and Push Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/kick-and-push-brewing-company/" + }, + { + "text": "Lake of Bays Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/lake-of-bays-brewing-co/" + }, + { + "text": "Lake Of The Woods Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/lake-of-the-woods-brewing-company/" + }, + { + "text": "Left Field Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/left-field-brewery/" + }, + { + "text": "Lightcaster Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/lightcaster-brewery/" + }, + { + "text": "MacKinnon Brothers Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/mackinnon-brothers-brewing-co/" + }, + { + "text": "Maclean’s Ales Inc.", + "href": "https://ontariocraftbrewers.com/brewery-profile/macleans-ales-inc/" + }, + { + "text": "Magnotta Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/magnotta-brewery/" + }, + { + "text": "Market Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/market-brewing/" + }, + { + "text": "Mascot Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/mascot-brewery/" + }, + { + "text": "Matron Fine Beer", + "href": "https://ontariocraftbrewers.com/brewery-profile/matron-fine-beer/" + }, + { + "text": "Meyers Creek Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/meyers-creek-brewing-company/" + }, + { + "text": "Midtown Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/midtown-brewing-co/" + }, + { + "text": "Miski Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/miski-brewing/" + }, + { + "text": "Muddy York Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/muddy-york-brewing-co/" + }, + { + "text": "Muskoka Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/muskoka-brewery/" + }, + { + "text": "Natterjack Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/natterjack-brewing-company/" + }, + { + "text": "Newark Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/newark-brewing-co/" + }, + { + "text": "Niagara Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/niagara-brewing-company/" + }, + { + "text": "Niagara College Teaching Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/niagara-college-teaching-brewery/" + }, + { + "text": "Niagara Oast House Brewers", + "href": "https://ontariocraftbrewers.com/brewery-profile/niagara-oast-house-brewers/" + }, + { + "text": "Nickel Brook Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/nickel-brook-brewing-co/" + }, + { + "text": "Northern Superior Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/northern-superior-brewing-co/" + }, + { + "text": "Old Credit Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/old-credit-brewing-co/" + }, + { + "text": "Old Flame Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/1239-2/" + }, + { + "text": "Orléans Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/orleans-brewing-co/" + }, + { + "text": "Overflow Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/overflow-brewing-co/" + }, + { + "text": "Parsons Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/parsons-brewing-company/" + }, + { + "text": "Perth Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/perth-brewery/" + }, + { + "text": "Prince Eddy’s Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/prince-eddys-brewing-company/" + }, + { + "text": "Quayle’s Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/quayles-brewery/" + }, + { + "text": "Quetico Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/quetico-brewing-company/" + }, + { + "text": "Railway City Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/railway-city-brewing-co/" + }, + { + "text": "Ramblin’ Road Brewery Farm", + "href": "https://ontariocraftbrewers.com/brewery-profile/ramblin-road-brewery-farm/" + }, + { + "text": "Red Barn Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/red-barn-brewing-company/" + }, + { + "text": "Refined Fool Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/refined-fool-brewing-co/" + }, + { + "text": "Rouge River Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/rouge-river-brewing/" + }, + { + "text": "Royal City Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/royal-city-brewing-co/" + }, + { + "text": "Sassy Britches Brewing Co Ltd", + "href": "https://ontariocraftbrewers.com/brewery-profile/sassy-britches-brewing-co-ltd/" + }, + { + "text": "Sawdust City Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/sawdust-city-brewing/" + }, + { + "text": "Shawn & Ed Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/shawn-ed-brewing-co/" + }, + { + "text": "Silversmith Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/silversmith-brewing-company/" + }, + { + "text": "Slake Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/slake-brewing/" + }, + { + "text": "Sleeping Giant Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/sleeping-giant-brewing-co/" + }, + { + "text": "Something in the Water Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/something-in-the-water-brewing-co/" + }, + { + "text": "Sonnen Hill Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/sonnen-hill-brewing/" + }, + { + "text": "Sons of Kent Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/sons-of-kent-brewing-company/" + }, + { + "text": "Spark Beer", + "href": "https://ontariocraftbrewers.com/brewery-profile/spark-beer/" + }, + { + "text": "Split Rail Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/split-rail-brewing-company/" + }, + { + "text": "Stack Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/stack-brewing/" + }, + { + "text": "Steam Whistle Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/steam-whistle-brewing/" + }, + { + "text": "Steel Wheel Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/steel-wheel-brewery/" + }, + { + "text": "Stonehooker Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/stonehooker-brewing-company/" + }, + { + "text": "Stonepicker Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/stonepicker-brewery/" + }, + { + "text": "Stray Dog Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/stray-dog-brewing-company/" + }, + { + "text": "The Exchange Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/the-exchange-brewery/" + }, + { + "text": "The Grove Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/the-grove-brewing-company/" + }, + { + "text": "The Second Wedge Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/the-second-wedge-brewing-co/" + }, + { + "text": "Thornbury Village Craft Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/thornbury-village-craft-brewery/" + }, + { + "text": "Three Sheets Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/three-sheets-brewing/" + }, + { + "text": "Tooth and Nail Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/tooth-and-nail-brewing-company/" + }, + { + "text": "Torched Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/torched-brewing/" + }, + { + "text": "Town Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/town-brewery/" + }, + { + "text": "Trestle Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/trestle-brewing-company/" + }, + { + "text": "True History Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/true-history-brewing/" + }, + { + "text": "Upper Thames Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/upper-thames-brewing-co/" + }, + { + "text": "Vimy Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/vimy-brewing-company/" + }, + { + "text": "Walkerville Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/walkerville-brewery/" + }, + { + "text": "Wave Maker Craft Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/wave-maker-craft-brewery/" + }, + { + "text": "Wellington Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/wellington-brewery/" + }, + { + "text": "Whiprsnapr Brewing Co.", + "href": "https://ontariocraftbrewers.com/brewery-profile/whiprsnapr-brewing-co/" + }, + { + "text": "Whiskeyjack Beer Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/whiskeyjack-beer-company/" + }, + { + "text": "Whitewater Brewing Company", + "href": "https://ontariocraftbrewers.com/brewery-profile/whitewater-brewing-company/" + }, + { + "text": "Willibald Farm Distillery & Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/willibald-farm-distillery-brewery/" + }, + { + "text": "Windmill Brewery", + "href": "https://ontariocraftbrewers.com/brewery-profile/windmill-brewery/" + }, + { + "text": "Wishbone Brewing", + "href": "https://ontariocraftbrewers.com/brewery-profile/wishbone-brewing/" + } +] \ No newline at end of file diff --git a/WebAPI/Controllers/BeersController.cs b/WebAPI/Controllers/BeersController.cs new file mode 100644 index 0000000..efeea56 --- /dev/null +++ b/WebAPI/Controllers/BeersController.cs @@ -0,0 +1,75 @@ +using Microsoft.AspNetCore.Mvc; + +namespace WebAPI.Controllers +{ + [ApiController] + [Route("api/beers")] + public class BeersController : ControllerBase + { + [HttpGet] + public IActionResult GetBeers([FromQuery] int page_num, [FromQuery] int page_size) + { + return Ok(); + } + + [HttpGet("search")] + public IActionResult SearchBeers([FromQuery] string search) + { + return Ok(); + } + + [HttpGet("styles")] + public IActionResult GetBeerStyles([FromQuery] int page_num, [FromQuery] int page_size) + { + return Ok(); + } + + [HttpPost("styles/create")] + public IActionResult CreateBeerStyle([FromBody] BeerStyleCreateRequest request) + { + return Ok(); + } + + [HttpPut("{postId}")] + public IActionResult EditBeer(string postId, [FromBody] BeerEditRequest request) + { + return Ok(); + } + + [HttpDelete("{postId}")] + public IActionResult DeleteBeer(string postId) + { + return Ok(); + } + + [HttpGet("{postId}/recommendations")] + public IActionResult GetBeerRecommendations([FromQuery] int page_num, [FromQuery] int page_size, string postId) + { + return Ok(); + } + + [HttpPost("{postId}/comments")] + public IActionResult AddBeerComment(string postId, [FromBody] BeerCommentRequest request) + { + return Ok(); + } + + [HttpGet("{postId}/comments")] + public IActionResult GetBeerComments([FromQuery] int page_num, [FromQuery] int page_size, string postId) + { + return Ok(); + } + + [HttpPut("{postId}/comments/{commentId}")] + public IActionResult EditBeerComment(string postId, string commentId, [FromBody] BeerCommentRequest request) + { + return Ok(); + } + + [HttpDelete("{postId}/comments/{commentId}")] + public IActionResult DeleteBeerComment(string postId, string commentId) + { + return Ok(); + } + } +} \ No newline at end of file diff --git a/WebAPI/Controllers/BreweriesController.cs b/WebAPI/Controllers/BreweriesController.cs new file mode 100644 index 0000000..dd6bff0 --- /dev/null +++ b/WebAPI/Controllers/BreweriesController.cs @@ -0,0 +1,57 @@ +using Microsoft.AspNetCore.Mvc; + +namespace WebAPI.Controllers +{ + [ApiController] + [Route("api/breweries")] + public class BreweriesController : ControllerBase + { + [HttpGet] + public IActionResult GetBreweries([FromQuery] int page_num, [FromQuery] int page_size) + { + return Ok(); + } + + [HttpGet("map")] + public IActionResult GetBreweriesMap([FromQuery] int page_num, [FromQuery] int page_size) + { + return Ok(); + } + + [HttpPut("{postId}")] + public IActionResult EditBrewery(string postId, [FromBody] BreweryEditRequest request) + { + return Ok(); + } + + [HttpDelete("{postId}")] + public IActionResult DeleteBrewery(string postId) + { + return Ok(); + } + + [HttpPost("{postId}/comments")] + public IActionResult AddBreweryComment(string postId, [FromBody] BreweryCommentRequest request) + { + return Ok(); + } + + [HttpGet("{postId}/comments")] + public IActionResult GetBreweryComments([FromQuery] int page_num, [FromQuery] int page_size, string postId) + { + return Ok(); + } + + [HttpPut("{postId}/comments/{commentId}")] + public IActionResult EditBreweryComment(string postId, string commentId, [FromBody] BreweryCommentRequest request) + { + return Ok(); + } + + [HttpDelete("{postId}/comments/{commentId}")] + public IActionResult DeleteBreweryComment(string postId, string commentId) + { + return Ok(); + } + } +} \ No newline at end of file diff --git a/WebAPI/Controllers/UsersController.cs b/WebAPI/Controllers/UsersController.cs new file mode 100644 index 0000000..155d2e6 --- /dev/null +++ b/WebAPI/Controllers/UsersController.cs @@ -0,0 +1,26 @@ +using Microsoft.AspNetCore.Mvc; +using DataAccessLayer; + +namespace WebAPI.Controllers +{ + [ApiController] + [Route("api/users")] + public class UsersController : ControllerBase + { + private readonly UserAccountRepository _userAccountRepository; + + public UsersController() + { + _userAccountRepository = new UserAccountRepository(); + } + + // all users + [HttpGet("users")] + public IActionResult GetAllUsers() + { + var users = _userAccountRepository.GetAll(); + return Ok(users); + } + + } +} \ No newline at end of file diff --git a/WebAPI/Program.cs b/WebAPI/Program.cs index 6758956..6a53a1e 100644 --- a/WebAPI/Program.cs +++ b/WebAPI/Program.cs @@ -45,10 +45,7 @@ app.MapGet( ) .WithName("GetWeatherForecast"); -app.UseStaticFiles(); +// Register controllers +app.MapControllers(); app.Run(); -record WeatherForecast(DateOnly Date, int TemperatureC, string? Summary) -{ - public int TemperatureF => 32 + (int)(TemperatureC / 0.5556); -} diff --git a/WebAPI/WebAPI.csproj b/WebAPI/WebAPI.csproj index dad0e7c..6252c0f 100644 --- a/WebAPI/WebAPI.csproj +++ b/WebAPI/WebAPI.csproj @@ -8,4 +8,8 @@ + + + + diff --git a/WebCrawler/Program.cs b/WebCrawler/Program.cs new file mode 100644 index 0000000..3751555 --- /dev/null +++ b/WebCrawler/Program.cs @@ -0,0 +1,2 @@ +// See https://aka.ms/new-console-template for more information +Console.WriteLine("Hello, World!"); diff --git a/WebCrawler/WebCrawler.csproj b/WebCrawler/WebCrawler.csproj new file mode 100644 index 0000000..fd4bd08 --- /dev/null +++ b/WebCrawler/WebCrawler.csproj @@ -0,0 +1,10 @@ + + + + Exe + net9.0 + enable + enable + + + diff --git a/biergarten.sln b/biergarten.sln index cd25599..fb38f49 100644 --- a/biergarten.sln +++ b/biergarten.sln @@ -13,6 +13,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BusinessLayer", "BusinessLa EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DALTests", "DALTests\DALTests.csproj", "{99A04D79-A1A9-4BF5-9B70-58FC2B5D2E8A}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WebCrawler", "WebCrawler\WebCrawler.csproj", "{5B37FCDB-1BD0-439A-A840-61322353EAAE}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -83,6 +85,18 @@ Global {99A04D79-A1A9-4BF5-9B70-58FC2B5D2E8A}.Release|x64.Build.0 = Release|Any CPU {99A04D79-A1A9-4BF5-9B70-58FC2B5D2E8A}.Release|x86.ActiveCfg = Release|Any CPU {99A04D79-A1A9-4BF5-9B70-58FC2B5D2E8A}.Release|x86.Build.0 = Release|Any CPU + {5B37FCDB-1BD0-439A-A840-61322353EAAE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {5B37FCDB-1BD0-439A-A840-61322353EAAE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {5B37FCDB-1BD0-439A-A840-61322353EAAE}.Debug|x64.ActiveCfg = Debug|Any CPU + {5B37FCDB-1BD0-439A-A840-61322353EAAE}.Debug|x64.Build.0 = Debug|Any CPU + {5B37FCDB-1BD0-439A-A840-61322353EAAE}.Debug|x86.ActiveCfg = Debug|Any CPU + {5B37FCDB-1BD0-439A-A840-61322353EAAE}.Debug|x86.Build.0 = Debug|Any CPU + {5B37FCDB-1BD0-439A-A840-61322353EAAE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {5B37FCDB-1BD0-439A-A840-61322353EAAE}.Release|Any CPU.Build.0 = Release|Any CPU + {5B37FCDB-1BD0-439A-A840-61322353EAAE}.Release|x64.ActiveCfg = Release|Any CPU + {5B37FCDB-1BD0-439A-A840-61322353EAAE}.Release|x64.Build.0 = Release|Any CPU + {5B37FCDB-1BD0-439A-A840-61322353EAAE}.Release|x86.ActiveCfg = Release|Any CPU + {5B37FCDB-1BD0-439A-A840-61322353EAAE}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/docker-compose.yml b/docker-compose.yml index b48866d..98e83bf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,19 +5,32 @@ services: container_name: sqlserver environment: ACCEPT_EULA: "Y" - MSSQL_SA_PASSWORD: "YourStrong!Passw0rd" + SA_PASSWORD: "YourStrong!Passw0rd" ports: - "1433:1433" volumes: - sqlserverdata:/var/opt/mssql healthcheck: - test: [ "CMD", "/opt/mssql-tools18/bin/sqlcmd", "-C", "-S", "localhost", "-U", "sa", "-P", "YourStrong!Passw0rd", "-Q", "SELECT 1" ] + test: [ "CMD", "/opt/mssql-tools/bin/sqlcmd", "-S", "localhost", "-U", "sa", "-P", "YourStrong!Passw0rd", "-Q", "SELECT 1" ] interval: 10s timeout: 5s retries: 12 networks: - devnet + redis: + image: redis:7 + container_name: redis + ports: + - "6379:6379" + networks: + - devnet + healthcheck: + test: ["CMD", "redis-cli", "ping"] + interval: 10s + timeout: 5s + retries: 5 + dotnet: image: mcr.microsoft.com/dotnet/sdk:9.0 container_name: dotnet-sdk @@ -32,7 +45,8 @@ services: DOTNET_CLI_TELEMETRY_OPTOUT: "1" HOME: /home/dev USER: dev - DB_CONNECTION_STRING: "Server=sqlserver,1433;User Id=sa;Password=YourStrong!Passw0rd;Encrypt=True;TrustServerCertificate=True;Connection Timeout=30;" + DB_CONNECTION_STRING: "Server=sqlserver,1433;User Id=sa;Password=YourStrong!Passw0rd;Encrypt=True;TrustServerCertificate=True;Connection Timeout=30;Database=Biergarten;" + REDIS_URL: "redis:6379" user: root networks: - devnet