mirror of
https://github.com/pieartsy/PluralFlux.git
synced 2026-04-16 17:45:28 +10:00
add typeORM initial files
This commit is contained in:
7
.gitignore
vendored
7
.gitignore
vendored
@@ -1,8 +1,11 @@
|
|||||||
node_modules
|
node_modules/
|
||||||
|
build/
|
||||||
|
tmp/
|
||||||
|
temp/
|
||||||
.idea
|
.idea
|
||||||
secrets/
|
secrets/
|
||||||
config.json
|
|
||||||
coverage
|
coverage
|
||||||
|
config.json
|
||||||
log.txt
|
log.txt
|
||||||
.env
|
.env
|
||||||
oya.png
|
oya.png
|
||||||
|
|||||||
21
database/data-source.ts
Normal file
21
database/data-source.ts
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import "reflect-metadata"
|
||||||
|
import { DataSource } from "typeorm"
|
||||||
|
import { Member } from "./entity/Member"
|
||||||
|
import { System } from "./entity/System"
|
||||||
|
import * as env from 'dotenv';
|
||||||
|
|
||||||
|
env.config();
|
||||||
|
|
||||||
|
export const AppDataSource = new DataSource({
|
||||||
|
type: "postgres",
|
||||||
|
host: "localhost",
|
||||||
|
port: 5432,
|
||||||
|
username: "postgres",
|
||||||
|
password: process.env.POSTGRES_PASSWORD,
|
||||||
|
database: "postgres",
|
||||||
|
synchronize: true,
|
||||||
|
logging: false,
|
||||||
|
entities: [Member, System],
|
||||||
|
migrations: [],
|
||||||
|
subscribers: [],
|
||||||
|
})
|
||||||
23
database/entity/Member.ts
Normal file
23
database/entity/Member.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm"
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class Member {
|
||||||
|
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
userid: string
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
name: string
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
displayname: number
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
proxy: number
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
propic: number
|
||||||
|
}
|
||||||
20
database/entity/System.ts
Normal file
20
database/entity/System.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
import { Entity, PrimaryGeneratedColumn, Column } from "typeorm"
|
||||||
|
|
||||||
|
@Entity()
|
||||||
|
export class System {
|
||||||
|
|
||||||
|
@PrimaryGeneratedColumn()
|
||||||
|
id: number
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
userid: string
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
fronter: string
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
grouptag: string
|
||||||
|
|
||||||
|
@Column()
|
||||||
|
autoproxy: boolean
|
||||||
|
}
|
||||||
5
database/index.ts
Normal file
5
database/index.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import { AppDataSource } from "./data-source"
|
||||||
|
|
||||||
|
AppDataSource.initialize().then(async () => {
|
||||||
|
|
||||||
|
}).catch(error => console.log(error))
|
||||||
14
tsconfig.json
Normal file
14
tsconfig.json
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"lib": [
|
||||||
|
"es2021"
|
||||||
|
],
|
||||||
|
"target": "es2021",
|
||||||
|
"module": "commonjs",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"outDir": "./build",
|
||||||
|
"emitDecoratorMetadata": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"sourceMap": true
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user