Files
github-login/github/models/github.ts
2025-12-30 00:45:54 +08:00

46 lines
917 B
TypeScript

import { sequelize } from '../../../modules/sequelize.ts';
import { DataTypes, Model } from 'sequelize';
export type Github = Partial<InstanceType<typeof GithubModel>>;
/**
* 用户代码容器
*/
export class GithubModel extends Model {
declare id: string;
declare title: string;
declare githubToken: string;
declare uid: string;
}
GithubModel.init(
{
id: {
type: DataTypes.UUID,
primaryKey: true,
defaultValue: DataTypes.UUIDV4,
comment: 'id',
},
title: {
type: DataTypes.STRING,
defaultValue: '',
},
githubToken: {
type: DataTypes.STRING,
defaultValue: '',
},
uid: {
type: DataTypes.UUID,
allowNull: true,
},
},
{
sequelize,
tableName: 'kv_github',
paranoid: true,
},
);
// GithubModel.sync({ alter: true, logging: false }).catch((e) => {
// console.error('GithubModel sync', e);
// });