Skip to content

Commit 43c4d24

Browse files
atu816neighbor-peacegeistnine01001101CK
committed
Final dbSpy4.0 cleanup
Co-authored-by: Michael Costello <[email protected]> Co-authored-by: Steven Geiger <[email protected]> Co-authored-by: Yufa Li <[email protected]> Co-authored-by: Alexander Tu <[email protected]>
1 parent d3e56a2 commit 43c4d24

33 files changed

+423
-233
lines changed

.ebextensions/psql.config

Lines changed: 0 additions & 9 deletions
This file was deleted.

Contributors.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@ Below is a list of features and improvements to which you can contribute. If you
1313
- Clean up unused dependencies from pre-4.0
1414
- Connecting to PostgreSQL database
1515
- When connecting to PostgreSQL to grab the data from the database, it takes a really long time to load (approximately 2 minutes); further investigate pg_dump alternatives for faster loading.
16+
- Integration and End-to-End testing for the codebase.
17+
- Live query feedback so users can see what their changes to the canvas look like as queries.
1618

1719
Known bugs/issues
1820

1921
- Table connection (handle) does not automatically render after a foreign key is added and the column data is saved.
22+
- In production, remote postgres database connections do not work. We suspect this is due to container environment (nodeJS) not having access to pg_dump command.
23+
- In development, WSL/Ubuntu users may have trouble running pg_dump due to version mismatch. Run `sudo apt-get --purge remove postgresql` to clear configuration files and zombie directories before installing postgresql fresh.
24+
- Undo function will not regress the state of the canvas to the point where it is empty. Whether this is a design choice or an issue is up to you.
25+
2026

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM node:16.17.0
22
WORKDIR /usr/src/app
33
COPY . /usr/src/app
4-
RUN npm ci && npm cache clean --force && npm i postgresql-client -g && npm run build
4+
RUN npm ci && npm cache clean --force && npm run build
55
EXPOSE 3000
66
ENTRYPOINT npm run start

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
<h1 align="center">Visualize, modify, and build your database with dbSpy!</h1>
1717
<p align="center">An open-source data modeling tool to facilitate relational database development</p>
18+
<p align="center">dbSpy是一个促进关系数据库开发的开源数据建模工具</p>
1819

1920
### Use Cases
2021

@@ -55,19 +56,21 @@
5556
---
5657

5758
### Getting started
58-
59+
You will need your own mySQL and redis databases for backend functions, and Google Cloud project for OAuth.
5960
- Fork and clone this repo
60-
- Add a .env file to the root directory
6161
- Add a db_schemas folder in server directory
62+
- Add a .env file to the root directory
6263
- Go to the Google Cloud Platform Console
63-
- Set up OAuth 2.0 credentials as laid out in <a href="https://support.google.com/cloud/answer/6158849?hl=en">here</a>
64+
- Set up OAuth 2.0 credentials as laid out in <a href="https://support.google.com/cloud/answer/6158849?hl=en">here</a>. Make sure
65+
your authorized redirect URI in the credentials you create matches the GOOGLE_AUTH_CALLBACK variable below.
6466
- Populate the .env file with the newly created code below:
6567

