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 ;
@@ -30,7 +28,6 @@ async function checkForUser(app: InCloud) {
3028}
3129
3230function promptForUser ( ) {
33- const subject = "Create User" ;
3431 let firstName : string | null = "InSpatial" ;
3532 let lastName : string | null = "Admin" ;
3633 let email :
string | null = "[email protected] " ; @@ -41,51 +38,6 @@ function promptForUser() {
4138 email,
4239 password,
4340 } ;
44- while ( ! firstName ) {
45- firstName = prompt ( ColorMe . fromOptions ( "First Name:" , {
46- color : "brightCyan" ,
47- } ) ) ;
48- if ( ! firstName ) {
49- inLog . warn ( "First name cannot be empty" , subject ) ;
50- }
51- }
52- while ( ! lastName ) {
53- lastName = prompt ( ColorMe . fromOptions ( "Last Name:" , {
54- color : "brightCyan" ,
55- } ) ) ;
56- if ( ! lastName ) {
57- inLog . warn ( "Last name cannot be empty" , subject ) ;
58- }
59- }
60- while ( ! email ) {
61- email = prompt ( ColorMe . fromOptions ( "Email:" , { color : "brightCyan" } ) ) ;
62- if ( ! email ) {
63- inLog . warn ( "Email cannot be empty" , subject ) ;
64- }
65- }
66- while ( ! password ) {
67- password = prompt ( "Password:" ) ;
68- if ( ! password ) {
69- inLog . warn ( "Password cannot be empty" , subject ) ;
70- }
71- }
72- const user = {
73- firstName,
74- lastName,
75- email,
76- password,
77- } ;
78-
79- inLog . info (
80- `User: ${ ColorMe . fromOptions ( user . firstName , { color : "green" } ) } ${
81- ColorMe . fromOptions (
82- user . lastName ,
83- { color : "green" } ,
84- )
85- } ${ ColorMe . fromOptions ( user . email , { color : "green" } ) } `,
86- subject ,
87- ) ;
88- return user ;
8941}
9042
9143export default checkForUser ;
0 commit comments