File tree 3 files changed +10
-6
lines changed
3 files changed +10
-6
lines changed Original file line number Diff line number Diff line change
1
+ import type { CommentablesRequestType } from '@stacksjs/orm'
1
2
import { Action } from '@stacksjs/actions'
2
3
import { comments } from '@stacksjs/cms'
3
4
import { response } from '@stacksjs/router'
@@ -6,8 +7,11 @@ export default new Action({
6
7
name : 'Comment Index' ,
7
8
description : 'Comment Index ORM Action' ,
8
9
method : 'GET' ,
9
- async handle ( ) {
10
- const results = await comments . fetchCommentsByCommentables ( 1 , 'post' )
10
+ async handle ( request : CommentablesRequestType ) {
11
+ const commentables_id = request . getParam ( 'commentables_id' )
12
+ const commentables_type = request . getParam ( 'commentables_type' )
13
+
14
+ const results = await comments . fetchCommentsByCommentables ( Number ( commentables_id ) , commentables_type )
11
15
12
16
return response . json ( results )
13
17
} ,
Original file line number Diff line number Diff line change 1
- import type { commentablesRequestType } from '@stacksjs/orm'
1
+ import type { CommentablesRequestType } from '@stacksjs/orm'
2
2
import { Action } from '@stacksjs/actions'
3
3
import { comments } from '@stacksjs/cms'
4
4
import { response } from '@stacksjs/router'
@@ -7,7 +7,7 @@ export default new Action({
7
7
name : 'Comment Store' ,
8
8
description : 'Comment Store ORM Action' ,
9
9
method : 'POST' ,
10
- async handle ( request : commentablesRequestType ) {
10
+ async handle ( request : CommentablesRequestType ) {
11
11
await request . validate ( )
12
12
13
13
const data = {
Original file line number Diff line number Diff line change 1
- import type { commentablesRequestType } from '@stacksjs/orm'
1
+ import type { CommentablesRequestType } from '@stacksjs/orm'
2
2
import { Action } from '@stacksjs/actions'
3
3
import { comments } from '@stacksjs/cms'
4
4
import { response } from '@stacksjs/router'
@@ -7,7 +7,7 @@ export default new Action({
7
7
name : 'Comment Update' ,
8
8
description : 'Comment Update ORM Action' ,
9
9
method : 'PATCH' ,
10
- async handle ( request : commentablesRequestType ) {
10
+ async handle ( request : CommentablesRequestType ) {
11
11
await request . validate ( )
12
12
13
13
const id = request . getParam ( 'id' )
You can’t perform that action at this time.
0 commit comments