1
1
import { generateProjectId } from '../utils/utils' ;
2
- import { ProjectEntity } from '../models/project' ;
2
+ import { OldVersion , ProjectEntity } from '../models/project' ;
3
3
import { cassandraClient } from './cassandra/cassandraClient' ;
4
4
5
5
import { ProjectDao } from './projectDao' ;
@@ -10,9 +10,11 @@ export class CassandraProjectDaoImpl implements ProjectDao {
10
10
const query = `INSERT INTO projects (id, display_name, version, json, git_platform_name, git_platform_user_name,
11
11
is_repository_public, repository_branch, repository_name, owner_email,
12
12
repository_url,
13
+ metadata,
14
+ old_versions,
13
15
created_at, updated_at)
14
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) IF NOT EXISTS` ;
15
- const params = [ projectEntity . id , projectEntity . display_name , projectEntity . version , projectEntity . json , projectEntity . git_platform_name , projectEntity . git_platform_user_name , projectEntity . is_repository_public , projectEntity . repository_branch , projectEntity . repository_name , projectEntity . owner_email , projectEntity . repository_url , projectEntity . created_at , projectEntity . updated_at ] ;
16
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) IF NOT EXISTS` ;
17
+ const params = [ projectEntity . id , projectEntity . display_name , projectEntity . version , projectEntity . json , projectEntity . git_platform_name , projectEntity . git_platform_user_name , projectEntity . is_repository_public , projectEntity . repository_branch , projectEntity . repository_name , projectEntity . owner_email , projectEntity . repository_url , projectEntity . metadata , projectEntity . created_at , projectEntity . updated_at ] ;
16
18
const resultSet = await cassandraClient . execute ( query , params , { prepare : true } ) ;
17
19
if ( resultSet . wasApplied ( ) ) {
18
20
return projectEntity ;
@@ -29,6 +31,8 @@ export class CassandraProjectDaoImpl implements ProjectDao {
29
31
repository_name : '' ,
30
32
repository_url : '' ,
31
33
owner_email : '' ,
34
+ metadata : '' ,
35
+ old_versions : [ ] ,
32
36
created_at : '' ,
33
37
updated_at : '' ,
34
38
} ;
@@ -55,6 +59,10 @@ export class CassandraProjectDaoImpl implements ProjectDao {
55
59
json : row . json ,
56
60
owner_email : row . owner_email ,
57
61
repository_url : row . repository_url ,
62
+ metadata : row . metadata ,
63
+ old_versions : row . old_versions ? row . old_versions . map ( ( oldVersion : OldVersion ) => {
64
+ return oldVersion ;
65
+ } ) : [ ] ,
58
66
created_at : row . created_at ,
59
67
updated_at : row . updated_at ,
60
68
} ;
@@ -84,6 +92,8 @@ export class CassandraProjectDaoImpl implements ProjectDao {
84
92
repository_name : '' ,
85
93
repository_url : '' ,
86
94
owner_email : '' ,
95
+ metadata : '' ,
96
+ old_versions : [ ] ,
87
97
created_at : '' ,
88
98
updated_at : '' ,
89
99
} ;
@@ -101,6 +111,10 @@ export class CassandraProjectDaoImpl implements ProjectDao {
101
111
json : row . json ,
102
112
repository_url : row . repository_url ,
103
113
owner_email : row . owner_email ,
114
+ metadata : row . metadata ,
115
+ old_versions : row . old_versions ? row . old_versions . map ( ( oldVersion : OldVersion ) => {
116
+ return oldVersion ;
117
+ } ) : [ ] ,
104
118
created_at : row . created_at ,
105
119
updated_at : row . updated_at ,
106
120
} ;
@@ -111,9 +125,11 @@ export class CassandraProjectDaoImpl implements ProjectDao {
111
125
SET display_name = ?,
112
126
version = ?,
113
127
json = ?,
128
+ metadata = ?,
129
+ old_versions = ?,
114
130
updated_at = ?
115
131
WHERE id = ? IF EXISTS` ;
116
- const params = [ projectEntity . display_name , projectEntity . version , projectEntity . json , projectEntity . updated_at , id ] ;
132
+ const params = [ projectEntity . display_name , projectEntity . version , projectEntity . json , projectEntity . metadata , projectEntity . old_versions , projectEntity . updated_at , id ] ;
117
133
const resultSet = await cassandraClient . execute ( query , params , { prepare : true } ) ;
118
134
return resultSet . wasApplied ( ) ;
119
135
}
0 commit comments