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

Implement initial list timeentries command #7

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

myabc
Copy link

@myabc myabc commented Feb 6, 2025

An initial patch to support listing (personal) time entries. I wrote this to "scratch an itch" - and make my own time tracking easier.

image

Obviously full CRUD would be nice, but this is just a start.

Also, since this is the first go code I've written, please forgive if it not idiomatic!

@myabc myabc requested a review from Kharonus February 6, 2025 18:48
@Kharonus Kharonus self-assigned this Feb 11, 2025
Copy link
Member

@Kharonus Kharonus left a comment

Choose a reason for hiding this comment

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

Nice ❤️ thanks for your idea and effort. I'd love to put this into code after shaping it up a little bit

cmd/list/time_entries.go Outdated Show resolved Hide resolved
User FilterOption = iota
)

func UserFilter(name string) requests.Filter {
Copy link
Member

Choose a reason for hiding this comment

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

🟡 I'd love to extend this filter to the - admittedly not everywhere used - filter interface. This one is used only in the work package resource, and I planned to rewrite every filter to it. So, it'd be nice to have this new filter already taking the desired form.

Copy link
Member

Choose a reason for hiding this comment

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

I can imagine that there are some confusions :D especially as the code is half implemented around the filters. So, we can pair on it, if you want.


func All() ([]*models.TimeEntry, error) {
var filters []requests.Filter
filters = append(filters, UserFilter("me"))
Copy link
Member

Choose a reason for hiding this comment

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

🟡 I understand that you want to fetch only the time entries assigned to me on a default fetch. That makes sense, but the logic for that should be in the command, not in the read function IMHO. this also gets easier, if the filter is using the "new and shiny" implementation.

@myabc myabc force-pushed the feature/time-entries branch from 1cd9a3e to b5ab3d9 Compare February 11, 2025 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants