adds komoot integration

This commit is contained in:
Christian Beutel
2025-02-04 21:23:54 +01:00
parent a0b6480854
commit 4d1d07922a
32 changed files with 1373 additions and 189 deletions

View File

@@ -12,14 +12,22 @@ const StravaSchema = z.object({
active: z.boolean()
})
const KomootSchema = z.object({
email: z.string().email(),
password: z.string(),
active: z.boolean()
})
const IntegrationCreateSchema = z.object({
user: z.string().length(15),
strava: StravaSchema,
strava: StravaSchema.optional(),
komoot: KomootSchema.optional()
}) satisfies ZodType<Integration>
const IntegrationUpdateSchema = z.object({
strava: StravaSchema.optional(),
strava: StravaSchema.optional().nullable(),
komoot: KomootSchema.optional().nullable()
}) satisfies ZodType<Partial<Integration>>
export { StravaSchema, IntegrationCreateSchema, IntegrationUpdateSchema }
export { StravaSchema, IntegrationCreateSchema, IntegrationUpdateSchema, KomootSchema };

View File

@@ -1,9 +1,9 @@
interface BaseIntegration {
export interface BaseIntegration {
active: boolean
}
interface StravaIntegration extends BaseIntegration {
export interface StravaIntegration extends BaseIntegration {
clientId: string | number;
clientSecret: string;
routes: boolean;
@@ -13,13 +13,21 @@ interface StravaIntegration extends BaseIntegration {
expiresAt?: number;
}
export interface KomootIntegration extends BaseIntegration {
email: string,
password: string,
}
export class Integration {
id?: string;
user: string;
strava?: StravaIntegration;
strava?: StravaIntegration | null;
komoot?: KomootIntegration | null
constructor(user: string, strava?: StravaIntegration) {
constructor(user: string, strava?: StravaIntegration, komoot?: KomootIntegration) {
this.user = user;
this.strava = strava;
this.komoot = komoot;
}
}