Add public/private calendars, full iCal support, and iCal URL import
- Public/private: toggle is_public via PUT /calendars/{id}; generate/clear
public_token and return ical_url when public
- Public feed: GET /cal/{token}/feed.ics (no auth) for subscription in
Google/Apple/Outlook calendars
- Full iCal export: use golang-ical; VALARM, ATTENDEE, all-day (VALUE=DATE),
RRULE, DTSTAMP, CREATED, LAST-MODIFIED
- Full iCal import: parse TZID, VALUE=DATE, VALARM, ATTENDEE, RRULE
- Import from URL: POST /calendars/import-url with calendar_id + url
- Migration: unique index on public_token, calendar_subscriptions table
- Config: BASE_URL for ical_url; Calendar model + API: ical_url field
- Docs: OpenAPI, llms.txt, README, SKILL.md, about/overview
Made-with: Cursor
This commit is contained in:
@@ -31,3 +31,13 @@ WHERE id = $1 AND deleted_at IS NULL;
|
||||
-- name: SoftDeleteCalendarsByOwner :exec
|
||||
UPDATE calendars SET deleted_at = now(), updated_at = now()
|
||||
WHERE owner_id = $1 AND deleted_at IS NULL;
|
||||
|
||||
-- name: GetCalendarByPublicToken :one
|
||||
SELECT id, owner_id, name, color, is_public, public_token, created_at, updated_at
|
||||
FROM calendars
|
||||
WHERE public_token = $1 AND is_public = true AND deleted_at IS NULL;
|
||||
|
||||
-- name: SetCalendarPublicToken :exec
|
||||
UPDATE calendars
|
||||
SET public_token = $2, updated_at = now()
|
||||
WHERE id = $1 AND deleted_at IS NULL;
|
||||
|
||||
8
sqlc/queries/subscriptions.sql
Normal file
8
sqlc/queries/subscriptions.sql
Normal file
@@ -0,0 +1,8 @@
|
||||
-- name: CreateCalendarSubscription :one
|
||||
INSERT INTO calendar_subscriptions (id, calendar_id, source_url)
|
||||
VALUES ($1, $2, $3)
|
||||
RETURNING *;
|
||||
|
||||
-- name: GetSubscriptionByCalendar :one
|
||||
SELECT * FROM calendar_subscriptions
|
||||
WHERE calendar_id = $1;
|
||||
@@ -55,6 +55,7 @@ CREATE TABLE calendars (
|
||||
);
|
||||
|
||||
CREATE INDEX idx_calendars_owner_id ON calendars (owner_id);
|
||||
CREATE UNIQUE INDEX idx_calendars_public_token ON calendars (public_token) WHERE public_token IS NOT NULL;
|
||||
|
||||
-- Calendar Members
|
||||
CREATE TABLE calendar_members (
|
||||
@@ -172,3 +173,14 @@ CREATE TABLE audit_logs (
|
||||
);
|
||||
|
||||
CREATE INDEX idx_audit_logs_entity ON audit_logs (entity_type, entity_id);
|
||||
|
||||
-- Calendar Subscriptions (external iCal URL sources)
|
||||
CREATE TABLE calendar_subscriptions (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
calendar_id UUID NOT NULL REFERENCES calendars(id),
|
||||
source_url TEXT NOT NULL,
|
||||
last_synced_at TIMESTAMPTZ,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE INDEX idx_calendar_subscriptions_calendar_id ON calendar_subscriptions (calendar_id);
|
||||
|
||||
Reference in New Issue
Block a user