generated from Ed-Fi-Exchange-OSS/Template-for-GitHub
-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BIA-563] PostgreSQL backend SqlHelper functions should directly retu…
…rn typed results rather than strings (#258) * [BIA-563] PostgreSQL backend SqlHelper functions should directly return typed results rather than strings Update sqlHelper to execute sql queries and return an object with the result. Update references to use the new result instead of execute the sql string. Update tests. * Update function to return an array of blockingDocument * Replace BlockingDocument by ReferringDocumentInfo * Update validations * Update transaction * Remove validation * Update insert, update and delete to execute sql from sql helper * Update sqlHelper to avoid returning sql scripts as string. * Rename MeadowlarkAlias to MeadowlarkDocumentAndAliasId * Update SqlHelper Update function name to remove execute prefix. Update internal documentation
- Loading branch information
1 parent
821ba85
commit 5e5e469
Showing
30 changed files
with
703 additions
and
466 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
Meadowlark-js/backends/meadowlark-postgresql-backend/src/model/MeadowlarkDocument.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Licensed to the Ed-Fi Alliance under one or more agreements. | ||
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. | ||
// See the LICENSE and NOTICES files in the project root for more information. | ||
|
||
import { DocumentIdentity, MeadowlarkId, NoDocumentIdentity, DocumentUuid } from '@edfi/meadowlark-core'; | ||
|
||
export interface MeadowlarkDocumentId { | ||
/** | ||
* A string hash derived from the project name, resource name | ||
* and identity of the API document. This field replaces the built-in MongoDB _id. | ||
*/ | ||
meadowlark_id: MeadowlarkId; | ||
/** | ||
* The UUID for the document. | ||
*/ | ||
document_uuid: DocumentUuid; | ||
} | ||
|
||
export interface MeadowlarkDocument extends MeadowlarkDocumentId { | ||
/** | ||
* The identity elements extracted from the API document. | ||
*/ | ||
document_identity: DocumentIdentity; | ||
|
||
/** | ||
* The MetaEd project name the API document resource is defined in e.g. "EdFi" for a data standard entity. | ||
*/ | ||
project_name: string; | ||
|
||
/** | ||
* The name of the resource. Typically, this is the same as the corresponding MetaEd entity name. However, | ||
* there are exceptions, for example descriptors have a "Descriptor" suffix on their resource name. | ||
*/ | ||
resource_name: string; | ||
|
||
/** | ||
* The resource version as a string. This is the same as the MetaEd project version | ||
* the entity is defined in e.g. "3.3.1-b" for a 3.3b data standard entity. | ||
*/ | ||
resource_version: string; | ||
|
||
/** | ||
* The Ed-Fi ODS/API document itself. | ||
*/ | ||
edfi_doc: any; | ||
|
||
/** | ||
* True if this document has been reference and descriptor validated. | ||
*/ | ||
validated: boolean; | ||
|
||
/** | ||
* True if this document is a descriptor. | ||
*/ | ||
is_descriptor: boolean; | ||
|
||
/** | ||
* Creator of this document | ||
*/ | ||
created_by: string; | ||
} | ||
|
||
/** | ||
* Creates a new empty newMeadowlarkDocument object | ||
*/ | ||
export function newMeadowlarkDocument(): MeadowlarkDocument { | ||
return { | ||
meadowlark_id: undefined as unknown as MeadowlarkId, | ||
document_uuid: undefined as unknown as DocumentUuid, | ||
document_identity: NoDocumentIdentity, | ||
project_name: '', | ||
resource_name: '', | ||
resource_version: '', | ||
edfi_doc: null, | ||
validated: false, | ||
is_descriptor: false, | ||
created_by: '', | ||
}; | ||
} | ||
|
||
/** | ||
* The null object for DocumentInfo | ||
*/ | ||
export const NoMeadowlarkDocument = Object.freeze({ | ||
...newMeadowlarkDocument(), | ||
}); | ||
|
||
export function isMeadowlarkDocumentEmpty(meadowlarkDocument: MeadowlarkDocument): boolean { | ||
const noMeadowlarkDocument = NoMeadowlarkDocument; | ||
return meadowlarkDocument === noMeadowlarkDocument; | ||
} |
14 changes: 14 additions & 0 deletions
14
...wlark-js/backends/meadowlark-postgresql-backend/src/model/MeadowlarkDocumentAndAliasId.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// Licensed to the Ed-Fi Alliance under one or more agreements. | ||
// The Ed-Fi Alliance licenses this file to you under the Apache License, Version 2.0. | ||
// See the LICENSE and NOTICES files in the project root for more information. | ||
|
||
import { MeadowlarkId } from '@edfi/meadowlark-core'; | ||
import { MeadowlarkDocumentId } from './MeadowlarkDocument'; | ||
|
||
export interface MeadowlarkDocumentAndAliasId extends MeadowlarkDocumentId { | ||
/** | ||
* Alias meadowlarkId. | ||
*/ | ||
alias_meadowlark_id: MeadowlarkId; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.