Skip to content

Commit ff00a39

Browse files
chore: wip
1 parent d139ac7 commit ff00a39

File tree

12 files changed

+50
-59
lines changed

12 files changed

+50
-59
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ export async function writeModelRequest(): Promise<void> {
252252
let fieldStringType = ``
253253
let fieldString = ``
254254
let fieldStringInt = ``
255-
let fileString = `import { Request } from '@stacksjs/router'\nimport type { VineType } from '@stacksjs/types'\nimport { validateField } from '@stacksjs/validation'\nimport { customValidate } from '@stacksjs/validation'\n\n`
255+
let fileString = `import { Request } from '@stacksjs/router'\nimport { validateField } from '@stacksjs/validation'\nimport { customValidate } from '@stacksjs/validation'\n\n`
256256

257257
const modeFileElement = modelFiles[i] as string
258258
const model = (await import(modeFileElement)).default as Model
@@ -261,7 +261,7 @@ export async function writeModelRequest(): Promise<void> {
261261
const useSoftDeletes = model?.traits?.useSoftDeletes ?? model?.traits?.softDeletable ?? false
262262
const attributes = await extractFields(model, modeFileElement)
263263

264-
fieldString += ` id?: number\n`
264+
fieldString += ` id: number\n`
265265
fieldStringInt += `public id = 1\n`
266266

267267
let keyCounter = 0
@@ -309,8 +309,8 @@ export async function writeModelRequest(): Promise<void> {
309309
}
310310

311311
if (useTimestamps) {
312-
fieldStringInt += `public created_at = ''
313-
public updated_at = ''
312+
fieldStringInt += `public created_at = new Date
313+
public updated_at = new Date
314314
`
315315
}
316316

storage/framework/core/router/src/request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export class Request<T extends RequestData = RequestData> implements RequestInst
4141
this.headers = headerParams
4242
}
4343

44-
public get(element: string): string | number | undefined {
44+
public get(element: string): any {
4545
return this.query[element]
4646
}
4747

storage/framework/requests/AccessTokenRequest.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Request } from '@stacksjs/router'
2-
import type { VineType } from '@stacksjs/types'
32
import { validateField } from '@stacksjs/validation'
43
import { customValidate } from '@stacksjs/validation'
54

@@ -14,7 +13,7 @@ interface CustomAttributes {
1413
[key: string]: ValidationField
1514
}
1615
interface RequestDataAccessToken {
17-
id?: number
16+
id: number
1817
name: string
1918
token: string
2019
plain_text_token: string
@@ -31,8 +30,8 @@ export class AccessTokenRequest extends Request<RequestDataAccessToken> implemen
3130
public plain_text_token = ''
3231
public abilities = ''
3332
public team_id = 0
34-
public created_at = ''
35-
public updated_at = ''
33+
public created_at = new Date()
34+
public updated_at = new Date()
3635

3736
public async validate(attributes?: CustomAttributes): Promise<void> {
3837
if (attributes === undefined || attributes === null) {

storage/framework/requests/DeploymentRequest.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Request } from '@stacksjs/router'
2-
import type { VineType } from '@stacksjs/types'
32
import { validateField } from '@stacksjs/validation'
43
import { customValidate } from '@stacksjs/validation'
54

@@ -14,7 +13,7 @@ interface CustomAttributes {
1413
[key: string]: ValidationField
1514
}
1615
interface RequestDataDeployment {
17-
id?: number
16+
id: number
1817
commit_sha: string
1918
commit_message: string
2019
branch: string
@@ -37,8 +36,8 @@ export class DeploymentRequest extends Request<RequestDataDeployment> implements
3736
public deploy_script = ''
3837
public terminal_output = ''
3938
public user_id = 0
40-
public created_at = ''
41-
public updated_at = ''
39+
public created_at = new Date()
40+
public updated_at = new Date()
4241

4342
public async validate(attributes?: CustomAttributes): Promise<void> {
4443
if (attributes === undefined || attributes === null) {

storage/framework/requests/PostRequest.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Request } from '@stacksjs/router'
2-
import type { VineType } from '@stacksjs/types'
32
import { validateField } from '@stacksjs/validation'
43
import { customValidate } from '@stacksjs/validation'
54

@@ -14,7 +13,7 @@ interface CustomAttributes {
1413
[key: string]: ValidationField
1514
}
1615
interface RequestDataPost {
17-
id?: number
16+
id: number
1817
title: string
1918
body: string
2019
user_id: number
@@ -27,8 +26,8 @@ export class PostRequest extends Request<RequestDataPost> implements PostRequest
2726
public title = ''
2827
public body = ''
2928
public user_id = 0
30-
public created_at = ''
31-
public updated_at = ''
29+
public created_at = new Date()
30+
public updated_at = new Date()
3231

3332
public async validate(attributes?: CustomAttributes): Promise<void> {
3433
if (attributes === undefined || attributes === null) {

storage/framework/requests/ProjectRequest.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Request } from '@stacksjs/router'
2-
import type { VineType } from '@stacksjs/types'
32
import { validateField } from '@stacksjs/validation'
43
import { customValidate } from '@stacksjs/validation'
54

@@ -14,7 +13,7 @@ interface CustomAttributes {
1413
[key: string]: ValidationField
1514
}
1615
interface RequestDataProject {
17-
id?: number
16+
id: number
1817
name: string
1918
description: string
2019
url: string
@@ -29,8 +28,8 @@ export class ProjectRequest extends Request<RequestDataProject> implements Proje
2928
public description = ''
3029
public url = ''
3130
public status = ''
32-
public created_at = ''
33-
public updated_at = ''
31+
public created_at = new Date()
32+
public updated_at = new Date()
3433

3534
public async validate(attributes?: CustomAttributes): Promise<void> {
3635
if (attributes === undefined || attributes === null) {

storage/framework/requests/ReleaseRequest.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Request } from '@stacksjs/router'
2-
import type { VineType } from '@stacksjs/types'
32
import { validateField } from '@stacksjs/validation'
43
import { customValidate } from '@stacksjs/validation'
54

@@ -14,7 +13,7 @@ interface CustomAttributes {
1413
[key: string]: ValidationField
1514
}
1615
interface RequestDataRelease {
17-
id?: number
16+
id: number
1817
version: string
1918
created_at?: Date
2019
updated_at?: Date
@@ -23,8 +22,8 @@ interface RequestDataRelease {
2322
export class ReleaseRequest extends Request<RequestDataRelease> implements ReleaseRequestType {
2423
public id = 1
2524
public version = ''
26-
public created_at = ''
27-
public updated_at = ''
25+
public created_at = new Date()
26+
public updated_at = new Date()
2827

2928
public async validate(attributes?: CustomAttributes): Promise<void> {
3029
if (attributes === undefined || attributes === null) {

storage/framework/requests/SubscriberEmailRequest.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Request } from '@stacksjs/router'
2-
import type { VineType } from '@stacksjs/types'
32
import { validateField } from '@stacksjs/validation'
43
import { customValidate } from '@stacksjs/validation'
54

@@ -14,7 +13,7 @@ interface CustomAttributes {
1413
[key: string]: ValidationField
1514
}
1615
interface RequestDataSubscriberEmail {
17-
id?: number
16+
id: number
1817
email: string
1918
created_at?: Date
2019
updated_at?: Date
@@ -23,8 +22,8 @@ interface RequestDataSubscriberEmail {
2322
export class SubscriberEmailRequest extends Request<RequestDataSubscriberEmail> implements SubscriberEmailRequestType {
2423
public id = 1
2524
public email = ''
26-
public created_at = ''
27-
public updated_at = ''
25+
public created_at = new Date()
26+
public updated_at = new Date()
2827

2928
public deleted_at = ''
3029

storage/framework/requests/SubscriberRequest.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Request } from '@stacksjs/router'
2-
import type { VineType } from '@stacksjs/types'
32
import { validateField } from '@stacksjs/validation'
43
import { customValidate } from '@stacksjs/validation'
54

@@ -14,7 +13,7 @@ interface CustomAttributes {
1413
[key: string]: ValidationField
1514
}
1615
interface RequestDataSubscriber {
17-
id?: number
16+
id: number
1817
subscribed: boolean
1918
user_id: number
2019
created_at?: Date
@@ -25,8 +24,8 @@ export class SubscriberRequest extends Request<RequestDataSubscriber> implements
2524
public id = 1
2625
public subscribed = false
2726
public user_id = 0
28-
public created_at = ''
29-
public updated_at = ''
27+
public created_at = new Date()
28+
public updated_at = new Date()
3029

3130
public async validate(attributes?: CustomAttributes): Promise<void> {
3231
if (attributes === undefined || attributes === null) {

storage/framework/requests/TeamRequest.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Request } from '@stacksjs/router'
2-
import type { VineType } from '@stacksjs/types'
32
import { validateField } from '@stacksjs/validation'
43
import { customValidate } from '@stacksjs/validation'
54

@@ -14,7 +13,7 @@ interface CustomAttributes {
1413
[key: string]: ValidationField
1514
}
1615
interface RequestDataTeam {
17-
id?: number
16+
id: number
1817
name: string
1918
company_name: string
2019
email: string
@@ -41,8 +40,8 @@ export class TeamRequest extends Request<RequestDataTeam> implements TeamRequest
4140
public is_personal = false
4241
public accesstoken_id = 0
4342
public user_id = 0
44-
public created_at = ''
45-
public updated_at = ''
43+
public created_at = new Date()
44+
public updated_at = new Date()
4645

4746
public async validate(attributes?: CustomAttributes): Promise<void> {
4847
if (attributes === undefined || attributes === null) {

0 commit comments

Comments
 (0)