Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: archive vehicles #433

Merged
merged 5 commits into from
Feb 24, 2025
Merged

feat: archive vehicles #433

merged 5 commits into from
Feb 24, 2025

Conversation

choffmann
Copy link
Member

Close #430

@choffmann choffmann added the need-reviewer Send notification in Discord label Feb 23, 2025
@choffmann choffmann self-assigned this Feb 23, 2025
@xk0niR xk0niR self-requested a review February 24, 2025 17:04
Copy link
Contributor

@xk0niR xk0niR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Create a new vehicle: OK
    grafik

  • Create new watering plan: OK
    grafik

  • Delete vehicle: OK

  • Open watering plan: ERROR

I am unable to open the watering plan. Backend shows
"error="entity not found: WateringPlan"

Also I created another vehicle and since then I am unable to open watering plan page
"DEBUG internal/storage/postgres/watering_plan/get.go:92 failed to get linked vehicle entity by id and vehicle type user_id="9fddda2f-657d-4b81-b852-8a333ea2b4a1" error="no rows in result set" watering_plan_id="9" vehicle_type="trailer""

Edit: Last message may not related to another vehicle being created. It could be watering plan overview was loading fine because broken watering plan was on 2nd page. If another watering plan gets deleted and the broken watering plan moves to 1st page you can´t load the site anymore.

@xk0niR
Copy link
Contributor

xk0niR commented Feb 24, 2025

@choffmann Since we alter database table doesn´t the seed also to be updated?

@choffmann
Copy link
Member Author

@xk0niR I haven't touched the frontend yet. The delete endpoint is still active and will delete the entity from the database. To test it, you need to manually archive the vehicle via the backend api route POST /api/v1/vehicle/archive/:id

@choffmann
Copy link
Member Author

@choffmann Since we alter database table doesn´t the seed also to be updated?

@xk0niR No, I have implemented an archive_at attribute in the db which is set to null by default

Copy link
Contributor

@xk0niR xk0niR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested using swagger with vehicle id 3
Archive:
grafik

List all archived vehicles:
grafik

Vehicle is also no longer inside get-all-vehicles and get-vehicle-by-id also works.
Works 🥇

@choffmann choffmann force-pushed the feature/archive-vehicles branch from 7ec199d to 7f2bf19 Compare February 24, 2025 21:45
@choffmann choffmann merged commit e6794e8 into develop Feb 24, 2025
4 checks passed
@choffmann choffmann deleted the feature/archive-vehicles branch February 24, 2025 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-reviewer Send notification in Discord
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WateringPlan API returns »404 entitiy not found« and crashes frontend
2 participants