Skip to content

Commit c3201b8

Browse files
committed
removed admin functionality completely
1 parent 43216a6 commit c3201b8

32 files changed

+53
-1215
lines changed

SetupApp/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,4 @@ document.addEventListener('DOMContentLoaded', () => {
1414
portForward.addEventListener('click', () => {
1515
fetch('/api/setup/portForward');
1616
});
17-
1817
});

__tests__/ServerRoutes.test.js

Lines changed: 1 addition & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,17 @@ const bodyParser = require("body-parser");
77
const app = express();
88
app.use(bodyParser.json());
99

10-
import accountRouter from '../server/routes/accountRouter';
11-
import adminRouter from '../server/routes/adminRouter';
1210
import apiRouter from '../server/routes/apiRouter';
1311
import commandRouter from '../server/routes/commandRouter';
1412
import signupRouter from '../server/routes/signupRouter';
1513
import loginRouter from '../server/routes/loginRouter';
16-
import dbRouter from '../server/routes/dbRouter';
1714
import initRouter from '../server/routes/initRouter';
1815
import logoutRouter from '../server/routes/logoutRouter';
19-
// import settingsRouter from '../server/routes/settingsRouter';
2016

21-
// app.use('/test', (req, res) => {
22-
// res.status(200).json({
23-
// success: true,
24-
// });
25-
// });
2617

