fix(types): resolve TypeScript errors across multiple packages

- bot-services: Add registerAsync to AI, Calendar, Clock, Todo modules
- bot-services: Add convenience methods to ClockService for bot handlers
- bot-services: Make CreateEventInput.endTime optional with sensible defaults
- bot-services: Fix empty interface ESLint errors (use type aliases)
- questions-backend: Add missing schema columns (isDefault, sortOrder, deletedAt)
- questions-backend: Fix or() return type handling in question service
- questions-web: Add guard for undefined question ID in route params
- skilltree-web: Fix DBSchema type by not extending idb interface directly
- calendar-web: Fix Check icon prop (use weight instead of strokeWidth)
- matrix-mana-bot: Update clock handler to use new service methods

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Till-JS 2026-01-29 13:33:01 +01:00
parent 91143a497b
commit 1733580d05
14 changed files with 314 additions and 37 deletions

View file

@ -53,7 +53,7 @@
{#if loading}
<span class="spinner"></span>
{:else if checked}
<Check size={sizes[size].icon} strokeWidth={3} />
<Check size={sizes[size].icon} weight="bold" />
{/if}
</button>

View file

@ -1,4 +1,4 @@
import { pgTable, uuid, text, boolean, timestamp } from 'drizzle-orm/pg-core';
import { pgTable, uuid, text, boolean, timestamp, integer } from 'drizzle-orm/pg-core';
export const collections = pgTable('collections', {
id: uuid('id').primaryKey().defaultRandom(),
@ -9,11 +9,15 @@ export const collections = pgTable('collections', {
color: text('color').default('#6366f1'),
icon: text('icon').default('folder'),
isDefault: boolean('is_default').default(false),
sortOrder: integer('sort_order').default(0),
isShared: boolean('is_shared').default(false),
shareToken: text('share_token').unique(),
createdAt: timestamp('created_at', { withTimezone: true }).defaultNow(),
updatedAt: timestamp('updated_at', { withTimezone: true }).defaultNow(),
deletedAt: timestamp('deleted_at', { withTimezone: true }),
});
export type Collection = typeof collections.$inferSelect;

View file

@ -32,6 +32,7 @@ export const questions = pgTable('questions', {
// Soft delete
isArchived: boolean('is_archived').default(false),
archivedAt: timestamp('archived_at', { withTimezone: true }),
deletedAt: timestamp('deleted_at', { withTimezone: true }),
});
export type Question = typeof questions.$inferSelect;

View file

@ -8,7 +8,7 @@ import { CreateQuestionDto, UpdateQuestionDto } from './dto';
export class QuestionService {
constructor(
@Inject('DATABASE_CONNECTION')
private readonly db: NodePgDatabase,
private readonly db: NodePgDatabase
) {}
async create(userId: string, dto: CreateQuestionDto): Promise<Question> {
@ -35,7 +35,7 @@ export class QuestionService {
tags?: string[];
limit?: number;
offset?: number;
},
}
): Promise<{ data: Question[]; total: number }> {
const conditions = [eq(questions.userId, userId), isNull(questions.deletedAt)];
@ -48,12 +48,13 @@ export class QuestionService {
}
if (options?.search) {
conditions.push(
or(
ilike(questions.title, `%${options.search}%`),
ilike(questions.description, `%${options.search}%`),
),
const searchCondition = or(
ilike(questions.title, `%${options.search}%`),
ilike(questions.description, `%${options.search}%`)
);
if (searchCondition) {
conditions.push(searchCondition);
}
}
const limit = options?.limit || 20;
@ -137,8 +138,8 @@ export class QuestionService {
and(
eq(questions.userId, userId),
eq(questions.collectionId, collectionId),
isNull(questions.deletedAt),
),
isNull(questions.deletedAt)
)
)
.orderBy(desc(questions.createdAt));
}

View file

@ -43,6 +43,9 @@
try {
const id = page.params.id;
if (!id) {
throw new Error('Question ID is required');
}
question = await questionsApi.getById(id);
researchResults = await researchApi.getByQuestion(id);
sources = await sourcesApi.getByQuestion(id);

View file

@ -1,7 +1,7 @@
import { openDB, type DBSchema, type IDBPDatabase } from 'idb';
import { openDB, type IDBPDatabase } from 'idb';
import type { Skill, Activity, UserStats } from '$lib/types';
interface SkillTreeDB extends DBSchema {
interface SkillTreeDB {
skills: {
key: string;
value: Skill;