Skip to content

Commit ca22411

Browse files
committed
Fix remove collection model
1 parent 95703cc commit ca22411

File tree

23 files changed

+230
-195
lines changed

23 files changed

+230
-195
lines changed

package-lock.json

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@
5959
"@angular/platform-browser": "^20.2.0",
6060
"@angular/router": "^20.2.0",
6161
"@schematics/angular": "^20.3.7",
62+
"prettier": "^3.6.2",
6263
"rxjs": "~7.8.0",
6364
"tslib": "^2.3.0"
6465
},
@@ -77,7 +78,6 @@
7778
"karma-jasmine": "~5.1.0",
7879
"karma-jasmine-html-reporter": "~2.1.0",
7980
"ng-packagr": "^20.2.0",
80-
"prettier": "^3.6.2",
8181
"typescript": "~5.9.2"
8282
}
8383
}

projects/angular-odata/schematics/apigen/angular/api-config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export class ApiConfig extends Base {
1919
version: this.options.version,
2020
creation: this.options.creation,
2121
models: this.pkg.models,
22-
collections: this.pkg.collections
22+
collections: this.pkg.collections,
2323
};
2424
}
2525
public override name() {
@@ -36,8 +36,8 @@ export class ApiConfig extends Base {
3636
}
3737
public override importTypes(): string[] {
3838
const imports = [
39-
...this.pkg.models.map(m => m.fullName()),
40-
...this.pkg.collections.map(c => c.fullName())
39+
...this.pkg.models.map((m) => m.fullName()),
40+
...this.pkg.collections.map((c) => c.fullName()),
4141
];
4242
return imports;
4343
}

projects/angular-odata/schematics/apigen/angular/base.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,9 @@ export class Callable {
176176
const { required, optional } = this.parameters();
177177
const parameters = [...required, ...optional];
178178
const returnType = this.returnType();
179-
const callableNamespaceQualifiedName = this.callable.IsBound ? this.callable.fullName() : this.callable.Name;
179+
const callableNamespaceQualifiedName = this.callable.IsBound
180+
? this.callable.fullName()
181+
: this.callable.Name;
180182

181183
const methodName = strings.camelize(this.callable.Name);
182184
const responseType =
@@ -219,7 +221,7 @@ export class Callable {
219221

220222
let types = 'null';
221223
if (parameters.length > 0) {
222-
types = `{${args.join(', ')}}`;
224+
types = `{${args.join(', ')}}`;
223225
}
224226

225227
// Render
@@ -232,7 +234,8 @@ export class Callable {
232234
export abstract class Base {
233235
constructor(
234236
protected pkg: Package,
235-
protected options: ApiGenSchema) {}
237+
protected options: ApiGenSchema,
238+
) {}
236239

237240
public abstract name(): string;
238241
public abstract fileName(): string;
@@ -366,7 +369,7 @@ export class Metadata extends Base {
366369
findEntityType(fullName: string) {
367370
return this.meta.findEntityType(fullName);
368371
}
369-
372+
370373
findComplexType(fullName: string) {
371374
return this.meta.findComplexType(fullName);
372375
}

projects/angular-odata/schematics/apigen/angular/collection.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export class Collection extends Base {
1313
options: ApiGenSchema,
1414
protected edmType: CsdlEntityType | CsdlComplexType,
1515
protected entity: Entity,
16-
protected model: Model
16+
protected model: Model,
1717
) {
1818
super(pkg, options);
1919
}
@@ -36,22 +36,19 @@ export class Collection extends Base {
3636
};
3737
}
3838
public override name() {
39-
return strings.classify(this.edmType.name()) + "Collection";
39+
return strings.classify(this.edmType.name()) + 'Collection';
4040
}
4141
public override fileName() {
42-
return (strings.dasherize(this.edmType.name()) + '.collection');
42+
return strings.dasherize(this.edmType.name()) + '.collection';
4343
}
4444
public override directory() {
4545
return this.edmType.namespace().replace(/\./g, '/');
4646
}
4747
public override fullName() {
48-
return this.edmType.fullName() + "Collection";
48+
return this.edmType.fullName() + 'Collection';
4949
}
5050
public override importTypes(): string[] {
51-
const imports = [
52-
this.entity.fullName(),
53-
this.model.fullName()
54-
];
51+
const imports = [this.entity.fullName(), this.model.fullName()];
5552
if (this.edmType.BaseType) {
5653
imports.push(this.edmType.BaseType);
5754
imports.push(this.edmType.BaseType + 'Collection');

projects/angular-odata/schematics/apigen/angular/entity.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ import { toTypescriptType } from '../utils';
88
import { Package } from './package';
99

1010
export class EntityProperty {
11-
constructor(protected entity: Entity, protected edmType: CsdlProperty | CsdlNavigationProperty) {}
11+
constructor(
12+
protected entity: Entity,
13+
protected edmType: CsdlProperty | CsdlNavigationProperty,
14+
) {}
1215

1316
name() {
1417
const required = !(this.edmType instanceof CsdlNavigationProperty || this.edmType.Nullable);
@@ -20,9 +23,8 @@ export class EntityProperty {
2023
const pkg = this.entity.getPackage();
2124
const enumType = pkg.findEnum(this.edmType.Type);
2225
const entityType = pkg.findEntity(this.edmType.Type);
23-
let type = "any";
24-
if (enumType !== undefined)
25-
{
26+
let type = 'any';
27+
if (enumType !== undefined) {
2628
type = enumType.importedName!;
2729
type += this.edmType.Collection ? '[]' : '';
2830
} else if (entityType !== undefined) {
@@ -36,7 +38,9 @@ export class EntityProperty {
3638
}
3739

3840
isGeoSpatial(): boolean {
39-
return this.edmType.Type.startsWith('Edm.Geography') || this.edmType.Type.startsWith('Edm.Geometry');
41+
return (
42+
this.edmType.Type.startsWith('Edm.Geography') || this.edmType.Type.startsWith('Edm.Geometry')
43+
);
4044
}
4145
}
4246

0 commit comments

Comments
 (0)