Skip to content

Commit 0066349

Browse files
chore: wip
1 parent 6f743c7 commit 0066349

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

app/Actions/Cms/CommentIndexAction.ts

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import type { CommentablesRequestType } from '@stacksjs/orm'
12
import { Action } from '@stacksjs/actions'
23
import { comments } from '@stacksjs/cms'
34
import { response } from '@stacksjs/router'
@@ -6,8 +7,11 @@ export default new Action({
67
name: 'Comment Index',
78
description: 'Comment Index ORM Action',
89
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)
1115

1216
return response.json(results)
1317
},

app/Actions/Cms/CommentStoreAction.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { commentablesRequestType } from '@stacksjs/orm'
1+
import type { CommentablesRequestType } from '@stacksjs/orm'
22
import { Action } from '@stacksjs/actions'
33
import { comments } from '@stacksjs/cms'
44
import { response } from '@stacksjs/router'
@@ -7,7 +7,7 @@ export default new Action({
77
name: 'Comment Store',
88
description: 'Comment Store ORM Action',
99
method: 'POST',
10-
async handle(request: commentablesRequestType) {
10+
async handle(request: CommentablesRequestType) {
1111
await request.validate()
1212

1313
const data = {

app/Actions/Cms/CommentUpdateAction.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { commentablesRequestType } from '@stacksjs/orm'
1+
import type { CommentablesRequestType } from '@stacksjs/orm'
22
import { Action } from '@stacksjs/actions'
33
import { comments } from '@stacksjs/cms'
44
import { response } from '@stacksjs/router'
@@ -7,7 +7,7 @@ export default new Action({
77
name: 'Comment Update',
88
description: 'Comment Update ORM Action',
99
method: 'PATCH',
10-
async handle(request: commentablesRequestType) {
10+
async handle(request: CommentablesRequestType) {
1111
await request.validate()
1212

1313
const id = request.getParam('id')

0 commit comments

Comments
 (0)