Skip to content

Commit f9fd669

Browse files
committed
fix: update import entity
1 parent a2dd9d6 commit f9fd669

File tree

19 files changed

+30
-31
lines changed

19 files changed

+30
-31
lines changed

src/app/database/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { env } from '~/config/env'
22

3-
export default {
3+
module.exports = {
44
username: env.SEQUELIZE_USERNAME,
55
password: env.SEQUELIZE_PASSWORD,
66
database: env.SEQUELIZE_DATABASE,

src/app/database/connection.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import 'reflect-metadata'
33
import { Sequelize, type SequelizeOptions } from 'sequelize-typescript'
44
import { env } from '~/config/env'
55
import { logger } from '~/config/logger'
6-
import { __dirname } from '~/lib/string'
76

87
type ConnectionType = 'postgres' | 'mysql'
98

@@ -16,7 +15,7 @@ const sequelizeOptions: SequelizeOptions = {
1615
database: env.SEQUELIZE_DATABASE,
1716
logQueryParameters: env.SEQUELIZE_LOGGING,
1817
timezone: env.SEQUELIZE_TIMEZONE,
19-
models: [`${__dirname}/dist/app/database/entity`],
18+
models: [`${__dirname}/entity`],
2019
}
2120

2221
const sequelize = new Sequelize({ ...sequelizeOptions })

src/app/database/entity/base.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export interface IBaseEntity {
1616
}
1717

1818
@Table({ tableName: 'base' })
19-
export class BaseSchema extends Model {
19+
export default class BaseSchema extends Model {
2020
@IsUUID(4)
2121
@PrimaryKey
2222
@Column({ type: DataType.UUID, defaultValue: DataType.UUIDV4 })

src/app/database/entity/role.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Column, DeletedAt, Table } from 'sequelize-typescript'
2-
import { BaseSchema } from './base'
2+
import BaseSchema from './base'
33

44
@Table({ tableName: 'role', paranoid: true })
5-
export class Role extends BaseSchema {
5+
export default class Role extends BaseSchema {
66
@DeletedAt
77
@Column
88
deleted_at?: Date

src/app/database/entity/session.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { BelongsTo, Column, DataType, ForeignKey, IsUUID, Table } from 'sequelize-typescript'
2-
import { User } from './user'
3-
import { BaseSchema } from './base'
2+
import User from './user'
3+
import BaseSchema from './base'
44

55
@Table({ tableName: 'session' })
6-
export class Session extends BaseSchema {
6+
export default class Session extends BaseSchema {
77
@IsUUID(4)
88
@ForeignKey(() => User)
99
@Column({

src/app/database/entity/upload.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { Column, DataType, DeletedAt, Table } from 'sequelize-typescript'
2-
import { BaseSchema } from './base'
2+
import BaseSchema from './base'
33

44
@Table({ tableName: 'upload', paranoid: true })
5-
export class Upload extends BaseSchema {
5+
export default class Upload extends BaseSchema {
66
@DeletedAt
77
@Column
88
deleted_at?: Date

src/app/database/entity/user.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ import {
1515
} from 'sequelize-typescript'
1616
import Hashing from '~/config/hashing'
1717
import { createPasswordSchema } from '../schema/user'
18-
import { BaseSchema } from './base'
19-
import { Role } from './role'
20-
import { Session } from './session'
21-
import { Upload } from './upload'
18+
import BaseSchema from './base'
19+
import Role from './role'
20+
import Session from './session'
21+
import Upload from './upload'
2222

2323
const hashing = new Hashing()
2424

@@ -31,7 +31,7 @@ const hashing = new Hashing()
3131
withPassword: {},
3232
}))
3333
@Table({ tableName: 'user', paranoid: true })
34-
export class User extends BaseSchema {
34+
export default class User extends BaseSchema {
3535
@DeletedAt
3636
@Column
3737
deleted_at?: Date

src/app/database/schema/role.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { z } from 'zod'
2-
import { BaseSchema } from '../entity/base'
2+
import BaseSchema from '../entity/base'
33

44
// Schema
55
export const roleSchema = z.object({

0 commit comments

Comments
 (0)