Skip to content

Commit

Permalink
fix: added more table metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
asllanmakaj7 committed Apr 30, 2024
1 parent c531339 commit 5f97640
Show file tree
Hide file tree
Showing 5 changed files with 282 additions and 36 deletions.
12 changes: 12 additions & 0 deletions src/ComponentFramework-Mock-Generator/Metadata.db/Metadata.db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,10 @@ export class MetadataDB {
PrimaryIdAttribute: metadata.PrimaryIdAttribute,
PrimaryNameAttribute: metadata.PrimaryNameAttribute,
PrimaryImageAttribute: metadata.PrimaryImageAttribute,
DisplayName: metadata.DisplayName,
DisplayCollectionName: metadata.DisplayCollectionName,
LogicalCollectionName: metadata.LogicalCollectionName,
Description: metadata.Description,
});

const columns: string[] = [];
Expand Down Expand Up @@ -275,6 +279,10 @@ export class MetadataDB {
PrimaryIdAttribute: tableMetadataDB[0].PrimaryIdAttribute,
PrimaryNameAttribute: tableMetadataDB[0].PrimaryNameAttribute,
PrimaryImageAttribute: tableMetadataDB[0].PrimaryImageAttribute,
DisplayName: tableMetadataDB[0].DisplayName,
DisplayCollectionName: tableMetadataDB[0].DisplayCollectionName,
LogicalCollectionName: tableMetadataDB[0].LogicalCollectionName,
Description: tableMetadataDB[0].Description,
} as ShkoOnline.EntityMetadata;

var resultDB = this.AttributeMetadataSQL.SelectAttributeMetadata(attribute, entity);
Expand Down Expand Up @@ -323,6 +331,10 @@ export class MetadataDB {
PrimaryIdAttribute: tableMetadataDB[0].PrimaryIdAttribute,
PrimaryNameAttribute: tableMetadataDB[0].PrimaryNameAttribute,
PrimaryImageAttribute: tableMetadataDB[0].PrimaryImageAttribute,
DisplayName: tableMetadataDB[0].DisplayName,
DisplayCollectionName: tableMetadataDB[0].DisplayCollectionName,
LogicalCollectionName: tableMetadataDB[0].LogicalCollectionName,
Description: tableMetadataDB[0].Description,
} as ShkoOnline.EntityMetadata;

const attributesDB = this.AttributeMetadataSQL.SelectAttributeMetadataForTable(entity);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,20 @@ export const CREATE_TABLE_METADATA_ENTITY = `
EntitySetName string,
PrimaryIdAttribute string,
PrimaryNameAttribute string,
PrimaryImageAttribute string
PrimaryImageAttribute string,
DisplayName string,
DisplayCollectionName string,
LogicalCollectionName string,
Description string
)
`;

export const INSERT_METADATA_ENTITY = `
INSERT INTO Metadata__Entity VALUES (
?,
?,
?,
?,
?,
?,
?,
Expand All @@ -34,7 +42,11 @@ export const SELECT_METADATA_ENTITY = `
EntitySetName,
PrimaryIdAttribute,
PrimaryNameAttribute,
PrimaryImageAttribute
PrimaryImageAttribute,
DisplayName,
DisplayCollectionName,
LogicalCollectionName,
Description
FROM
Metadata__Entity
WHERE LogicalName = ?
Expand All @@ -47,7 +59,11 @@ export const SELECT_METADATA_ENTITY_BY_ENTITYSET = `
EntitySetName,
PrimaryIdAttribute,
PrimaryNameAttribute,
PrimaryImageAttribute
PrimaryImageAttribute,
DisplayName,
DisplayCollectionName,
LogicalCollectionName,
Description
FROM
Metadata__Entity
WHERE EntitySetName = ?
Expand All @@ -60,6 +76,10 @@ export interface EntityMetadata {
PrimaryIdAttribute: string;
PrimaryNameAttribute: string;
PrimaryImageAttribute?: string;
DisplayName?: string;
DisplayCollectionName?: string;
LogicalCollectionName?: string;
Description?: string;
}

export class EntityMetadataSQL {
Expand All @@ -76,6 +96,10 @@ export class EntityMetadataSQL {
metadata.PrimaryIdAttribute,
metadata.PrimaryNameAttribute,
metadata.PrimaryImageAttribute,
metadata.DisplayName,
metadata.DisplayCollectionName,
metadata.LogicalCollectionName,
metadata.Description
]);
}
SelectTableMetadata(LogicalName: string) {
Expand Down
Loading

0 comments on commit 5f97640

Please sign in to comment.