Skip to content

Commit

Permalink
Merge pull request #820 from hargata/Hargata/804
Browse files Browse the repository at this point in the history
only make certain api endpoints testable
  • Loading branch information
hargata authored Jan 22, 2025
2 parents 1ee0c27 + 1c63012 commit 2afd118
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
5 changes: 5 additions & 0 deletions Controllers/APIController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1232,6 +1232,11 @@ public IActionResult UploadDocument(List<IFormFile> documents)
[Route("/api/vehicle/reminders/send")]
public IActionResult SendReminders(List<ReminderUrgency> urgencies)
{
if (!urgencies.Any())
{
//if no urgencies parameter, we will default to all urgencies.
urgencies = new List<ReminderUrgency> { ReminderUrgency.NotUrgent, ReminderUrgency.Urgent, ReminderUrgency.VeryUrgent, ReminderUrgency.PastDue };
}
var vehicles = _dataAccess.GetVehicles();
List<OperationResponse> operationResponses = new List<OperationResponse>();
var defaultEmailAddress = _config.GetUserConfig(User).DefaultReminderEmail;
Expand Down
21 changes: 12 additions & 9 deletions Views/API/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<div class="col-1">
<span class="badge bg-success">GET</span>
</div>
<div class="col-5 copyable">
<div class="col-5 copyable testable">
<code>/api/vehicles</code>
</div>
<div class="col-3">
Expand All @@ -44,7 +44,7 @@
<div class="col-1">
<span class="badge bg-success">GET</span>
</div>
<div class="col-5 copyable">
<div class="col-5 copyable testable">
<code>/api/vehicle/info</code>
</div>
<div class="col-3">
Expand Down Expand Up @@ -582,7 +582,7 @@
<div class="col-1">
<span class="badge bg-success">GET</span>
</div>
<div class="col-5 copyable">
<div class="col-5 copyable testable">
<code>/api/calendar</code>
</div>
<div class="col-3">
Expand Down Expand Up @@ -614,22 +614,22 @@
<div class="col-1">
<span class="badge bg-success">GET</span>
</div>
<div class="col-5 copyable">
<div class="col-5 copyable testable">
<code>/api/vehicle/reminders/send</code>
</div>
<div class="col-3">
Send reminder emails out to collaborators based on specified urgency.
</div>
<div class="col-3">
(must be root user)<br />
urgencies[]=[NotUrgent,Urgent,VeryUrgent,PastDue]
urgencies[]=[NotUrgent,Urgent,VeryUrgent,PastDue](optional)
</div>
</div>
<div class="row api-method">
<div class="col-1">
<span class="badge bg-success">GET</span>
</div>
<div class="col-5 copyable">
<div class="col-5 copyable testable">
<code>/api/makebackup</code>
</div>
<div class="col-3">
Expand All @@ -643,22 +643,25 @@
<div class="col-1">
<span class="badge bg-success">GET</span>
</div>
<div class="col-5 copyable">
<div class="col-5 copyable testable">
<code>/api/cleanup</code>
</div>
<div class="col-3">
Clears out temp files. Deep clean will also delete unlinked thumbnails and documents. Returns number of deleted files.
</div>
<div class="col-3">
(must be root user)<br />
deepClean(bool) - Perform deep clean
deepClean(bool) - Perform deep clean(optional)
</div>
</div>
}
<script>
$('.copyable').on('click', function (e) {
if (e.ctrlKey || e.metaKey){
window.location = e.currentTarget.textContent.trim();
let targetElement = $(e.currentTarget);
if (targetElement.hasClass("testable")){
window.location = targetElement.text().trim();
}
} else {
copyToClipboard(e.currentTarget);
}
Expand Down

0 comments on commit 2afd118

Please sign in to comment.