Skip to content

Commit a7761ca

Browse files
Robin BuschmannRobin Buschmann
authored andcommitted
plug updated
1 parent 1e47297 commit a7761ca

7 files changed

+161
-0
lines changed

app.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,8 @@ http.createServer(app).listen(
128128
);
129129

130130

131+
// FOR INITIAL DATA IMPORT
132+
// ----------------------------------------------
131133
import {Injector} from 'di-ts';
132134
import {SoapService} from "./services/SoapService";
133135
import {DataImporter} from "./services/DataImporter";
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
'use strict';
2+
3+
var dbm;
4+
var type;
5+
var seed;
6+
7+
/**
8+
* We receive the dbmigrate dependency from dbmigrate initially.
9+
* This enables us to not have to rely on NODE_PATH.
10+
*/
11+
exports.setup = function(options, seedLink) {
12+
dbm = options.dbmigrate;
13+
type = dbm.dataType;
14+
seed = seedLink;
15+
};
16+
17+
exports.up = function(db) {
18+
19+
return db.runSql(`
20+
ALTER TABLE Plug ADD category ENUM('Other', 'Type1', 'Type2', 'CCS_CHAdeMO') NOT NULL;
21+
`);
22+
};
23+
24+
exports.down = function(db) {
25+
return db.runSql(`
26+
ALTER TABLE Plug DROP COLUMN category;
27+
`);
28+
};
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
'use strict';
2+
3+
var dbm;
4+
var type;
5+
var seed;
6+
7+
/**
8+
* We receive the dbmigrate dependency from dbmigrate initially.
9+
* This enables us to not have to rely on NODE_PATH.
10+
*/
11+
exports.setup = function(options, seedLink) {
12+
dbm = options.dbmigrate;
13+
type = dbm.dataType;
14+
seed = seedLink;
15+
};
16+
17+
exports.up = function(db) {
18+
19+
return db.runSql(`
20+
UPDATE Plug
21+
SET category = 'Type1'
22+
WHERE \`option\` IN
23+
(
24+
'Type 1 Connector (Cable Attached)'
25+
);
26+
27+
UPDATE Plug
28+
SET category = 'Type2'
29+
WHERE \`option\` IN
30+
(
31+
'Type 2 Outlet',
32+
'Type 2 Connector (Cable Attached)'
33+
);
34+
35+
UPDATE Plug
36+
SET category = 'CCS_CHAdeMO'
37+
WHERE \`option\` IN
38+
(
39+
'CHAdeMO',
40+
'CCS Combo 2 Plug (Cable Attached)',
41+
'CCS Combo 1 Plug (Cable Attached)'
42+
);
43+
`);
44+
};
45+
46+
exports.down = function(db) {
47+
return db.runSql(`
48+
UPDATE Plug
49+
SET category = 'Other';
50+
`);
51+
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
'use strict';
2+
3+
var dbm;
4+
var type;
5+
var seed;
6+
7+
/**
8+
* We receive the dbmigrate dependency from dbmigrate initially.
9+
* This enables us to not have to rely on NODE_PATH.
10+
*/
11+
exports.setup = function(options, seedLink) {
12+
dbm = options.dbmigrate;
13+
type = dbm.dataType;
14+
seed = seedLink;
15+
};
16+
17+
exports.up = function(db) {
18+
19+
return db.runSql(`
20+
ALTER TABLE Plug ADD label VARCHAR(255) DEFAULT NULL;
21+
`);
22+
};
23+
24+
exports.down = function(db) {
25+
return db.runSql(`
26+
ALTER TABLE Plug DROP COLUMN label;
27+
`);
28+
};
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
'use strict';
2+
3+
var dbm;
4+
var type;
5+
var seed;
6+
7+
/**
8+
* We receive the dbmigrate dependency from dbmigrate initially.
9+
* This enables us to not have to rely on NODE_PATH.
10+
*/
11+
exports.setup = function(options, seedLink) {
12+
dbm = options.dbmigrate;
13+
type = dbm.dataType;
14+
seed = seedLink;
15+
};
16+
17+
exports.up = function(db) {
18+
19+
return db.runSql(`
20+
UPDATE Plug
21+
SET label = 'Type 1'
22+
WHERE \`option\` = 'Type 1 Connector (Cable Attached)';
23+
24+
UPDATE Plug
25+
SET label = 'Type 2 Cable'
26+
WHERE \`option\` = 'Type 2 Connector (Cable Attached)';
27+
28+
UPDATE Plug
29+
SET label = 'CCS 1'
30+
WHERE \`option\` = 'CCS Combo 2 Plug (Cable Attached)';
31+
32+
UPDATE Plug
33+
SET label = 'CCS 2'
34+
WHERE \`option\` = 'CCS Combo 1 Plug (Cable Attached)';
35+
`);
36+
};
37+
38+
exports.down = function(db) {
39+
return db.runSql(`
40+
UPDATE Plug
41+
SET label = NULL;
42+
`);
43+
};

models/LocationCluster.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ export class LocationCluster extends Model<LocationCluster> implements ILocation
4242
@Column({
4343
type: DataType.VIRTUAL,
4444
get() {
45+
46+
// TODO Hier gehört nicht alles hin ;)
47+
4548
const chargingLocations = this.getDataValue('chargingLocations');
4649
const groupCount = chargingLocations.length;
4750
let evses;

models/Plug.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ export class Plug extends Model<Plug> {
1818
@Column
1919
option: string;
2020

21+
@Column
22+
category: string;
23+
24+
@Column
25+
label: string;
26+
2127
@BelongsToMany(() => EVSE, () => EVSEPlug)
2228
evses;
2329

0 commit comments

Comments
 (0)