@postxl/generator 0.10.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -75,7 +75,7 @@ function generateRepository({ model, meta }) {
75
75
  return `
76
76
  import { Injectable, Logger } from '@nestjs/common'
77
77
  import { DbService, ${model.sourceName} as DbType } from '@${model.schemaConfig.project}/db'
78
- import { format, pluralize, NestedMap } from '@pxl/common'
78
+ import { format, pluralize ${indexes.length === 0 ? '' : ', NestedMap'} } from '@pxl/common'
79
79
 
80
80
  ${imports.generate()}
81
81
 
@@ -173,6 +173,15 @@ export class ${meta.data.repositoryClassName} implements Repository<
173
173
  `}
174
174
  }
175
175
 
176
+ public async deleteAll(): Promise<void> {
177
+ ${model.attributes.inMemoryOnly
178
+ ? ''
179
+ : `
180
+ await this.db.runOnlyOnTestDb(() => this.db.$executeRaw\`DELETE FROM ${model.sourceSchemaName !== undefined ? `"${model.sourceSchemaName}".` : ''}"${model.sourceName}"\`)
181
+ `}
182
+ return this.init()
183
+ }
184
+
176
185
  public get(id: ${model.brandedIdType} | null): ${model.typeName} | null {
177
186
  if (id === null) {
178
187
  return null
@@ -79,7 +79,7 @@ function getModelAttributes(model) {
79
79
  skipDelete: obj.skipDelete || obj.customDelete,
80
80
  inMemoryOnly: obj.inMemoryOnly,
81
81
  description: obj.description,
82
- schema: obj.schema,
82
+ databaseSchema: obj.schema,
83
83
  index: obj.index,
84
84
  }));
85
85
  const result = decoder.safeParse(attributes);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@postxl/generator",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "main": "./dist/generator.js",
5
5
  "typings": "./dist/generator.d.ts",
6
6
  "bin": {