File tree Expand file tree Collapse file tree 2 files changed +6
-21
lines changed
Expand file tree Collapse file tree 2 files changed +6
-21
lines changed Original file line number Diff line number Diff line change 11import 'reflect-metadata'
22
3- import { blue } from 'colorette'
4- import fs from 'fs'
5- import path from 'path'
63import { Sequelize , type SequelizeOptions } from 'sequelize-typescript'
74import { env } from '~/config/env'
8- import { logger } from '~/config/pino'
9-
10- const pathEnv = path . resolve ( '.env' )
11-
12- if ( ! fs . existsSync ( pathEnv ) ) {
13- const envExample = blue ( '.env.example' )
14- const envLocal = blue ( '.env' )
15-
16- const message = `Missing env!!!\nCopy / Duplicate ${ envExample } root directory to ${ envLocal } `
17- logger . info ( `${ message } ` )
18-
19- throw new Error ( message )
20- }
215
226const sequelizeOptions : SequelizeOptions = {
237 dialect : env . SEQUELIZE_CONNECTION ,
Original file line number Diff line number Diff line change @@ -2,28 +2,29 @@ import { green } from 'colorette'
22import _ from 'lodash'
33import { DataTypes , QueryInterface } from 'sequelize'
44import { v4 as uuidv4 } from 'uuid'
5+ import { env } from '~/config/env'
56import { hashing } from '~/config/hashing'
67import { logger } from '~/config/pino'
78import { default as ConstRole } from '~/core/constants/ConstRole'
89
9- const defaultPassword = 'Padang123'
10+ const defaultPassword = env . APP_PASSWORD
1011
1112logger . info ( `Seed - your default password: ${ green ( defaultPassword ) } ` )
1213
1314const data = [
1415 {
1516 fullname : 'Super Admin' ,
16- email : 'super.admin@mail .com' ,
17+ email : 'super.admin@example .com' ,
1718 role_id : ConstRole . ID_SUPER_ADMIN ,
1819 } ,
1920 {
2021 fullname : 'Admin' ,
21- email : 'admin@mail .com' ,
22+ email : 'admin@example .com' ,
2223 role_id : ConstRole . ID_ADMIN ,
2324 } ,
2425 {
25- fullname : 'Test User' ,
26- email : 'test. user@mail .com' ,
26+ fullname : 'User' ,
27+ email : 'user@example .com' ,
2728 role_id : ConstRole . ID_USER ,
2829 } ,
2930]
You can’t perform that action at this time.
0 commit comments