traggo / server

self-hosted tag-based time tracking
https://traggo.net
GNU General Public License v3.0
1.21k stars 58 forks source link

CALDAV with traggo #156

Open punkyard opened 8 months ago

punkyard commented 8 months ago

Hi as traggo edits a calendar would it be possible to incorpore a caldav module to it? to sync with phones for example?

jmattheis commented 8 months ago

Possible yes, but it will be some effort to implement this.

punkyard commented 8 months ago

which help could you use for this?

jmattheis commented 8 months ago

First there has to be a plan how to map timespans with tags to caldav and after that's done it can be implemented.

punkyard commented 8 months ago

Have you used Caldav before? I haven't Here is what I found:

In CalDAV, events are .ics

Basic Structure of .ics

BEGIN:VCALENDAR

VERSION:2.0
PRODID:-//Your Organization//Your Product//EN

BEGIN:VEVENT
UID:event-1234@example.com
DTSTART:20240301T120000Z
DTEND:20240301T130000Z
SUMMARY:Meeting with Joe
DESCRIPTION:Weekly meeting discussing a revolution.
LOCATION:Buuny's corner.
END:VEVENT

END:VCALENDAR
::KEYS::
BEGIN/END: These denote the start and end of a calendar object (VCALENDAR) and its components (VEVENT).
VERSION: Specifies the version of the iCalendar specification being used (usually "2.0").
PRODID: A unique identifier for the product that created the iCalendar object.
UID: A unique identifier for the event itself. This is crucial for updates and synchronization.
DTSTART and DTEND: These specify the start and end times of the event, respectively. Dates and times can be in local time, absolute time (with a timezone), or date-only format.
SUMMARY: A brief description or title of the event.
DESCRIPTION: A more detailed description of the event.
LOCATION: The location where the event is taking place.
RRULE: Specifies a rule for recurring events. For example, an event could repeat daily, weekly, or monthly according to various rules.
ATTENDEE: Represents a participant in the event. Events can have multiple ATTENDEE properties to include several participants.
ORGANIZER: Specifies the organizer of the event.
STATUS: Indicates the status of the event (e.g., "CONFIRMED", "TENTATIVE", "CANCELLED").
CATEGORIES: Allows tagging of events with categories like "Meeting", "Appointment", etc.
ALARM: Defines a reminder or alarm for the event. This is encapsulated within a VALARM component inside the VEVENT.
VTIMEZONE: Specifies timezone information for accurate scheduling across different time zones.

I guess it would take a library first of all, to match traggo's language to CalDAV protocol. What do you think?

Files to translate from one language to another will have to be created, and then deleted. What's the language you want to use?

Would you like to integrate a caldav server, or interact with an external one? both??

o new GraphQL types for CalDAV events, similar to the TimeSpan types (add recurrence rules RRULE, location, attendees.;. could be a plus)

o extend RootMutation and RootQuery types - to interact with CalDAV events create - update - delete CalDAV events + queries to fetch or send events from or to server

o hasRole directive enforces permission for authorized users

o update time scalar types for time fields - I guess it means changing the date and time formats to match CalDAV ..

example

type RootMutation {

    createDavEvent(start: Time!, end: Time, summary: String!, description: String, location: String, tags: [InputTimeSpanTag!]): DavEvent @hasRole(role: USER)
    updateDavEvent(id: Int!, start: Time!, end: Time, summary: String, description: String, location: String, tags: [InputTimeSpanTag!]): DavEvent @hasRole(role: USER)
    deleteDavEvent(id: Int!): DavEvent @hasRole(role: USER)

}

type DavEvent {
    id: Int!
    start: Time!
    end: Time
    summary: String!
    description: String
    location: String
    tags: [TimeSpanTag!]
}

type RootQuery {

    DavEvents(fromInclusive: Time, toInclusive: Time, tags: [String!]): [DavEvent!] @hasRole(role: USER)

}

input InputTimeSpanTag {
    key: String!
    value: String!
}

then see resolver.go

next depends on being server or client .. could be definitely a nice opening of traggo to the outside world! if it was a client, I could be used with google or nextcloud ... let me know

thanks for your concern ✌️

jmattheis commented 8 months ago

I don't think the caldav structure should be implemented via graphql. It should follow the caldav spec for syncing calenders. How do you want to use this feature, could you state some use-cases. Do you just want to lookup traggo events on your phone. Or do you want to add traggo events on your phone?

punkyard commented 8 months ago

as I wrote higher, as a client traggo could be synced with servers as google or nextcloud then anything done on the phone would be synced with the server and traggo as a client what do you think?

jmattheis commented 8 months ago

Yeah, could be useful, but is also a lot of effort.

We'd have to map time spans to caldav events and then parse and import them into the traggo database. There is the possibility for edit conflicts (edits in traggo and the calender at the same time), then the calender entry can be malformed and Traggo isn't able to import it. The remote calender could be unavailable so we have to update it correctly when it's online again. and much more.

I don't really think this is worth the effort to implement as you can use the webapp in the browser on a phone.

punkyard commented 8 months ago

no, halas, no one would us it in our team because we use nextcloud - we cannot mark time twice, and it can't be outside of nextcloud! but if it could connect - that would be howsome - traggo would show awesome looks on activities!