27-
app.use('/account', accountRouter);
2818
app.use('/gapi', apiRouter);
2919
app.use('/api', apiRouter);
3020
app.use('command', commandRouter);
31-
app.use('/db', dbRouter);
3221
app.use('/init', initRouter);
3322
app.use('/login', loginRouter);
3423
app.use('/logout', logoutRouter);
@@ -46,7 +35,7 @@ let testKey;
4635
describe('test test', () => {
4736
test('Get request', async () => {
4837
const res = await request(app)
49-
.get('/gapi/hello');
38+
.get('/gapi/test');
5039
expect(res.body.data).toBe('in hello testing');
5140
expect(res.status).toBe(200)
5241

@@ -80,29 +69,6 @@ describe('uid test', () => {
8069
});
8170
})
8271

83-
// account route
84-
xdescribe('Account Route', () => {
85-
test('Get request', () => {
86-
request(app)
87-
.get('/account')
88-
.expect('Content-Type', 'application/json; charset=utf-8')
89-
.expect(200)
90-
.expect(response);
91-
});
92-
});
93-
94-
95-
// admin route
96-
xdescribe('Admin Route', () => {
97-
test('Get request', () => {
98-
request(app)
99-
.get('/admin')
100-
.expect('Content-Type', 'application/json; charset=utf-8')
101-
.expect(200)
102-
.expect(response);
103-
});
104-
});
105-
10672
// api route
10773
xdescribe('Api Route', () => {
10874
test('Get request', () => {
@@ -125,17 +91,6 @@ xdescribe('Command Route', () => {
12591
});
12692
});
12793

128-
// db route
129-
xdescribe('Db Route', () => {
130-
test('Get request', () => {
131-
request(app)
132-
.get('/db')
133-
.expect('Content-Type', 'application/json; charset=utf-8')
134-
.expect(200)
135-
.expect(response);
136-
});
137-
});
138-
13994
// init route
14095
xdescribe('Init Route', () => {
14196
test('Get request', () => {
@@ -169,29 +124,6 @@ xdescribe('Logout Route', () => {
169124
});
170125
});
171126

172-
// setting route
173-
// describe('Settings Route', () => {
174-
// test('Get request should return empty mem, cpu, stopped', async () => {
175-
// await request(app)
176-
// .get('/settings')
177-
// .expect('Content-Type', 'application/json; charset=utf-8')
178-
// .expect(200)
179-
// .expect(response);
180-
// });
181-
// xtest('Post request', async () => {
182-
// await request(app)
183-
// .post('/settings/insert')
184-
// .send({
185-
// container: ['test', 'value'],
186-
// name: 'testname',
187-
// metric: 'hello'
188-
// })
189-
// .expect('Content-Type', 'application/json; charset=utf-8')
190-
// .expect(200)
191-
// .expect(response);
192-
// });
193-
// });
194-
195127
// signup route
196128
// describe('Signup Route', () => {
197129
// test('get request', async () => {

assets/.DS_Store

0 Bytes
Binary file not shown.

imageConfigs/postgres/init.sql

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,11 @@
1-
-- CREATE TABLE roles (
2-
-- _id SERIAL NOT NULL,
3-
-- role VARCHAR (255) NOT NULL,
4-
-- PRIMARY KEY (_id)
5-
-- ) WITH (
6-
-- OIDS = FALSE
7-
-- );
8-
91
CREATE TABLE users (
102
_id SERIAL NOT NULL,
113
username VARCHAR (255) UNIQUE NOT NULL,
12-
email VARCHAR (255),
134
password VARCHAR (255) NOT NULL,
14-
phone VARCHAR (255),
15-
-- role VARCHAR (255) DEFAULT 'user',
16-
-- role_id INTEGER DEFAULT 3,
17-
contact_pref VARCHAR (255),
185
mem_threshold INTEGER DEFAULT 80,
196
cpu_threshold INTEGER DEFAULT 80,
207
container_stops BOOLEAN DEFAULT true,
218
PRIMARY KEY (_id),
22-
-- FOREIGN KEY (role_id) REFERENCES Roles(_id)
239
) WITH (
2410
OIDS = FALSE
2511
);
@@ -44,25 +30,15 @@ CREATE TABLE containers (
4430
CONSTRAINT unique_id UNIQUE(id)
4531
);
4632

47-
CREATE TABLE notification_settings (
48-
id SERIAL PRIMARY KEY,
49-
metric_name TEXT NOT NULL,
50-
triggering_value INT,
51-
CONSTRAINT unique_name UNIQUE(metric_name)
52-
);
33+
-- CREATE TABLE notification_settings (
34+
-- id SERIAL PRIMARY KEY,
35+
-- metric_name TEXT NOT NULL,
36+
-- triggering_value INT,
37+
-- CONSTRAINT unique_name UNIQUE(metric_name)
38+
-- );
5339

5440
CREATE TABLE container_settings (
5541
container_id TEXT REFERENCES containers(id),
5642
notification_settings_id INT REFERENCES notification_settings(id),
5743
CONSTRAINT container_setting PRIMARY KEY(container_id, notification_settings_id)
5844
);
59-
60-
INSERT INTO notification_settings (metric_name, triggering_value) VALUES
61-
('memory', 80),
62-
('cpu', 80),
63-
('stopped', 0);
64-
65-
-- INSERT INTO roles (role) VALUES
66-
-- ('system admin'),
67-
-- ('admin'),
68-
-- ('user');

security/sysadmin.js

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

server/app.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,8 @@ exec(
3131
);
3232

3333
// Importing routers...
34-
import accountRouter from './routes/accountRouter';
35-
// import adminRouter from './routes/adminRouter';
3634
import apiRouter from './routes/apiRouter';
3735
import commandRouter from './routes/commandRouter';
38-
import dbRouter from './routes/dbRouter';
3936
import initRouter from './routes/initRouter';
4037
import loginRouter from './routes/loginRouter';
4138
import logoutRouter from './routes/logoutRouter';
@@ -49,23 +46,18 @@ app.use(express.static('SetupApp'));
4946

5047

5148
// Defining routers...
52-
5349
app.use('/k8', (req: Request, res: Response) => {
5450
res.status(200).sendFile(path.join(__dirname, '../SetupApp/index.html'));
5551
});
5652

5753

58-
app.use('/account', accountRouter);
5954
app.use('/gapi', apiRouter);
6055
app.use('/command', commandRouter);
61-
app.use('/db', dbRouter);
6256
app.use('/init', initRouter);
6357
app.use('/login', loginRouter);
6458
app.use('/logout', logoutRouter);
6559
app.use('/setup', setupRouter);
6660
app.use('/signup', signupRouter);
67-
// app.use('/admin', adminRouter);
68-
// app.use('/api', apiRouter);
6961

7062
// Handling requests to unknown endpoints...
7163
app.use('/', (req: Request, res: Response): Response => {
@@ -89,5 +81,4 @@ app.get(
8981
}
9082
);
9183

92-
// Exporting app...
9384
export default app;

server/controllers/apiController.ts

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

0 commit comments

Comments
 (0)