File tree Expand file tree Collapse file tree 12 files changed +118
-27
lines changed Expand file tree Collapse file tree 12 files changed +118
-27
lines changed Original file line number Diff line number Diff line change @@ -249,7 +249,7 @@ async function writeModelRequest() {
249
249
250
250
fileString += `interface CustomAttributes {
251
251
[key: string]: ValidationField
252
- }`
252
+ }\n `
253
253
254
254
const types = `export interface ${ modelName } RequestType extends Request {
255
255
validate(attributes?: CustomAttributes): void
@@ -262,9 +262,13 @@ async function writeModelRequest() {
262
262
${ fieldString }
263
263
}\n`
264
264
265
+ fileString += `interface RequestData${ modelName } {
266
+ ${ fieldString }
267
+ }\n`
268
+
265
269
typeString += types
266
270
267
- fileString += `export class ${ modelName } Request extends Request implements ${ modelName } RequestType {
271
+ fileString += `export class ${ modelName } Request extends Request<RequestData ${ modelName } > implements ${ modelName } RequestType {
268
272
${ fieldStringInt }
269
273
public async validate(attributes?: CustomAttributes): Promise<void> {
270
274
if (attributes === undefined || attributes === null) {
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ interface CustomAttributes {
24
24
type RouteParams = { [ key : string ] : string } | null
25
25
26
26
export class Request < T extends RequestData = RequestData > implements RequestInstance {
27
- public query : T = { } as T ;
27
+ public query : T = { } as T
28
28
public params : RouteParams = null
29
29
public headers : any = { }
30
30
Original file line number Diff line number Diff line change
1
+ import { route } from '@stacksjs/router'
2
+
3
+
4
+ route.get('users', '/Users/glennmichaeltorregosa/Documents/Projects/stacks/storage/framework/actions/src/UserIndexOrmAction.ts')
5
+
6
+ route.get('users/{id}', '/Users/glennmichaeltorregosa/Documents/Projects/stacks/storage/framework/actions/src/UserShowOrmAction.ts')
7
+
8
+ route.post('users', '/Users/glennmichaeltorregosa/Documents/Projects/stacks/app/Actions/UserStoreAction.ts')
9
+
10
+ route.delete('users/{id}', '/Users/glennmichaeltorregosa/Documents/Projects/stacks/storage/framework/actions/src/UserDestroyOrmAction.ts')
11
+
Original file line number Diff line number Diff line change @@ -18,7 +18,18 @@ interface ValidationField {
18
18
interface CustomAttributes {
19
19
[ key : string ] : ValidationField
20
20
}
21
- export class AccessTokenRequest extends Request implements AccessTokenRequestType {
21
+ interface RequestDataAccessToken {
22
+ id ?: number
23
+ name : string
24
+ token : string
25
+ plainTextToken : string
26
+ abilities : string [ ]
27
+ team_id : number
28
+ created_at ?: string
29
+ updated_at ?: string
30
+ deleted_at ?: string
31
+ }
32
+ export class AccessTokenRequest extends Request < RequestDataAccessToken > implements AccessTokenRequestType {
22
33
public id = 1
23
34
public name = ''
24
35
public token = ''
Original file line number Diff line number Diff line change @@ -18,7 +18,21 @@ interface ValidationField {
18
18
interface CustomAttributes {
19
19
[ key : string ] : ValidationField
20
20
}
21
- export class DeploymentRequest extends Request implements DeploymentRequestType {
21
+ interface RequestDataDeployment {
22
+ id ?: number
23
+ commitSha : string
24
+ commitMessage : string
25
+ branch : string
26
+ status : string
27
+ executionTime : number
28
+ deployScript : string
29
+ terminalOutput : string
30
+ user_id : number
31
+ created_at ?: string
32
+ updated_at ?: string
33
+ deleted_at ?: string
34
+ }
35
+ export class DeploymentRequest extends Request < RequestDataDeployment > implements DeploymentRequestType {
22
36
public id = 1
23
37
public commitSha = ''
24
38
public commitMessage = ''
Original file line number Diff line number Diff line change @@ -18,7 +18,16 @@ interface ValidationField {
18
18
interface CustomAttributes {
19
19
[ key : string ] : ValidationField
20
20
}
21
- export class PostRequest extends Request implements PostRequestType {
21
+ interface RequestDataPost {
22
+ id ?: number
23
+ title : string
24
+ body : string
25
+ user_id : number
26
+ created_at ?: string
27
+ updated_at ?: string
28
+ deleted_at ?: string
29
+ }
30
+ export class PostRequest extends Request < RequestDataPost > implements PostRequestType {
22
31
public id = 1
23
32
public title = ''
24
33
public body = ''
Original file line number Diff line number Diff line change @@ -18,7 +18,17 @@ interface ValidationField {
18
18
interface CustomAttributes {
19
19
[ key : string ] : ValidationField
20
20
}
21
- export class ProjectRequest extends Request implements ProjectRequestType {
21
+ interface RequestDataProject {
22
+ id ?: number
23
+ name : string
24
+ description : string
25
+ url : string
26
+ status : string
27
+ created_at ?: string
28
+ updated_at ?: string
29
+ deleted_at ?: string
30
+ }
31
+ export class ProjectRequest extends Request < RequestDataProject > implements ProjectRequestType {
22
32
public id = 1
23
33
public name = ''
24
34
public description = ''
Original file line number Diff line number Diff line change @@ -18,7 +18,14 @@ interface ValidationField {
18
18
interface CustomAttributes {
19
19
[ key : string ] : ValidationField
20
20
}
21
- export class ReleaseRequest extends Request implements ReleaseRequestType {
21
+ interface RequestDataRelease {
22
+ id ?: number
23
+ version : string
24
+ created_at ?: string
25
+ updated_at ?: string
26
+ deleted_at ?: string
27
+ }
28
+ export class ReleaseRequest extends Request < RequestDataRelease > implements ReleaseRequestType {
22
29
public id = 1
23
30
public version = ''
24
31
public created_at = ''
Original file line number Diff line number Diff line change @@ -18,7 +18,14 @@ interface ValidationField {
18
18
interface CustomAttributes {
19
19
[ key : string ] : ValidationField
20
20
}
21
- export class SubscriberEmailRequest extends Request implements SubscriberEmailRequestType {
21
+ interface RequestDataSubscriberEmail {
22
+ id ?: number
23
+ email : string
24
+ created_at ?: string
25
+ updated_at ?: string
26
+ deleted_at ?: string
27
+ }
28
+ export class SubscriberEmailRequest extends Request < RequestDataSubscriberEmail > implements SubscriberEmailRequestType {
22
29
public id = 1
23
30
public email = ''
24
31
public created_at = ''
Original file line number Diff line number Diff line change @@ -18,7 +18,15 @@ interface ValidationField {
18
18
interface CustomAttributes {
19
19
[ key : string ] : ValidationField
20
20
}
21
- export class SubscriberRequest extends Request implements SubscriberRequestType {
21
+ interface RequestDataSubscriber {
22
+ id ?: number
23
+ subscribed : boolean
24
+ user_id : number
25
+ created_at ?: string
26
+ updated_at ?: string
27
+ deleted_at ?: string
28
+ }
29
+ export class SubscriberRequest extends Request < RequestDataSubscriber > implements SubscriberRequestType {
22
30
public id = 1
23
31
public subscribed = false
24
32
public user_id = 0
You can’t perform that action at this time.
0 commit comments