@@ -104,11 +104,11 @@ export class PostgresStorageAdapter {
104
104
} ;
105
105
106
106
classExists ( name ) {
107
- return Promise . reject ( 'Not implented yet.' )
107
+ return Promise . reject ( 'Not implemented yet.' )
108
108
}
109
109
110
110
setClassLevelPermissions ( className , CLPs ) {
111
- return Promise . reject ( 'Not implented yet.' )
111
+ return Promise . reject ( 'Not implemented yet.' )
112
112
}
113
113
114
114
createClass ( className , schema ) {
@@ -136,7 +136,7 @@ export class PostgresStorageAdapter {
136
136
}
137
137
138
138
addFieldIfNotExists ( className , fieldName , type ) {
139
- // TODO: Doing this in a transaction might be a good idea.
139
+ // TODO: Must be re-done into a transaction!
140
140
return this . _client . query ( 'ALTER TABLE $<className:name> ADD COLUMN $<fieldName:name> $<postgresType:raw>' , { className, fieldName, postgresType : parseTypeToPostgresType ( type ) } )
141
141
. catch ( error => {
142
142
if ( error . code === PostgresRelationDoesNotExistError ) {
@@ -165,10 +165,10 @@ export class PostgresStorageAdapter {
165
165
// Drops a collection. Resolves with true if it was a Parse Schema (eg. _User, Custom, etc.)
166
166
// and resolves with false if it wasn't (eg. a join table). Rejects if deletion was impossible.
167
167
deleteClass ( className ) {
168
- return Promise . reject ( 'Not implented yet.' )
168
+ return Promise . reject ( 'Not implemented yet.' )
169
169
}
170
170
171
- // Delete all data known to this adatper . Used for testing.
171
+ // Delete all data known to this adapter . Used for testing.
172
172
deleteAllClasses ( ) {
173
173
return this . _client . query ( 'SELECT "className" FROM "_SCHEMA"' )
174
174
. then ( results => {
@@ -192,29 +192,21 @@ export class PostgresStorageAdapter {
192
192
// deleted do not exist, this function should return successfully anyways. Checking for
193
193
// attempts to delete non-existent fields is the responsibility of Parse Server.
194
194
195
- // Pointer field names are passed for legacy reasons: the original mongo
196
- // format stored pointer field names differently in the database, and therefore
197
- // needed to know the type of the field before it could delete it. Future database
198
- // adatpers should ignore the pointerFieldNames argument. All the field names are in
199
- // fieldNames, they show up additionally in the pointerFieldNames database for use
200
- // by the mongo adapter, which deals with the legacy mongo format.
201
-
202
195
// This function is not obligated to delete fields atomically. It is given the field
203
196
// names in a list so that databases that are capable of deleting fields atomically
204
197
// may do so.
205
198
206
199
// Returns a Promise.
207
200
deleteFields ( className , schema , fieldNames ) {
208
- return Promise . reject ( 'Not implented yet.' )
201
+ return Promise . reject ( 'Not implemented yet.' )
209
202
}
210
203
211
204
// Return a promise for all schemas known to this adapter, in Parse format. In case the
212
- // schemas cannot be retrieved, returns a promise that rejects. Rquirements for the
205
+ // schemas cannot be retrieved, returns a promise that rejects. Requirements for the
213
206
// rejection reason are TBD.
214
207
getAllClasses ( ) {
215
208
return this . _ensureSchemaCollectionExists ( )
216
- . then ( ( ) => this . _client . query ( 'SELECT * FROM "_SCHEMA"' ) )
217
- . then ( results => results . map ( result => ( { className : result . className , ...result . schema } ) ) )
209
+ . then ( ( ) => this . _client . map ( 'SELECT * FROM "_SCHEMA"' ) , null , row => ( { className : row . className , ...row . schema } ) ) ;
218
210
}
219
211
220
212
// Return a promise for the schema with the given name, in Parse format. If
@@ -280,7 +272,7 @@ export class PostgresStorageAdapter {
280
272
281
273
// Apply the update to all objects that match the given Parse Query.
282
274
updateObjectsByQuery ( className , schema , query , update ) {
283
- return Promise . reject ( 'Not implented yet.' )
275
+ return Promise . reject ( 'Not implemented yet.' )
284
276
}
285
277
286
278
// Return value not currently well specified.
@@ -310,14 +302,12 @@ export class PostgresStorageAdapter {
310
302
311
303
let qs = `UPDATE $1:name SET ${ updatePatterns . join ( ',' ) } WHERE ${ where . pattern } RETURNING *` ;
312
304
return this . _client . query ( qs , values )
313
- . then ( val => {
314
- return val [ 0 ] ;
315
- } )
305
+ . then ( val => val [ 0 ] ) ; // TODO: This is unsafe, verification is needed, or a different query method;
316
306
}
317
307
318
- // Hopefully we can get rid of this. It's only used for config and hooks.
308
+ // Hopefully, we can get rid of this. It's only used for config and hooks.
319
309
upsertOneObject ( className , schema , query , update ) {
320
- return Promise . reject ( 'Not implented yet.' )
310
+ return Promise . reject ( 'Not implemented yet.' )
321
311
}
322
312
323
313
find ( className , schema , query , { skip, limit, sort } ) {
@@ -369,9 +359,9 @@ export class PostgresStorageAdapter {
369
359
return this . _client . query ( qs , [ className , constraintName , ...fieldNames ] )
370
360
}
371
361
372
- // Executs a count.
362
+ // Executes a count.
373
363
count ( className , schema , query ) {
374
- return Promise . reject ( 'Not implented yet.' )
364
+ return Promise . reject ( 'Not implemented yet.' )
375
365
}
376
366
}
377
367
0 commit comments