Skip to content

Commit 570539f

Browse files
authored
Merge pull request #20 from anycode-pk/FixImagesURL
Fix image urls
2 parents a4bbd9e + 1fa12ab commit 570539f

16 files changed

+157
-739
lines changed

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
DB_HOST=localhost
2-
DB_PORT=5432
2+
DB_PORT=5433
33
POSTGRES_USER=TableBookingUser
44
POSTGRES_PASSWORD=postgres
55
POSTGRES_DB=TableBookingDB

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,15 @@ In order to get the application running locally along with seeded database perfo
1919
```bash
2020
docker compose up db
2121
```
22-
4. Run the api locally (button)
22+
4. Run the api locally (button)
23+
24+
## Migrations
25+
26+
Add migration:
27+
```bash
28+
dotnet ef migrations add {MigrationName} --project "{PATH_TO_PROJECT}\TableBooking\TableBooking.Model\TableBooking.Model.csproj" --startup-project "{PATH_TO_PROJECT}\TableBooking\TableBooking.Api\TableBooking.Api.csproj"
29+
```
30+
31+
```bash
32+
dotnet ef database update --project "{PATH_TO_PROJECT}\TableBooking\TableBooking.Model\TableBooking.Model.csproj" --startup-project "{PATH_TO_PROJECT}\TableBooking\TableBooking.Api\TableBooking.Api.csproj"
33+
```

TableBooking.Api/Controllers/RestaurantController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,17 @@ namespace TableBooking.Controllers
1010
[ApiController]
1111
public class RestaurantController : ControllerBase
1212
{
13-
private IRestaurantService _restaurantService;
13+
private readonly IRestaurantService _restaurantService;
1414

1515
public RestaurantController(IRestaurantService restaurantService)
1616
{
1717
_restaurantService = restaurantService;
1818
}
1919

2020
[HttpGet("GetAllRestaurants")]
21-
public async Task<IActionResult> GetRestaurants([FromQuery]string? restuarantName, [FromQuery]Price? price)
21+
public async Task<IActionResult> GetRestaurants([FromQuery]string? restaurantName, [FromQuery]Price? price)
2222
{
23-
return await _restaurantService.GetAllRestaurantsAsync(restuarantName, price);
23+
return await _restaurantService.GetAllRestaurantsAsync(restaurantName, price);
2424
}
2525

2626
[HttpGet("GetRestaurantById/{id}")]

TableBooking.Api/Controllers/UserController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public async Task<IActionResult> Register([FromBody] UserRegisterDto userRegiste
3131
[HttpPost]
3232
[AllowAnonymous]
3333
[Route("login")]
34-
public async Task<IActionResult> Login([FromBody] UserLoginDto userLoginDTO)
34+
public async Task<IActionResult> Login([FromBody] UserLoginDto userLoginDTO)
3535
{
3636
return await _userService.Login(userLoginDTO);
3737
}

TableBooking.Api/Services/RestaurantService.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ public async Task<IActionResult> CreateRestaurantAsync(RestaurantShortInfoDto dt
2727
Rating = 0,
2828
Price = dto.Price,
2929
OpenTime = dto.OpenTime,
30-
Type = dto.Type
30+
Type = dto.Type,
31+
PrimaryImageURL = dto.PrimaryImageURL,
32+
SecondaryImageURL = dto.SecondaryImageURL
3133
};
3234
await _unitOfWork.RestaurantRepository.InsertAsync(restaurant);
3335
await _unitOfWork.SaveChangesAsync();
@@ -73,8 +75,8 @@ public async Task<IActionResult> UpdateRestaurantAsync(RestaurantShortInfoDto dt
7375
Name = dto.Name,
7476
Phone = dto.Phone,
7577
Price = dto.Price,
76-
PrimaryImageURL = dto.ImageURL,
77-
SecondaryImageURL = dto.ImageURL,
78+
PrimaryImageURL = dto.PrimaryImageURL,
79+
SecondaryImageURL = dto.SecondaryImageURL,
7880
Tables = restaurant.Tables,
7981
Type = dto.Type,
8082
Rating = restaurant.Rating,

TableBooking.Model/Dtos/RestaurantDtos/RestaurantShortInfoDto.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@ public class RestaurantShortInfoDto
99
public string Description { get; set; }
1010
public string Phone { get; set; }
1111
public string Location { get; set; }
12-
public string ImageURL { get; set; }
12+
13+
public string SecondaryImageURL { get; set; } =
14+
"https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/No_image_available.svg/240px-No_image_available.svg.png";
15+
16+
public string PrimaryImageURL { get; set; } =
17+
"https://upload.wikimedia.org/wikipedia/commons/thumb/a/ac/No_image_available.svg/240px-No_image_available.svg.png";
1318
public int Rating { get; set; }
1419
public Price Price { get; set; }
1520
public DateTime OpenTime { get; set; }

TableBooking.Model/Migrations/20231112181725_AppUserId.Designer.cs

Lines changed: 0 additions & 276 deletions
This file was deleted.

0 commit comments

Comments
 (0)