Compare commits
No commits in common. "net9" and "main" have entirely different histories.
1
.vscode/bash.md
vendored
1
.vscode/bash.md
vendored
@ -14,5 +14,4 @@ dotnet run --project src/OneReview
|
|||||||
|
|
||||||
```bash 1731643960696 = 638672407606960000 = Thu Nov 14 2024 21:12:40 GMT-0700 (Mountain Standard Time)
|
```bash 1731643960696 = 638672407606960000 = Thu Nov 14 2024 21:12:40 GMT-0700 (Mountain Standard Time)
|
||||||
docker compose up --build
|
docker compose up --build
|
||||||
podman compose up --build
|
|
||||||
```
|
```
|
||||||
|
2
.vscode/launch.json
vendored
2
.vscode/launch.json
vendored
@ -9,7 +9,7 @@
|
|||||||
"type": "coreclr",
|
"type": "coreclr",
|
||||||
"request": "launch",
|
"request": "launch",
|
||||||
"preLaunchTask": "build",
|
"preLaunchTask": "build",
|
||||||
"program": "${workspaceFolder}/src/OneReview/bin/Debug/net9.0/win-x64/OneReview.dll",
|
"program": "${workspaceFolder}/src/OneReview/bin/Debug/net8.0/win-x64/OneReview.dll",
|
||||||
"args": [
|
"args": [
|
||||||
"s",
|
"s",
|
||||||
"test"
|
"test"
|
||||||
|
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -22,10 +22,6 @@
|
|||||||
"dev": {
|
"dev": {
|
||||||
"host": "http://localhost:5243",
|
"host": "http://localhost:5243",
|
||||||
"token": "ey..dev"
|
"token": "ey..dev"
|
||||||
},
|
|
||||||
"media": {
|
|
||||||
"host": "https://products.affirm.duckdns.org/",
|
|
||||||
"token": "ey..media"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
18
Dockerfile
18
Dockerfile
@ -1,28 +1,28 @@
|
|||||||
# Stage 1: Build Stage
|
# Stage 1: Build Stage
|
||||||
FROM mcr.microsoft.com/dotnet/sdk:9.0 AS build
|
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS Build
|
||||||
|
|
||||||
WORKDIR /src
|
WORKDIR /src
|
||||||
|
|
||||||
# restore
|
# restore
|
||||||
COPY ["src/OneReview/OneReview.csproj", "OneReview/"]
|
COPY ["src/Sprint-Console/Sprint-Console.csproj", "Sprint-Console/"]
|
||||||
RUN dotnet restore 'OneReview/OneReview.csproj'
|
RUN dotnet restore 'Sprint-Console/Sprint-Console.csproj'
|
||||||
|
|
||||||
# build
|
# build
|
||||||
COPY ["src/OneReview", "OneReview/"]
|
COPY ["src/Sprint-Console", "Sprint-Console/"]
|
||||||
WORKDIR /src/OneReview
|
WORKDIR /src/Sprint-Console
|
||||||
RUN dotnet build 'OneReview.csproj' -c Release -o /app/build
|
RUN dotnet build 'Sprint-Console.csproj' -c Release -o /app/build
|
||||||
|
|
||||||
# Stage 2: Publish Stage
|
# Stage 2: Publish Stage
|
||||||
FROM build AS publish
|
FROM build AS publish
|
||||||
RUN dotnet publish 'OneReview.csproj' -c Release -o /app/publish
|
RUN dotnet publish 'Sprint-Console.csproj' -c Release -o /app/publish
|
||||||
|
|
||||||
# Stage 3: Run Stage
|
# Stage 3: Run Stage
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:9.0
|
FROM mcr.microsoft.com/dotnet/aspnet:8.0
|
||||||
ENV ASPNETCORE_HTTP_PORTS=5001
|
ENV ASPNETCORE_HTTP_PORTS=5001
|
||||||
EXPOSE 5001
|
EXPOSE 5001
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=publish /app/publish .
|
COPY --from=publish /app/publish .
|
||||||
ENTRYPOINT [ "dotnet", "OneReview.dll" ]
|
ENTRYPOINT [ "dotnet", "Sprint-Console.dll" ]
|
||||||
|
|
||||||
# docker build -t sprint-console-001 .
|
# docker build -t sprint-console-001 .
|
||||||
# docker images ls | grep -i 001
|
# docker images ls | grep -i 001
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
version: "3.9"
|
||||||
|
|
||||||
services:
|
services:
|
||||||
webapp:
|
webapp:
|
||||||
container_name: one-review-api
|
container_name: one-review-api
|
||||||
@ -5,29 +7,21 @@ services:
|
|||||||
context: .
|
context: .
|
||||||
dockerfile: Dockerfile
|
dockerfile: Dockerfile
|
||||||
ports:
|
ports:
|
||||||
- "5005:5001"
|
- "5024:5043"
|
||||||
environment:
|
environment:
|
||||||
- ASPNETCORE_ENVIRONMENT=Production
|
- ASPNETCORE_ENVIRONMENT=Devlopment
|
||||||
|
|
||||||
# db:
|
db:
|
||||||
# container_name: one-review-db
|
container_name: one-review-db
|
||||||
# image: docker.io/postgres:latest
|
image: postgres:latest
|
||||||
# ports:
|
ports:
|
||||||
# - "5432:5432"
|
- "5432:5432"
|
||||||
# environment:
|
environment:
|
||||||
# POSTGRES_DB: onereview
|
POSTGRES_DB: onereview
|
||||||
# POSTGRES_USER: postgres
|
POSTGRES_USER: postgres
|
||||||
# POSTGRES_PASSWORD: strong_password
|
POSTGRES_PASSWORD: strong_password
|
||||||
# volumes:
|
volumes:
|
||||||
# - postgres_data:/var/lib/postgresql/data
|
- postgres_data:/var/lib/postgresql/data
|
||||||
|
|
||||||
# volumes:
|
volumes:
|
||||||
# postgres_data:
|
postgres_data:
|
||||||
|
|
||||||
# version: "3"
|
|
||||||
# services:
|
|
||||||
# one-review-webapp:
|
|
||||||
# image: one-review-webapp
|
|
||||||
# ports:
|
|
||||||
# - 5001:5001
|
|
||||||
# networks: {}
|
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"sdk": {
|
"sdk": {
|
||||||
"rollForward": "latestMinor",
|
"rollForward": "latestMinor",
|
||||||
"version": "9.0.100"
|
"version": "8.0.100"
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,8 +1,6 @@
|
|||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
using OneReview.Domain;
|
using OneReview.Domain;
|
||||||
using OneReview.Services;
|
using OneReview.Services;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
|
|
||||||
namespace OneReview.Controllers;
|
namespace OneReview.Controllers;
|
||||||
|
|
||||||
@ -13,14 +11,6 @@ public class ProductsController(ProductService productService) : ControllerBase
|
|||||||
|
|
||||||
private readonly ProductService _ProductService = productService;
|
private readonly ProductService _ProductService = productService;
|
||||||
|
|
||||||
[HttpGet()]
|
|
||||||
public IActionResult Get()
|
|
||||||
{
|
|
||||||
ReadOnlyCollection<Product> products = _ProductService.Get();
|
|
||||||
ProductResponse?[] productResponses = ProductResponse.FromDomain(products);
|
|
||||||
return Ok(productResponses);
|
|
||||||
}
|
|
||||||
|
|
||||||
[HttpPost]
|
[HttpPost]
|
||||||
public IActionResult Create(CreateProductRequest request)
|
public IActionResult Create(CreateProductRequest request)
|
||||||
{
|
{
|
||||||
@ -85,9 +75,6 @@ public class ProductsController(ProductService productService) : ControllerBase
|
|||||||
Category: product.Category,
|
Category: product.Category,
|
||||||
SubCategory: product.SubCategory);
|
SubCategory: product.SubCategory);
|
||||||
|
|
||||||
public static ProductResponse?[] FromDomain(IEnumerable<Product> products) =>
|
|
||||||
products.Select(FromDomain).ToArray();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFramework>net9.0</TargetFramework>
|
<TargetFramework>net8.0</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
using OneReview.Domain;
|
using OneReview.Domain;
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
|
|
||||||
namespace OneReview.Services;
|
namespace OneReview.Services;
|
||||||
|
|
||||||
@ -9,9 +8,6 @@ public class ProductService
|
|||||||
private static readonly List<Product> _ProductsRepository = [];
|
private static readonly List<Product> _ProductsRepository = [];
|
||||||
// private static readonly List<User> _UsersRepository = [];
|
// private static readonly List<User> _UsersRepository = [];
|
||||||
|
|
||||||
public ReadOnlyCollection<Product> Get() =>
|
|
||||||
_ProductsRepository.AsReadOnly();
|
|
||||||
|
|
||||||
// 1. fetch user
|
// 1. fetch user
|
||||||
// 1. fetch product
|
// 1. fetch product
|
||||||
// 1. check wether the user reached the
|
// 1. check wether the user reached the
|
||||||
|
Loading…
x
Reference in New Issue
Block a user