Skip to content

Commit d2b2c20

Browse files
committed
Removing tags where not used in constructors
1 parent 51ffc1e commit d2b2c20

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/models/Guidance.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { Tag } from "./Tag";
55
export class Guidance extends MySqlModel {
66
public guidanceGroupId: number;
77
public guidanceText?: string;
8-
public tags?: Tag[];
98

109
private static tableName = 'guidance';
1110

@@ -14,7 +13,6 @@ export class Guidance extends MySqlModel {
1413

1514
this.guidanceGroupId = options.guidanceGroupId;
1615
this.guidanceText = options.guidanceText;
17-
this.tags = options.tags;
1816
}
1917

2018
// Check that the Guidance data contains the required fields
@@ -37,7 +35,7 @@ export class Guidance extends MySqlModel {
3735
// First make sure the record is valid
3836
if (await this.isValid()) {
3937
this.prepForSave();
40-
38+
4139
// Save the record and then fetch it
4240
const newId = await Guidance.insert(context, Guidance.tableName, this, 'Guidance.create', ['tags']);
4341
const response = await Guidance.findById('Guidance.create', context, newId);

src/models/VersionedGuidance.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ export class VersionedGuidance extends MySqlModel {
77
public guidanceId?: number;
88
public guidanceText?: string;
99
public tagId: number;
10-
public tags?: Tag[];
1110

1211
private static tableName = 'versionedGuidance';
1312

@@ -18,7 +17,6 @@ export class VersionedGuidance extends MySqlModel {
1817
this.guidanceId = options.guidanceId;
1918
this.guidanceText = options.guidanceText;
2019
this.tagId = options.tagId;
21-
this.tags = options.tags;
2220
}
2321

2422
// Validation to be used prior to saving the record
@@ -43,7 +41,7 @@ export class VersionedGuidance extends MySqlModel {
4341
// First make sure the record is valid
4442
if (await this.isValid()) {
4543
this.prepForSave();
46-
44+
4745
// Save the record and then fetch it
4846
const newId = await VersionedGuidance.insert(context, VersionedGuidance.tableName, this, 'VersionedGuidance.create', ['tags']);
4947
return await VersionedGuidance.findById('VersionedGuidance.create', context, newId);
@@ -78,10 +76,10 @@ export class VersionedGuidance extends MySqlModel {
7876
if (!tagIds || tagIds.length === 0) {
7977
return [];
8078
}
81-
79+
8280
const placeholders = tagIds.map(() => '?').join(', ');
8381
const sql = `
84-
SELECT DISTINCT vg.*
82+
SELECT DISTINCT vg.*
8583
FROM ${VersionedGuidance.tableName} vg
8684
INNER JOIN versionedGuidanceGroups vgg ON vg.versionedGuidanceGroupId = vgg.id
8785
INNER JOIN versionedGuidanceTags vgt ON vg.id = vgt.versionedGuidanceId
@@ -97,10 +95,10 @@ export class VersionedGuidance extends MySqlModel {
9795
if (!tagIds || tagIds.length === 0) {
9896
return [];
9997
}
100-
98+
10199
const placeholders = tagIds.map(() => '?').join(', ');
102100
const sql = `
103-
SELECT DISTINCT vg.*
101+
SELECT DISTINCT vg.*
104102
FROM ${VersionedGuidance.tableName} vg
105103
INNER JOIN versionedGuidanceGroups vgg ON vg.versionedGuidanceGroupId = vgg.id
106104
INNER JOIN guidanceGroups gg ON vgg.guidanceGroupId = gg.id

0 commit comments

Comments
 (0)