Skip to content

Commit

Permalink
small changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Numan52 committed Feb 28, 2025
1 parent 8d4271f commit fd3a19c
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,13 @@ jobs:
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml

- name: Azure Login
uses: azure/login@v1
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}


- name: deploy to Azure Spring Apps using Maven
run: |
mvn azure-spring-apps:deploy
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public ResponseEntity<?> getAds(@RequestParam int offset, @RequestParam int limi
}
}

// TODO: FIX MAXIMUM SIZE EXCEEDED ERROR

@PostMapping(path = "/ads", consumes = {MediaType.MULTIPART_FORM_DATA_VALUE})
public ResponseEntity<?> postAd(@RequestPart("ad") CreateAdDto createAdDto,
@RequestPart(value = "images", required = false) List<MultipartFile> images,
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/example/app/Daos/AdDao.java
Original file line number Diff line number Diff line change
Expand Up @@ -223,5 +223,7 @@ public void saveAdView(UserActivity userActivity) {
entityManager.persist(userActivity);
}


// TODO FINISH
public void updateAdView(UUID id, UUID adId) {
}
}
2 changes: 1 addition & 1 deletion src/main/java/org/example/app/Models/Entities/Ad.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public class Ad {
@Column(nullable = false)
private float price;

// TODO: check for errors regarding length

@Column(nullable = false, length = 1000)
private String description;

Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/example/app/Services/AdService.java
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,9 @@ public void updateUserAdViews(User user, UUID adId) {
Ad ad = adDao.getAd(adId);

boolean hasSeenAd = adDao.checkIfUserSeen(user.getId(), adId);
if (!hasSeenAd) {
if (hasSeenAd) {
adDao.updateAdView(user.getId(), adId);
} else {
adDao.saveAdView(new UserActivity(user, ad, null));
adDao.updateViewsCount(adId);
}
Expand Down

0 comments on commit fd3a19c

Please sign in to comment.