Tags in Timify provide a flexible way to categorise time entries across projects. Each tag is owned by a user (scoped byDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Aking16/timify/llms.txt
Use this file to discover all available pages before exploring further.
userId) and can be attached to any number of time entries through the time_entry_tags join table. The six Server Actions documented here cover the full lifecycle of tags: creating and managing tag records, fetching the current user’s tag library, and toggling tag associations on individual time entries.
createTag
tags table, scoped to the authenticated user. The tag is created with the provided name and an optional hex colour. After a successful insert the action revalidates the /tags path and the get-tags cache tag.
Signature
Parameters
Display name for the tag. Must be non-empty and at most 16 characters long.
Optional hex colour string (e.g.
"#f59e0b"). Stored as-is; defaults to #9ca3af at the database level when omitted.Return Type
true when the tag was created.Human-readable status message.
The newly created tag row returned by Drizzle’s
.returning() clause. Present only when success is true.Side Effects
| Operation | Value |
|---|---|
revalidatePath | /tags |
revalidateTag | get-tags |
Usage Example
editTag
id. Authentication is verified before any database write. Cache is invalidated for both the /tags/ path and the get-tags tag upon success.
Signature
Parameters
UUID of the tag to update.
New display name. Must be non-empty and at most 16 characters.
Updated hex colour string. Optional.
Return Type
true when the update was applied.Human-readable status message.
Side Effects
| Operation | Value |
|---|---|
revalidatePath | /tags/ |
revalidateTag | get-tags |
Usage Example
deleteTag
time_entry_tags.tag_id is defined with onDelete: "cascade", deleting a tag also removes all its associations with time entries automatically — no orphaned join rows are left behind. The function accepts a plain string argument rather than FormData.
Signature
Parameters
UUID of the tag to delete. Returns an error state if the string is empty.
Return Type
true when the tag was deleted.Human-readable status message.
Side Effects
| Operation | Value |
|---|---|
revalidatePath | /tags/ |
revalidateTag | get-tags |
Usage Example
getTags
tags table. Uses Next.js "use cache" with the get-tags cache tag so repeated calls within a render are served from cache until a mutation revalidates the tag.
Signature
Parameters
This function accepts no parameters.Return Type
Array of all tag rows. Each element matches the Tag shape described under
createTag. Returns an empty array when no tags exist.Like
getProjects, getTags does not filter by userId at the SQL level. It is designed to be called from Server Components where route-level authentication is enforced. Avoid calling it from public or unauthenticated routes.Usage Example
addTagToTimeEntry
time_entry_tags join table linking a tag to a time entry. A unique index on (time_entry_id, tag_id) prevents duplicate associations — attempting to add the same tag twice will throw a database-level constraint error. The function takes two plain string arguments and is not a useActionState-compatible action — call it directly from useTransition or a server action wrapper.
Signature
Parameters
UUID of the time entry to tag.
UUID of the tag to attach.
Return Type
true when the association was created.Human-readable status message.
Side Effects
| Operation | Value |
|---|---|
revalidatePath | /project/ |
addTagToTimeEntry does not call revalidateTag("get-time-entries"). If you display tag counts in a cached Server Component, you may need to manually call revalidateTag("get-time-entries") in a wrapper action after this function returns.Usage Example
removeTagFromTimeEntry
time_entry_tags that links the specified tag to the specified time entry. The delete uses AND (tagId = ? AND timeEntryId = ?) so only the exact association is removed — the tag itself and the time entry both remain intact.
Signature
Parameters
UUID of the time entry from which the tag should be removed.
UUID of the tag to detach.
Return Type
true when the association row was deleted.Human-readable status message.
Side Effects
| Operation | Value |
|---|---|
revalidatePath | /project/ |
