11import type { InCloud } from "#/inspatial-cloud.ts" ;
2- import ColorMe from "#/utils/color-me.ts" ;
3- import { inLog } from "#/in-log/in-log.ts" ;
42
53async function checkForUser ( app : InCloud ) {
64 const { orm } = app ;
@@ -25,61 +23,21 @@ async function checkForUser(app: InCloud) {
2523 await user . save ( ) ;
2624 await user . runAction ( "setPassword" , { password } ) ;
2725 app . inLog . info ( "Admin user created successfully." ) ;
28- prompt ( "Press any key to continue..." ) ;
26+ // prompt("Press any key to continue...");
2927 }
3028}
3129
3230function promptForUser ( ) {
33- const subject = "Create User" ;
34- let firstName : string | null = "" ;
35- let lastName : string | null = "" ;
36- let email : string | null = "" ;
37- let password : string | null = "" ;
38- while ( ! firstName ) {
39- firstName = prompt ( ColorMe . fromOptions ( "First Name:" , {
40- color : "brightCyan" ,
41- } ) ) ;
42- if ( ! firstName ) {
43- inLog . warn ( "First name cannot be empty" , subject ) ;
44- }
45- }
46- while ( ! lastName ) {
47- lastName = prompt ( ColorMe . fromOptions ( "Last Name:" , {
48- color : "brightCyan" ,
49- } ) ) ;
50- if ( ! lastName ) {
51- inLog . warn ( "Last name cannot be empty" , subject ) ;
52- }
53- }
54- while ( ! email ) {
55- email = prompt ( ColorMe . fromOptions ( "Email:" , { color : "brightCyan" } ) ) ;
56- if ( ! email ) {
57- inLog . warn ( "Email cannot be empty" , subject ) ;
58- }
59- }
60- while ( ! password ) {
61- password = prompt ( "Password:" ) ;
62- if ( ! password ) {
63- inLog . warn ( "Password cannot be empty" , subject ) ;
64- }
65- }
66- const user = {
31+ let firstName : string | null = "InSpatial" ;
32+ let lastName : string | null = "Admin" ;
33+ let email :
string | null = "[email protected] " ; 34+ let password : string | null = "password" ;
35+ return {
6736 firstName,
6837 lastName,
6938 email,
7039 password,
7140 } ;
72-
73- inLog . info (
74- `User: ${ ColorMe . fromOptions ( user . firstName , { color : "green" } ) } ${
75- ColorMe . fromOptions (
76- user . lastName ,
77- { color : "green" } ,
78- )
79- } ${ ColorMe . fromOptions ( user . email , { color : "green" } ) } `,
80- subject ,
81- ) ;
82- return user ;
8341}
8442
8543export default checkForUser ;
0 commit comments