mirror of
https://github.com/kennethnym/aris.git
synced 2026-06-16 12:31:17 +01:00
feat: enable reminders by default (#133)
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import { LocationSource } from "@freya/source-location"
|
import { LocationSource } from "@freya/source-location"
|
||||||
|
import { ReminderSource } from "@freya/source-reminders"
|
||||||
import { WebSearchSource } from "@freya/source-web-search"
|
import { WebSearchSource } from "@freya/source-web-search"
|
||||||
import { describe, expect, test } from "bun:test"
|
import { describe, expect, test } from "bun:test"
|
||||||
|
|
||||||
@@ -55,8 +56,12 @@ function createRecordingDb(): RecordingDb {
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe("default user sources", () => {
|
describe("default user sources", () => {
|
||||||
test("defines location and web search as default enabled sources", () => {
|
test("defines default enabled sources", () => {
|
||||||
expect(DEFAULT_ENABLED_SOURCE_IDS).toEqual([LocationSource.id, WebSearchSource.id])
|
expect(DEFAULT_ENABLED_SOURCE_IDS).toEqual([
|
||||||
|
LocationSource.id,
|
||||||
|
ReminderSource.id,
|
||||||
|
WebSearchSource.id,
|
||||||
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
test("inserts default enabled source rows for a user", async () => {
|
test("inserts default enabled source rows for a user", async () => {
|
||||||
@@ -70,7 +75,7 @@ describe("default user sources", () => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
expect(recording.table()).toBe(userSources)
|
expect(recording.table()).toBe(userSources)
|
||||||
expect(rows).toHaveLength(2)
|
expect(rows).toHaveLength(3)
|
||||||
expect(rows.map((row) => row.sourceId)).toEqual([...DEFAULT_ENABLED_SOURCE_IDS])
|
expect(rows.map((row) => row.sourceId)).toEqual([...DEFAULT_ENABLED_SOURCE_IDS])
|
||||||
expect(recording.conflictTarget()).toEqual([userSources.userId, userSources.sourceId])
|
expect(recording.conflictTarget()).toEqual([userSources.userId, userSources.sourceId])
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +1,16 @@
|
|||||||
import { LocationSource } from "@freya/source-location"
|
import { LocationSource } from "@freya/source-location"
|
||||||
|
import { ReminderSource } from "@freya/source-reminders"
|
||||||
import { WebSearchSource } from "@freya/source-web-search"
|
import { WebSearchSource } from "@freya/source-web-search"
|
||||||
|
|
||||||
import type { Database } from "../db/index.ts"
|
import type { Database } from "../db/index.ts"
|
||||||
|
|
||||||
import { userSources } from "../db/schema.ts"
|
import { userSources } from "../db/schema.ts"
|
||||||
|
|
||||||
export const DEFAULT_ENABLED_SOURCE_IDS = [LocationSource.id, WebSearchSource.id] as const
|
export const DEFAULT_ENABLED_SOURCE_IDS = [
|
||||||
|
LocationSource.id,
|
||||||
|
ReminderSource.id,
|
||||||
|
WebSearchSource.id,
|
||||||
|
] as const
|
||||||
|
|
||||||
export type DefaultEnabledSourceId = (typeof DEFAULT_ENABLED_SOURCE_IDS)[number]
|
export type DefaultEnabledSourceId = (typeof DEFAULT_ENABLED_SOURCE_IDS)[number]
|
||||||
|
|
||||||
|
|||||||
@@ -84,7 +84,9 @@ const ONE_DAY_MS = 24 * 60 * 60 * 1000
|
|||||||
* It owns recurrence expansion, edit-scope semantics, and feed item signals.
|
* It owns recurrence expansion, edit-scope semantics, and feed item signals.
|
||||||
*/
|
*/
|
||||||
export class ReminderSource implements FeedSource<ReminderFeedItem> {
|
export class ReminderSource implements FeedSource<ReminderFeedItem> {
|
||||||
readonly id = "freya.reminders"
|
static readonly id = "freya.reminders"
|
||||||
|
|
||||||
|
readonly id = ReminderSource.id
|
||||||
|
|
||||||
private readonly storage: ReminderStorage
|
private readonly storage: ReminderStorage
|
||||||
private readonly lookAheadMs: number
|
private readonly lookAheadMs: number
|
||||||
|
|||||||
Reference in New Issue
Block a user