mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-08 00:47:15 +08:00
add sqlite plugin(with typeorm and sqlite) and business entities
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
node_modules
|
||||||
|
src/**/*.js
|
||||||
|
src/**/*.js.map
|
||||||
|
database.sqlite
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "@geekgeekrun/sqlite-plugin",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"description": "",
|
||||||
|
"dependencies": {
|
||||||
|
"reflect-metadata": "^0.2.1",
|
||||||
|
"sqlite3": "^5.1.7",
|
||||||
|
"typeorm": "^0.3.20"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"ts-node": "^10.9.2",
|
||||||
|
"typescript": "^5.3.3"
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"dev": "NODE_OPTIONS=\"-r ts-node/register --no-warnings\" node ./src/index"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class BossInfo {
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
encryptedBossId: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
encryptedCompanyId: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
date: Date;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
title: Date;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class BossInfoChangeLog {
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
encryptedBossId: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
updateTime: Date;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
dataAsJson: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class ChatStartupLog {
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
encryptedPositionId: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
date: Date;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class CompanyInfo {
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
encryptCompanyId: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
name: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
brandName: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
scaleLow?: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
scaleHeight?: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
stageName?: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
industryName?: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class CompanyInfoChangeLog {
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
encryptedCompanyId: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
updateTime: Date;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
dataAsJson: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,49 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column, Unique } from "typeorm";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class JobInfo {
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
encryptedJobId: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
jobName: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
positionName: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
salaryLow?: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
salaryHeight?: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
salaryMonth?: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
experienceYearLow?: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
experienceYearHigh?: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
publishDate: Date;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
degreeName?: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
address: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
description: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
encryptedBossId: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
encryptedCompanyId: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm";
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class JobInfoChangeLog {
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
encryptedJobId: string;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
updateTime: Date;
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
dataAsJson: string;
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import "reflect-metadata";
|
||||||
|
import { DataSource } from "typeorm";
|
||||||
|
|
||||||
|
import { BossInfo } from "./entity/BossInfo";
|
||||||
|
import { BossInfoChangeLog } from "./entity/BossInfoChangeLog";
|
||||||
|
import { ChatStartupLog } from "./entity/ChatStartupLog";
|
||||||
|
import { CompanyInfoChangeLog } from "./entity/CompanyInfoChangeLog";
|
||||||
|
import { CompanyInfo } from "./entity/CompanyInfo";
|
||||||
|
import { JobInfo } from "./entity/JobInfo";
|
||||||
|
import { JobInfoChangeLog } from "./entity/JobInfoChangeLog";
|
||||||
|
|
||||||
|
async function initDb() {
|
||||||
|
const appDataSource = new DataSource({
|
||||||
|
type: "sqlite",
|
||||||
|
synchronize: true,
|
||||||
|
logging: true,
|
||||||
|
logger: "simple-console",
|
||||||
|
database: "database.sqlite",
|
||||||
|
entities: [
|
||||||
|
ChatStartupLog,
|
||||||
|
BossInfo,
|
||||||
|
BossInfoChangeLog,
|
||||||
|
CompanyInfo,
|
||||||
|
CompanyInfoChangeLog,
|
||||||
|
JobInfo,
|
||||||
|
JobInfoChangeLog,
|
||||||
|
],
|
||||||
|
});
|
||||||
|
return appDataSource.initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
(async () => {
|
||||||
|
const a = await initDb();
|
||||||
|
console.log(a);
|
||||||
|
})();
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"lib": ["es5", "es2015.promise", "dom", "es2015"],
|
||||||
|
"target": "es5",
|
||||||
|
"module": "commonjs",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
},
|
||||||
|
"exclude": ["node_modules"],
|
||||||
|
}
|
||||||
Generated
+789
-48
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user