Skip to content

Commit b6a7486

Browse files
committed
minor cleanup of code
1 parent 37aa84b commit b6a7486

File tree

2 files changed

+22
-22
lines changed

2 files changed

+22
-22
lines changed

server/controllers/user.controller.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -73,36 +73,36 @@ export const verifyUser: RequestHandler = async (req: Request, res: Response, ne
7373
const {id, email, verified_email, name, picture, type} = res.locals.userInfo;
7474

7575
const queryStr = 'INSERT IGNORE INTO users (full_name, email , password , picture, type) VALUES (?,?,?,?,?)';
76-
const hashedPw = await bcrypt.hash(id,saltRounds)
76+
const hashedPw = id.toString();
7777
if(verified_email){
78-
const addUser = await pool.query(queryStr,[name, email, hashedPw, picture,type])
78+
const addUser = await pool.query(queryStr,[name, email, hashedPw, picture,type]);
7979
log.info('verified or added Oauth User');
8080
const foundUser = (await findUser(email)) as RowDataPacket[][];
81-
log.info('found user')
81+
log.info('found user');
8282
res.locals.user = foundUser[0][0];
83-
console.log(res.locals.user)
83+
console.log(res.locals.user);
8484
return res.status(200).json(res.locals.user);
8585
}
8686
else{
87-
log.error('Error in verifyUser OAUTH')
88-
next(`Email not verified`)
87+
log.error('Error in verifyUser OAUTH');
88+
next(`Email not verified`);
8989
}
9090
}else{// for GITHUB
9191
const {login,id,url,avatar_url,type} = res.locals.userInfo;
9292
const queryStr = 'INSERT IGNORE INTO users (full_name, email , password , picture, type) VALUES (?,?,?,?,?)';
93-
let hashedPw:string
93+
let hashedPw:string;
9494
//fix bcrypt bug
9595
if(id) {
96-
hashedPw = await bcrypt.hash(id.toString(),saltRounds)
96+
hashedPw = id.toString();
9797
}else {
9898
hashedPw = 'default'};
9999
console.log(hashedPw);
100100
const addUser = await pool.query(queryStr,[login, url, hashedPw, avatar_url,type]);
101101
log.info('verified or added Oauth User');
102102
const foundUser = (await findUser(url)) as RowDataPacket[][];
103-
log.info('found user')
103+
log.info('found user');
104104
res.locals.user = foundUser[0][0];
105-
console.log(res.locals.user)
105+
console.log(res.locals.user);
106106
return res.status(200).json(res.locals.user);
107107
}
108108

src/components/ReactFlow/DataTableNode.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,16 @@ export default function DataTableNode({ data} : {data:Data} ) { //this 'data' i
2929

3030
//split up the table into different parts based on how the data is structured.
3131
const tableName = tableData[0];
32-
let firstRow : string[] = []
33-
let restRowsData : RowsOfData[]|[] = []
34-
let secondaryFirstRow : string[] = []
32+
let firstRow : string[] = [];
33+
let restRowsData : RowsOfData[]|[] = [];
34+
let secondaryFirstRow : string[] = [];
3535
let RowData:(RowsOfData[]) = Object.values(tableData[1]);
3636

3737

3838
//Used to grab the primary key and foreign keys column in the Table
3939
let schemaName = schemaStore[`public.${tableName}`];
40-
let PK :(string|number|null) = null
41-
let FK :(string|number|null) = null
40+
let PK :(string|number|null) = null;
41+
let FK :(string|number|null) = null;
4242
let pkVals = new Set();
4343
for(let key in schemaName){
4444
if(schemaName[key]['IsForeignKey']) FK = schemaName[key].field_name;
@@ -102,13 +102,13 @@ export default function DataTableNode({ data} : {data:Data} ) { //this 'data' i
102102
restRowsData = [...RowData];
103103
}
104104
}else{
105-
firstRow = secondaryFirstRow
105+
firstRow = secondaryFirstRow;
106106
}
107107

108108

109109
//UseEffect set Table when the dataStore is changed after on Delete.
110110
useEffect(() => {
111-
setTableData([tableName,dataStore[tableName]])
111+
setTableData([tableName,dataStore[tableName]]);
112112
}, [dataStore]);
113113

114114

@@ -129,11 +129,11 @@ export default function DataTableNode({ data} : {data:Data} ) { //this 'data' i
129129
// }
130130
/////////////////////////////////////////////////////////////////////////
131131

132-
const newDatastore = structuredClone(dataStore)
132+
const newDatastore = structuredClone(dataStore);
133133

134-
restRowsData = restRowsData.slice(0,index).concat(restRowsData.slice(index+1,restRowsData.length))
134+
restRowsData = restRowsData.slice(0,index).concat(restRowsData.slice(index+1,restRowsData.length));
135135

136-
newDatastore[tableName] = restRowsData
136+
newDatastore[tableName] = restRowsData;
137137
setDataStore({...newDatastore,[id]:restRowsData});
138138
// setDataStore(restRowData);
139139

@@ -158,7 +158,7 @@ const newDatastore = structuredClone(dataStore)
158158
})
159159
.then((res) => {
160160
//console.log("deleting row info sent")
161-
return res
161+
return res;
162162
})
163163
.catch((err: ErrorEvent) => { console.error('deleting row error', err) })
164164
} else {
@@ -171,7 +171,7 @@ const newDatastore = structuredClone(dataStore)
171171
})
172172
.then((res) => {
173173
//console.log("deleting row info sent")
174-
return res
174+
return res;
175175
})
176176
.catch((err: ErrorEvent) => { console.error('deleting row error', err) })
177177
}

0 commit comments

Comments
 (0)