6668
```bash
6769
GOOGLE_AUTH_CALLBACK = ''
6870
DATABASE_URL = [mysql url for storing user data]
6971
DEV_SERVER_ENDPOINT = 'http://localhost:3000'
7072
DEV_CLIENT_ENDPOINT = 'http://localhost:8080'
73+
CLIENT_ENDPOINT = 'http://localhost:3000'
7174
GOOGLE_AUTH_CALLBACK = 'http://localhost:3000/api/oauth/google'
7275
GOOGLE_AUTH_CLIENT_ID = [google auth client id]
7376
GOOGLE_AUTH_CLIENT_SECRET = [google auth client secret]
@@ -167,7 +170,7 @@ npm run cert
167170
- Zoom On [+] - this button zooms into the canvas.
168171
- Zoom Out [-] - this button zooms out of the canvas.
169172
- Fit View [[]] - this button zooms to fit all the tables in focus.
170-
- Toggle Interactivity [lock] - this button toggles on and off all table and row interactivity.
173+
- Toggle Interactivity [lock] - this button toggles on and off all table and column interactivity.
171174
- Screenshot [camera] - this button saves a .png file of the current canvas view.
172175

173176
---
@@ -204,4 +207,4 @@ npm run cert
204207

205208
### License
206209

207-
dbSpy is developed under the MIT license. See more un
210+
dbSpy is developed under the MIT license. See more about dbSpy4.0 updates [here](https://github.com/oslabs-beta/dbSpy/releases/tag/v4.0.0).

server/controllers/auth.controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,10 @@ export const handleGoogleAuth: RequestHandler = async (req, res) => {
6666

6767
const queryStr = 'true';
6868

69-
console.log(client_url);
69+
log.info(client_url);
7070
res.redirect(301, `${client_url}/?success=` + queryStr);
7171
} catch (error) {
72-
log.error(error, 'User authorization failed');
72+
log.info(error, 'User authorization failed');
7373
return res.redirect(301, `${client_url}/login`);
7474
}
7575
};

server/controllers/mysqlData.controller.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import fs from 'fs';
2-
import log from '../logger';
2+
import log from '../logger/index';
33
const mysqldump = require('mysqldump');
44
import dotenv from 'dotenv';
55
dotenv.config();
@@ -39,7 +39,7 @@ export const getSchema = async (req, res, next) => {
3939
const { tables } = result;
4040
next();
4141
} catch (error) {
42-
console.log(error.message);
42+
log.info(error.message);
4343
next({ message: 'Error with getSchema middleware' });
4444
}
4545
};

server/controllers/user.controller.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ export const userRegistration: RequestHandler = async (req, res, next) => {
4646
const values = [full_name, email, hashedPW];
4747
connection.query(queryStr, values, (err, data) => {
4848
if (err) {
49-
console.log('Error during user registration');
49+
log.info('Error during user registration');
5050
return next(err);
5151
} else {
52-
console.log(`${email} succesfully registered!`);
52+
log.info(`${email} succesfully registered!`);
5353
return res.redirect(200, `/`);
5454
}
5555
})

server/routes/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dotenv.config();
2020
import Redis from 'ioredis';
2121
import { getCurrentUser } from '../service/session.service';
2222
import path from 'path';
23+
import log from '../logger/index'
2324

2425
const client_url =
2526
process.env.NODE_ENV === 'development'
@@ -71,9 +72,9 @@ const routes = async (app: Express) => {
7172

7273
app.use('/api/logout', (req: Request, res: Response) => {
7374
req.session.destroy((err) => {
74-
if (err) console.log('Error destroying session:', err);
75+
if (err) log.info('Error destroying session:', err);
7576
else {
76-
console.log('Succesfully destroyed session');
77+
log.info('Succesfully destroyed session');
7778
return res.redirect(`/`);
7879
}
7980
});

server/seed/seed.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import mysql from 'mysql2';
22
import dotenv from 'dotenv'
33
dotenv.config()
4+
import log from '../logger/index'
45

56
// Connect to SQL db and create users table
67
if (!process.env.DATABASE_URL) throw new Error('DATABASE_URL not found');
@@ -18,7 +19,7 @@ const loadData = () => {
1819
pg_schema TEXT
1920
)`;
2021
try { connection.query(createUserTable) }
21-
catch (err) { console.log(err) }
22+
catch (err) { log.info(err) }
2223
}
2324

2425
loadData();

src/App.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
1-
import React, { useState, useEffect } from "react";
1+
import React from "react";
22
import { Routes, Route, BrowserRouter } from "react-router-dom";
33
import Home from "./pages/Home";
44
import DBDisplay from "./pages/DBDisplay";
55
import Login from "./pages/Login";
66
import Signup from "./pages/Signup";
7-
import "./styles/index.css"
87
import Shared from "./pages/Shared";
9-
// TODO: Delete? Remove barrier to entry.
10-
import ProtectedRoute from "./pages/ProtectedRoute";
118
import useCredentialsStore from "./store/credentialsStore";
9+
import "./styles/index.css"
1210

1311
export default function App() {
1412
//STATE DECLARATION (dbSpy3.0)

0 commit comments

Comments
 (0)