11import { db } from "../db" ; // Assurez-vous que votre instance db est correcte
2- import { userSchema } from "../../schemas/Basic/user.schema" ;
2+ import { userSchema } from "../../schemas/Basic/user.schema" ;
33import { zimbra_password } from "../../utils/secret" ;
44import { hashPassword } from "../../services/auth.service" ;
55
66export const initUser = async ( ) => {
7- const existingUser = await db . select ( ) . from ( userSchema ) . limit ( 1 ) ;
8-
9- const hashedPassword = await hashPassword ( zimbra_password ) ;
10- // Si il n'y a pas de ligne existante, insérer une nouvelle ligne
11- if ( existingUser . length === 0 ) {
12- await db . insert ( userSchema ) . values ( {
13- first_name : "Integration UTT" ,
14- last_name : "Integration UTT" ,
15- email : "integration@utt.fr" ,
16- majeur : true ,
17- password : hashedPassword ,
18- permission : 'Admin' ,
19- } ) ;
20- }
21- } ;
7+ const existingUser = await db . select ( ) . from ( userSchema ) . limit ( 1 ) ;
8+
9+ const hashedPassword = await hashPassword ( zimbra_password ) ;
10+
11+ // Si il n'y a pas de ligne existante, insérer une nouvelle ligne
12+ if ( existingUser . length === 0 ) {
13+ await db . insert ( userSchema ) . values ( {
14+ first_name : "Integration UTT" ,
15+ last_name : "Integration UTT" ,
16+ email : "integration@utt.fr" ,
17+ majeur : true ,
18+ password : hashedPassword ,
19+ permission : 'Admin' ,
20+ } ) ;
21+ }
22+ } ;
0 commit comments