File tree Expand file tree Collapse file tree 12 files changed +50
-59
lines changed Expand file tree Collapse file tree 12 files changed +50
-59
lines changed Original file line number Diff line number Diff line change @@ -252,7 +252,7 @@ export async function writeModelRequest(): Promise<void> {
252
252
let fieldStringType = ``
253
253
let fieldString = ``
254
254
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`
256
256
257
257
const modeFileElement = modelFiles [ i ] as string
258
258
const model = ( await import ( modeFileElement ) ) . default as Model
@@ -261,7 +261,7 @@ export async function writeModelRequest(): Promise<void> {
261
261
const useSoftDeletes = model ?. traits ?. useSoftDeletes ?? model ?. traits ?. softDeletable ?? false
262
262
const attributes = await extractFields ( model , modeFileElement )
263
263
264
- fieldString += ` id? : number\n`
264
+ fieldString += ` id: number\n`
265
265
fieldStringInt += `public id = 1\n`
266
266
267
267
let keyCounter = 0
@@ -309,8 +309,8 @@ export async function writeModelRequest(): Promise<void> {
309
309
}
310
310
311
311
if ( useTimestamps ) {
312
- fieldStringInt += `public created_at = ''
313
- public updated_at = ''
312
+ fieldStringInt += `public created_at = new Date
313
+ public updated_at = new Date
314
314
`
315
315
}
316
316
Original file line number Diff line number Diff line change @@ -41,7 +41,7 @@ export class Request<T extends RequestData = RequestData> implements RequestInst
41
41
this . headers = headerParams
42
42
}
43
43
44
- public get ( element : string ) : string | number | undefined {
44
+ public get ( element : string ) : any {
45
45
return this . query [ element ]
46
46
}
47
47
Original file line number Diff line number Diff line change 1
1
import { Request } from '@stacksjs/router'
2
- import type { VineType } from '@stacksjs/types'
3
2
import { validateField } from '@stacksjs/validation'
4
3
import { customValidate } from '@stacksjs/validation'
5
4
@@ -14,7 +13,7 @@ interface CustomAttributes {
14
13
[ key : string ] : ValidationField
15
14
}
16
15
interface RequestDataAccessToken {
17
- id ? : number
16
+ id : number
18
17
name : string
19
18
token : string
20
19
plain_text_token : string
@@ -31,8 +30,8 @@ export class AccessTokenRequest extends Request<RequestDataAccessToken> implemen
31
30
public plain_text_token = ''
32
31
public abilities = ''
33
32
public team_id = 0
34
- public created_at = ''
35
- public updated_at = ''
33
+ public created_at = new Date ( )
34
+ public updated_at = new Date ( )
36
35
37
36
public async validate ( attributes ?: CustomAttributes ) : Promise < void > {
38
37
if ( attributes === undefined || attributes === null ) {
Original file line number Diff line number Diff line change 1
1
import { Request } from '@stacksjs/router'
2
- import type { VineType } from '@stacksjs/types'
3
2
import { validateField } from '@stacksjs/validation'
4
3
import { customValidate } from '@stacksjs/validation'
5
4
@@ -14,7 +13,7 @@ interface CustomAttributes {
14
13
[ key : string ] : ValidationField
15
14
}
16
15
interface RequestDataDeployment {
17
- id ? : number
16
+ id : number
18
17
commit_sha : string
19
18
commit_message : string
20
19
branch : string
@@ -37,8 +36,8 @@ export class DeploymentRequest extends Request<RequestDataDeployment> implements
37
36
public deploy_script = ''
38
37
public terminal_output = ''
39
38
public user_id = 0
40
- public created_at = ''
41
- public updated_at = ''
39
+ public created_at = new Date ( )
40
+ public updated_at = new Date ( )
42
41
43
42
public async validate ( attributes ?: CustomAttributes ) : Promise < void > {
44
43
if ( attributes === undefined || attributes === null ) {
Original file line number Diff line number Diff line change 1
1
import { Request } from '@stacksjs/router'
2
- import type { VineType } from '@stacksjs/types'
3
2
import { validateField } from '@stacksjs/validation'
4
3
import { customValidate } from '@stacksjs/validation'
5
4
@@ -14,7 +13,7 @@ interface CustomAttributes {
14
13
[ key : string ] : ValidationField
15
14
}
16
15
interface RequestDataPost {
17
- id ? : number
16
+ id : number
18
17
title : string
19
18
body : string
20
19
user_id : number
@@ -27,8 +26,8 @@ export class PostRequest extends Request<RequestDataPost> implements PostRequest
27
26
public title = ''
28
27
public body = ''
29
28
public user_id = 0
30
- public created_at = ''
31
- public updated_at = ''
29
+ public created_at = new Date ( )
30
+ public updated_at = new Date ( )
32
31
33
32
public async validate ( attributes ?: CustomAttributes ) : Promise < void > {
34
33
if ( attributes === undefined || attributes === null ) {
Original file line number Diff line number Diff line change 1
1
import { Request } from '@stacksjs/router'
2
- import type { VineType } from '@stacksjs/types'
3
2
import { validateField } from '@stacksjs/validation'
4
3
import { customValidate } from '@stacksjs/validation'
5
4
@@ -14,7 +13,7 @@ interface CustomAttributes {
14
13
[ key : string ] : ValidationField
15
14
}
16
15
interface RequestDataProject {
17
- id ? : number
16
+ id : number
18
17
name : string
19
18
description : string
20
19
url : string
@@ -29,8 +28,8 @@ export class ProjectRequest extends Request<RequestDataProject> implements Proje
29
28
public description = ''
30
29
public url = ''
31
30
public status = ''
32
- public created_at = ''
33
- public updated_at = ''
31
+ public created_at = new Date ( )
32
+ public updated_at = new Date ( )
34
33
35
34
public async validate ( attributes ?: CustomAttributes ) : Promise < void > {
36
35
if ( attributes === undefined || attributes === null ) {
Original file line number Diff line number Diff line change 1
1
import { Request } from '@stacksjs/router'
2
- import type { VineType } from '@stacksjs/types'
3
2
import { validateField } from '@stacksjs/validation'
4
3
import { customValidate } from '@stacksjs/validation'
5
4
@@ -14,7 +13,7 @@ interface CustomAttributes {
14
13
[ key : string ] : ValidationField
15
14
}
16
15
interface RequestDataRelease {
17
- id ? : number
16
+ id : number
18
17
version : string
19
18
created_at ?: Date
20
19
updated_at ?: Date
@@ -23,8 +22,8 @@ interface RequestDataRelease {
23
22
export class ReleaseRequest extends Request < RequestDataRelease > implements ReleaseRequestType {
24
23
public id = 1
25
24
public version = ''
26
- public created_at = ''
27
- public updated_at = ''
25
+ public created_at = new Date ( )
26
+ public updated_at = new Date ( )
28
27
29
28
public async validate ( attributes ?: CustomAttributes ) : Promise < void > {
30
29
if ( attributes === undefined || attributes === null ) {
Original file line number Diff line number Diff line change 1
1
import { Request } from '@stacksjs/router'
2
- import type { VineType } from '@stacksjs/types'
3
2
import { validateField } from '@stacksjs/validation'
4
3
import { customValidate } from '@stacksjs/validation'
5
4
@@ -14,7 +13,7 @@ interface CustomAttributes {
14
13
[ key : string ] : ValidationField
15
14
}
16
15
interface RequestDataSubscriberEmail {
17
- id ? : number
16
+ id : number
18
17
email : string
19
18
created_at ?: Date
20
19
updated_at ?: Date
@@ -23,8 +22,8 @@ interface RequestDataSubscriberEmail {
23
22
export class SubscriberEmailRequest extends Request < RequestDataSubscriberEmail > implements SubscriberEmailRequestType {
24
23
public id = 1
25
24
public email = ''
26
- public created_at = ''
27
- public updated_at = ''
25
+ public created_at = new Date ( )
26
+ public updated_at = new Date ( )
28
27
29
28
public deleted_at = ''
30
29
Original file line number Diff line number Diff line change 1
1
import { Request } from '@stacksjs/router'
2
- import type { VineType } from '@stacksjs/types'
3
2
import { validateField } from '@stacksjs/validation'
4
3
import { customValidate } from '@stacksjs/validation'
5
4
@@ -14,7 +13,7 @@ interface CustomAttributes {
14
13
[ key : string ] : ValidationField
15
14
}
16
15
interface RequestDataSubscriber {
17
- id ? : number
16
+ id : number
18
17
subscribed : boolean
19
18
user_id : number
20
19
created_at ?: Date
@@ -25,8 +24,8 @@ export class SubscriberRequest extends Request<RequestDataSubscriber> implements
25
24
public id = 1
26
25
public subscribed = false
27
26
public user_id = 0
28
- public created_at = ''
29
- public updated_at = ''
27
+ public created_at = new Date ( )
28
+ public updated_at = new Date ( )
30
29
31
30
public async validate ( attributes ?: CustomAttributes ) : Promise < void > {
32
31
if ( attributes === undefined || attributes === null ) {
Original file line number Diff line number Diff line change 1
1
import { Request } from '@stacksjs/router'
2
- import type { VineType } from '@stacksjs/types'
3
2
import { validateField } from '@stacksjs/validation'
4
3
import { customValidate } from '@stacksjs/validation'
5
4
@@ -14,7 +13,7 @@ interface CustomAttributes {
14
13
[ key : string ] : ValidationField
15
14
}
16
15
interface RequestDataTeam {
17
- id ? : number
16
+ id : number
18
17
name : string
19
18
company_name : string
20
19
email : string
@@ -41,8 +40,8 @@ export class TeamRequest extends Request<RequestDataTeam> implements TeamRequest
41
40
public is_personal = false
42
41
public accesstoken_id = 0
43
42
public user_id = 0
44
- public created_at = ''
45
- public updated_at = ''
43
+ public created_at = new Date ( )
44
+ public updated_at = new Date ( )
46
45
47
46
public async validate ( attributes ?: CustomAttributes ) : Promise < void > {
48
47
if ( attributes === undefined || attributes === null ) {
You can’t perform that action at this time.
0 commit comments