Compare commits

..

No commits in common. "d68c033ba85b8a7b5c583a30d708be6744840752" and "c77731568745c4de0be090e417367beb59a57490" have entirely different histories.

2 changed files with 5 additions and 32 deletions

View File

@ -49,7 +49,7 @@ func (db *sqliteRepository) GetBillByYear(ctx context.Context, year int) ([]Bill
func (db *sqliteRepository) GetBillByID(ctx context.Context, id int) (*Bill, error) {
var bill Bill
if err := db.Where("id =?", id).First(&bill).Error; err != nil {
if err := db.Where("id =?", id).Find(&bill).Error; err != nil {
return nil, err
}
return &bill, nil

View File

@ -11,8 +11,6 @@ echo
echo "Running end-to-end testing..."
echo "Testing GET route '/api/v1'..."
curl $API_URL/api/v1; echo
echo
echo ----------------------------------------------------------------
# Testing '/api/v1/labels'.
echo
@ -39,20 +37,13 @@ curl -X DELETE $API_URL/api/v1/labels/3; echo
echo
echo "Testing GET route after DELETE '/api/v1/labels/:labelID'..."
curl $API_URL/api/v1/labels/3; echo
echo
echo ----------------------------------------------------------------
# Test '/api/v1/bills'
echo
echo "Using 'year' with value of 2023, 'month' with value of 5, and 'day' with value of 30 "
echo "Testing GET route '/api/v1/bills'..."
curl $API_URL/api/v1/bills; echo
echo
echo "Testing POST route '/api/v1/bills'..."
curl -X POST -H 'Content-Type: application/json' -d '{"id": 10, "year": 2023,"month":6, "day": 10, "money": 200, "label": "shopping"}' $API_URL/api/v1/bills; echo
# Test '/api/v1/bills/:year?/:month?/:day?'
echo
echo "Using 'year' with value of 2023, 'month' with value of 5, and 'day' with value of 30 "
echo "Testing GET route '/api/v1/bills/:year'..."
curl $API_URL/api/v1/bills/2023; echo
echo
@ -61,29 +52,11 @@ curl $API_URL/api/v1/bills/2023/5; echo
echo
echo "Testing GET route '/api/v1/bills/:year/:month/:day'..."
curl $API_URL/api/v1/bills/2023/5/30; echo
echo
echo "Testing POST route '/api/v1/bills"
curl -X POST -H 'Content-Type: application/json' -d '{"year": 2023,"month":6, "day": 10, "money": 200, "label": "shopping"}' $API_URL/api/v1/bills; echo
# Test '/api/v1/bills/id/:billID'
echo
echo "Using 'billID' with value of 10 (the one created beforehand)."
echo "Testing GET route '/api/v1/bills/id/:billID'..."
curl $API_URL/api/v1/bills/id/10; echo
# Test '/api/v1/bills/:billID'
echo
echo "Using 'billID' with value of 10 (the one created beforehand)."
echo "Testing PUT route '/api/v1/bills/:billID'..."
curl -X PUT -H 'Content-Type: application/json' -d '{"year": 2023,"month":6, "day": 10, "money": 21.2, "label": "transport"}' $API_URL/api/v1/bills/10; echo
echo
echo "Testing GET route after PUT '/api/v1/bills/:billID'..."
curl $API_URL/api/v1/bills/id/10; echo
echo
echo "Test DELETE route '/api/v1/bills/:billID'..."
curl -X DELETE $API_URL/api/v1/bills/10; echo
echo
echo "Testing GET route after DELETE '/api/v1/bills/id/:billID'..."
curl $API_URL/api/v1/bills/id/10; echo
echo
echo ----------------------------------------------------------------
## Testing '/api/v1/auth/login'.
#echo