Skip to content

Commit 60805a6

Browse files
chore: wip
1 parent 9139ee6 commit 60805a6

File tree

15 files changed

+45
-33
lines changed

15 files changed

+45
-33
lines changed

storage/framework/core/orm/src/utils.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1809,16 +1809,20 @@ export async function generateModelString(
18091809
18101810
static async get(): Promise<${modelName}Model[]> {
18111811
const instance = new ${modelName}Model(null)
1812-
1813-
let models
18141812
1813+
let models
1814+
18151815
if (instance.hasSelect) {
1816+
${instanceSoftDeleteStatements}
1817+
18161818
models = await instance.selectFromQuery.execute()
18171819
} else {
1820+
${instanceSoftDeleteStatements}
1821+
18181822
models = await instance.selectFromQuery.selectAll().execute()
18191823
}
1820-
1821-
const userModels = await Promise.all(models.map(async (model: ${modelName}Model) => {
1824+
1825+
const data = await Promise.all(models.map(async (model: ${modelName}Model) => {
18221826
${relationDeclare}
18231827
18241828
${relationStringMany}
@@ -1827,7 +1831,7 @@ export async function generateModelString(
18271831
return model
18281832
}))
18291833
1830-
return userModels
1834+
return data
18311835
}
18321836
18331837

storage/framework/orm/src/models/AccessToken.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,11 @@ export class AccessTokenModel {
163163
models = await instance.selectFromQuery.selectAll().execute()
164164
}
165165

166-
const userModels = await Promise.all(models.map(async (model: AccessTokenModel) => {
166+
const data = await Promise.all(models.map(async (model: AccessTokenModel) => {
167167
return model
168168
}))
169169

170-
return userModels
170+
return data
171171
}
172172

173173
// Method to get a AccessToken by criteria

storage/framework/orm/src/models/Deployment.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,15 +189,15 @@ export class DeploymentModel {
189189
models = await instance.selectFromQuery.selectAll().execute()
190190
}
191191

192-
const userModels = await Promise.all(models.map(async (model: DeploymentModel) => {
192+
const data = await Promise.all(models.map(async (model: DeploymentModel) => {
193193
const instance = new DeploymentModel(model as DeploymentType)
194194

195195
model.user = await instance.userBelong()
196196

197197
return model
198198
}))
199199

200-
return userModels
200+
return data
201201
}
202202

203203
// Method to get a Deployment by criteria

storage/framework/orm/src/models/Error.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,11 +167,11 @@ export class ErrorModel {
167167
models = await instance.selectFromQuery.selectAll().execute()
168168
}
169169

170-
const userModels = await Promise.all(models.map(async (model: ErrorModel) => {
170+
const data = await Promise.all(models.map(async (model: ErrorModel) => {
171171
return model
172172
}))
173173

174-
return userModels
174+
return data
175175
}
176176

177177
// Method to get a Error by criteria

storage/framework/orm/src/models/PaymentMethod.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export class PaymentMethodModel {
202202
models = await instance.selectFromQuery.selectAll().execute()
203203
}
204204

205-
const userModels = await Promise.all(models.map(async (model: PaymentMethodModel) => {
205+
const data = await Promise.all(models.map(async (model: PaymentMethodModel) => {
206206
const instance = new PaymentMethodModel(model as PaymentMethodType)
207207

208208
model.transactions = await instance.transactionsHasMany()
@@ -212,7 +212,7 @@ export class PaymentMethodModel {
212212
return model
213213
}))
214214

215-
return userModels
215+
return data
216216
}
217217

218218
// Method to get a PaymentMethod by criteria

storage/framework/orm/src/models/Post.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,15 @@ export class PostModel {
170170
models = await instance.selectFromQuery.selectAll().execute()
171171
}
172172

173-
const userModels = await Promise.all(models.map(async (model: PostModel) => {
173+
const data = await Promise.all(models.map(async (model: PostModel) => {
174174
const instance = new PostModel(model as PostType)
175175

176176
model.user = await instance.userBelong()
177177

178178
return model
179179
}))
180180

181-
return userModels
181+
return data
182182
}
183183

184184
// Method to get a Post by criteria

storage/framework/orm/src/models/Product.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,11 +174,11 @@ export class ProductModel {
174174
models = await instance.selectFromQuery.selectAll().execute()
175175
}
176176

177-
const userModels = await Promise.all(models.map(async (model: ProductModel) => {
177+
const data = await Promise.all(models.map(async (model: ProductModel) => {
178178
return model
179179
}))
180180

181-
return userModels
181+
return data
182182
}
183183

184184
// Method to get a Product by criteria

storage/framework/orm/src/models/Project.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,11 +161,11 @@ export class ProjectModel {
161161
models = await instance.selectFromQuery.selectAll().execute()
162162
}
163163

164-
const userModels = await Promise.all(models.map(async (model: ProjectModel) => {
164+
const data = await Promise.all(models.map(async (model: ProjectModel) => {
165165
return model
166166
}))
167167

168-
return userModels
168+
return data
169169
}
170170

171171
// Method to get a Project by criteria

storage/framework/orm/src/models/Release.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ export class ReleaseModel {
152152
models = await instance.selectFromQuery.selectAll().execute()
153153
}
154154

155-
const userModels = await Promise.all(models.map(async (model: ReleaseModel) => {
155+
const data = await Promise.all(models.map(async (model: ReleaseModel) => {
156156
return model
157157
}))
158158

159-
return userModels
159+
return data
160160
}
161161

162162
// Method to get a Release by criteria

storage/framework/orm/src/models/Subscriber.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ export class SubscriberModel {
152152
models = await instance.selectFromQuery.selectAll().execute()
153153
}
154154

155-
const userModels = await Promise.all(models.map(async (model: SubscriberModel) => {
155+
const data = await Promise.all(models.map(async (model: SubscriberModel) => {
156156
return model
157157
}))
158158

159-
return userModels
159+
return data
160160
}
161161

162162
// Method to get a Subscriber by criteria

storage/framework/orm/src/models/SubscriberEmail.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,17 +164,25 @@ export class SubscriberEmailModel {
164164
let models
165165

166166
if (instance.hasSelect) {
167+
if (instance.softDeletes) {
168+
query = query.where('deleted_at', 'is', null)
169+
}
170+
167171
models = await instance.selectFromQuery.execute()
168172
}
169173
else {
174+
if (instance.softDeletes) {
175+
query = query.where('deleted_at', 'is', null)
176+
}
177+
170178
models = await instance.selectFromQuery.selectAll().execute()
171179
}
172180

173-
const userModels = await Promise.all(models.map(async (model: SubscriberEmailModel) => {
181+
const data = await Promise.all(models.map(async (model: SubscriberEmailModel) => {
174182
return model
175183
}))
176184

177-
return userModels
185+
return data
178186
}
179187

180188
// Method to get a SubscriberEmail by criteria

storage/framework/orm/src/models/Subscription.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,15 @@ export class SubscriptionModel {
198198
models = await instance.selectFromQuery.selectAll().execute()
199199
}
200200

201-
const userModels = await Promise.all(models.map(async (model: SubscriptionModel) => {
201+
const data = await Promise.all(models.map(async (model: SubscriptionModel) => {
202202
const instance = new SubscriptionModel(model as SubscriptionType)
203203

204204
model.user = await instance.userBelong()
205205

206206
return model
207207
}))
208208

209-
return userModels
209+
return data
210210
}
211211

212212
// Method to get a Subscription by criteria

storage/framework/orm/src/models/Team.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,11 +177,11 @@ export class TeamModel {
177177
models = await instance.selectFromQuery.selectAll().execute()
178178
}
179179

180-
const userModels = await Promise.all(models.map(async (model: TeamModel) => {
180+
const data = await Promise.all(models.map(async (model: TeamModel) => {
181181
return model
182182
}))
183183

184-
return userModels
184+
return data
185185
}
186186

187187
// Method to get a Team by criteria

storage/framework/orm/src/models/Transaction.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ export class TransactionModel {
202202
models = await instance.selectFromQuery.selectAll().execute()
203203
}
204204

205-
const userModels = await Promise.all(models.map(async (model: TransactionModel) => {
205+
const data = await Promise.all(models.map(async (model: TransactionModel) => {
206206
const instance = new TransactionModel(model as TransactionType)
207207

208208
model.user = await instance.userBelong()
@@ -212,7 +212,7 @@ export class TransactionModel {
212212
return model
213213
}))
214214

215-
return userModels
215+
return data
216216
}
217217

218218
// Method to get a Transaction by criteria

storage/framework/orm/src/models/User.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ export class UserModel {
226226
models = await instance.selectFromQuery.selectAll().execute()
227227
}
228228

229-
const userModels = await Promise.all(models.map(async (model: UserModel) => {
229+
const data = await Promise.all(models.map(async (model: UserModel) => {
230230
const instance = new UserModel(model as UserType)
231231

232232
model.deployments = await instance.deploymentsHasMany()
@@ -240,7 +240,7 @@ export class UserModel {
240240
return model
241241
}))
242242

243-
return userModels
243+
return data
244244
}
245245

246246
// Method to get a User by criteria

0 commit comments

Comments
 (0)