@@ -104,11 +104,11 @@ export class PostgresStorageAdapter {
104104 } ;
105105
106106 classExists ( name ) {
107- return Promise . reject ( 'Not implented yet.' )
107+ return Promise . reject ( 'Not implemented yet.' )
108108 }
109109
110110 setClassLevelPermissions ( className , CLPs ) {
111- return Promise . reject ( 'Not implented yet.' )
111+ return Promise . reject ( 'Not implemented yet.' )
112112 }
113113
114114 createClass ( className , schema ) {
@@ -136,7 +136,7 @@ export class PostgresStorageAdapter {
136136 }
137137
138138 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!
140140 return this . _client . query ( 'ALTER TABLE $<className:name> ADD COLUMN $<fieldName:name> $<postgresType:raw>' , { className, fieldName, postgresType : parseTypeToPostgresType ( type ) } )
141141 . catch ( error => {
142142 if ( error . code === PostgresRelationDoesNotExistError ) {
@@ -165,10 +165,10 @@ export class PostgresStorageAdapter {
165165 // Drops a collection. Resolves with true if it was a Parse Schema (eg. _User, Custom, etc.)
166166 // and resolves with false if it wasn't (eg. a join table). Rejects if deletion was impossible.
167167 deleteClass ( className ) {
168- return Promise . reject ( 'Not implented yet.' )
168+ return Promise . reject ( 'Not implemented yet.' )
169169 }
170170
171- // Delete all data known to this adatper . Used for testing.
171+ // Delete all data known to this adapter . Used for testing.
172172 deleteAllClasses ( ) {
173173 return this . _client . query ( 'SELECT "className" FROM "_SCHEMA"' )
174174 . then ( results => {
@@ -192,29 +192,21 @@ export class PostgresStorageAdapter {
192192 // deleted do not exist, this function should return successfully anyways. Checking for
193193 // attempts to delete non-existent fields is the responsibility of Parse Server.
194194
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-
202195 // This function is not obligated to delete fields atomically. It is given the field
203196 // names in a list so that databases that are capable of deleting fields atomically
204197 // may do so.
205198
206199 // Returns a Promise.
207200 deleteFields ( className , schema , fieldNames ) {
208- return Promise . reject ( 'Not implented yet.' )
201+ return Promise . reject ( 'Not implemented yet.' )
209202 }
210203
211204 // 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
213206 // rejection reason are TBD.
214207 getAllClasses ( ) {
215208 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 } ) ) ;
218210 }
219211
220212 // Return a promise for the schema with the given name, in Parse format. If
@@ -280,7 +272,7 @@ export class PostgresStorageAdapter {
280272
281273 // Apply the update to all objects that match the given Parse Query.
282274 updateObjectsByQuery ( className , schema , query , update ) {
283- return Promise . reject ( 'Not implented yet.' )
275+ return Promise . reject ( 'Not implemented yet.' )
284276 }
285277
286278 // Return value not currently well specified.
@@ -310,14 +302,12 @@ export class PostgresStorageAdapter {
310302
311303 let qs = `UPDATE $1:name SET ${ updatePatterns . join ( ',' ) } WHERE ${ where . pattern } RETURNING *` ;
312304 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;
316306 }
317307
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.
319309 upsertOneObject ( className , schema , query , update ) {
320- return Promise . reject ( 'Not implented yet.' )
310+ return Promise . reject ( 'Not implemented yet.' )
321311 }
322312
323313 find ( className , schema , query , { skip, limit, sort } ) {
@@ -369,9 +359,9 @@ export class PostgresStorageAdapter {
369359 return this . _client . query ( qs , [ className , constraintName , ...fieldNames ] )
370360 }
371361
372- // Executs a count.
362+ // Executes a count.
373363 count ( className , schema , query ) {
374- return Promise . reject ( 'Not implented yet.' )
364+ return Promise . reject ( 'Not implemented yet.' )
375365 }
376366}
377367
0 commit comments