Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

958 B
Raw Blame
import { EntityRepositoryType, type Opt, PrimaryKeyProp, defineEntity, p } from '@mikro-orm/core';
import { PluginOauthTokensRepository } from '../repositories/PluginOauthTokens.repository';

export class PluginOauthTokens {
  [EntityRepositoryType]?: PluginOauthTokensRepository;
  [PrimaryKeyProp]?: ['plugin_id', 'user_id'];
  plugin_id!: string;
  user_id!: number;
  access_token?: string | null;
  refresh_token?: string | null;
  expires_at?: number | null;
  scope?: string | null;
  updated_at!: string & Opt;
}

export const PluginOauthTokensSchema = defineEntity({
  class: PluginOauthTokens,
  repository: () => PluginOauthTokensRepository,
  properties: {
    plugin_id: p.text().primary(),
    user_id: p.integer().primary(),
    access_token: p.text().nullable(),
    refresh_token: p.text().nullable(),
    expires_at: p.integer().nullable(),
    scope: p.text().nullable(),
    updated_at: p.text().defaultRaw(`(datetime('now'))`),
  },
});