Skip to content

Commit

Permalink
Merge commit
Browse files Browse the repository at this point in the history
  • Loading branch information
jkuznik committed Nov 29, 2024
2 parents 356c426 + 7911008 commit dba3883
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/self-host-CD.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ jobs:
GOOGLE_API_KEY: ${{secrets.GOOGLE_API_KEY}}
DAY_SMS_LIMIT: ${{secrets.DAY_SMS_LIMIT}}
RISK_THRESHOLD: ${{secrets.RISK_THRESHOLD}}
run: sudo docker run -d --name disaster-alert-container --network disaster-net -p 8080:8080 \
run: |
sudo docker run -d --name disaster-alert-container --network disaster-net -p 8080:8080 \
-e TWILIO_ACCOUNT_SID=$TWILIO_ACCOUNT_SID \
-e TWILIO_AUTH_TOKEN=$TWILIO_AUTH_TOKEN \
-e TWILIO_PHONE_NUMBER=$TWILIO_PHONE_NUMBER \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
package pl.ateam.disasteralerts.disasteralert;

public enum DisasterType {
STORM, FIRE, FLOOD, HURRICANE, BLIZZARD, DROUGHT, HEAT
STORM("Burza"),
FIRE("Pożar"),
FLOOD("Powódź"),
HURRICANE("Huragan"),
BLIZZARD("Śnieżyca"),
DROUGHT("Susza"),
HEAT("Upał");

private final String polishName;

DisasterType(String polishName) {
this.polishName = polishName;
}

public String getPolishName() {
return polishName;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public String showAddDisasterForm(Model model, @AuthenticationPrincipal AppUser
model.addAttribute("disasterAddDTO", new DisasterAddDTO(null, null, null, null));
model.addAttribute("selectedLocation", appUser.getUserDTO().location());
model.addAttribute("googleApiKey", googleApiKey);
model.addAttribute("disasterTypes", DisasterType.values());

return "addDisaster";
}
Expand Down Expand Up @@ -73,6 +74,7 @@ public String showDisasterList(Model model, @AuthenticationPrincipal AppUser use

model.addAttribute("googleApiKey", googleApiKey);
model.addAttribute("inLocationDisasterAmount", inLocationDisastersAmount());
model.addAttribute("disasterTypes", DisasterType.values());
return "listDisasters";
}

Expand Down
5 changes: 4 additions & 1 deletion src/main/resources/db/changelog/dev.sql
Original file line number Diff line number Diff line change
Expand Up @@ -150,4 +150,7 @@ CREATE TABLE sms_limits
update_date TIMESTAMP WITHOUT TIME ZONE,
limit_counter INT NOT NULL,
CONSTRAINT pk_sms_limits PRIMARY KEY (id)
);
);

-- changeset jkuznik:1728934675080-26
ALTER TABLE users DROP CONSTRAINT uc_users_username;
2 changes: 1 addition & 1 deletion src/main/resources/templates/addDisaster.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ <h1 class="display-5 fw-bold text-body-emphasis">Dodaj <span class="text-primary
<option th:each="type : ${disasterType}"
th:value="${type}"
th:selected="${type == disasterTypSelected}"
th:text="${type}"></option>
th:text="${type.getPolishName()}"></option>
</select>
<label for="type">Typ Zdarzenia</label>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/templates/listDisasters.html
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ <h1 class="display-5 fw-bold text-body-emphasis">Sprawdź <span class="text-prim
<label for="disasterType" class="form-label">Rodzaj zdarzenia</label>
<select id="disasterType" name="disasterType" class="form-select">
<option value="" selected>Wszystkie</option>
<option th:each="type : ${disasterType}" th:value="${type}" th:text="${type}"></option>
<option th:each="type : ${disasterType}" th:value="${type}" th:text="${type.getPolishName()}"></option>
</select>
</div>
<div class="col-md-5">
Expand Down Expand Up @@ -119,7 +119,7 @@ <h1 class="display-5 fw-bold text-body-emphasis">Sprawdź <span class="text-prim
</thead>
<tbody>
<tr th:each="disaster : ${list}">
<td th:text="${disaster.type}"></td>
<td th:text="${disaster.type.getPolishName()}"></td>
<td th:text="${disaster.description}"></td>
<td th:text="${disaster.location}"></td>
<td th:text="${#temporals.format(disaster.createDate(), 'yyyy-MM-dd HH:mm')}"></td>
Expand Down

0 comments on commit dba3883

Please sign in to comment.