parent
ccfd223f0f
commit
d902ef7277
@ -0,0 +1,29 @@
|
||||
import {
|
||||
Entity,
|
||||
PrimaryGeneratedColumn,
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
UpdateDateColumn,
|
||||
} from 'typeorm';
|
||||
|
||||
@Entity()
|
||||
export class User {
|
||||
@PrimaryGeneratedColumn()
|
||||
public id: number;
|
||||
|
||||
@Column({ unique: true })
|
||||
public email: string;
|
||||
|
||||
@Column({ nullable: true })
|
||||
public plexToken: string;
|
||||
|
||||
@CreateDateColumn()
|
||||
public createdAt: Date;
|
||||
|
||||
@UpdateDateColumn()
|
||||
public updatedAt: Date;
|
||||
|
||||
constructor(init?: Partial<User>) {
|
||||
Object.assign(this, init);
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
import { Router } from 'express';
|
||||
import user from './user';
|
||||
|
||||
const router = Router();
|
||||
|
||||
router.use('/user', user);
|
||||
|
||||
router.get('/', (req, res) => {
|
||||
return res.status(200).json({
|
||||
api: 'Overseerr API',
|
||||
version: '1.0',
|
||||
});
|
||||
});
|
||||
|
||||
export default router;
|
@ -0,0 +1,15 @@
|
||||
import { Router } from 'express';
|
||||
import { getRepository } from 'typeorm';
|
||||
import { User } from '../entity/User';
|
||||
|
||||
const router = Router();
|
||||
|
||||
router.get('/', async (req, res) => {
|
||||
const userRepository = getRepository(User);
|
||||
|
||||
const users = await userRepository.find();
|
||||
|
||||
return res.status(200).json(users);
|
||||
});
|
||||
|
||||
export default router;
|
@ -0,0 +1,11 @@
|
||||
{
|
||||
"extends": "../tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"outDir": "../dist",
|
||||
"noEmit": false,
|
||||
"strictPropertyInitialization": false,
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"outDir": "dist",
|
||||
"noEmit": false
|
||||
}
|
||||
}
|
Loading…
Reference in new issue