-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SOA-24] Review linting configuration (#29)
* chore ποΈ (format): add prettierignore until address linting issues * chore ποΈ (format):address linting warns * fix β (tests): correction to re-used constant
- Loading branch information
1 parent
85388b4
commit 328ca63
Showing
43 changed files
with
119 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build/** | ||
database/migrations/** | ||
README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,35 @@ | ||
import PostReactionService from '#services/post_reaction_service'; | ||
import { errorsReducer } from '#utils/index'; | ||
import { postReactionValidator } from '#validators/post'; | ||
import { inject } from '@adonisjs/core'; | ||
import PostReactionService from '#services/post_reaction_service' | ||
import { errorsReducer } from '#utils/index' | ||
import { postReactionValidator } from '#validators/post' | ||
import { inject } from '@adonisjs/core' | ||
import type { HttpContext } from '@adonisjs/core/http' | ||
import { errors } from '@vinejs/vine'; | ||
import { errors } from '@vinejs/vine' | ||
|
||
@inject() | ||
export default class PostReactionsController { | ||
|
||
constructor( | ||
private readonly service: PostReactionService | ||
) { } | ||
constructor(private readonly service: PostReactionService) {} | ||
|
||
async create(ctx: HttpContext) { | ||
const postId = ctx.params.id; | ||
const userId = ctx.auth.user?.id!; | ||
const payload = ctx.request.body(); | ||
const postId = ctx.params.id | ||
const userId = ctx.auth.user?.id! | ||
const payload = ctx.request.body() | ||
try { | ||
const { reaction } = await postReactionValidator.validate(payload) | ||
const [preExistant, resource] = await this.service.create(userId, postId, reaction); | ||
return preExistant ? ctx.response.ok(resource) : ctx.response.created(resource); | ||
const [preExistant, resource] = await this.service.create(userId, postId, reaction) | ||
return preExistant ? ctx.response.ok(resource) : ctx.response.created(resource) | ||
} catch (error) { | ||
if (error instanceof errors.E_VALIDATION_ERROR) { | ||
const reducedErrors = errorsReducer(error.messages) | ||
return ctx.response.badRequest(reducedErrors); | ||
return ctx.response.badRequest(reducedErrors) | ||
} | ||
return ctx.response.badRequest(); | ||
return ctx.response.badRequest() | ||
} | ||
} | ||
|
||
async destroy(ctx: HttpContext) { | ||
const postId = ctx.params.id; | ||
const userId = ctx.auth.user?.id!; | ||
await this.service.destroy(userId, postId); | ||
const postId = ctx.params.id | ||
const userId = ctx.auth.user?.id! | ||
await this.service.destroy(userId, postId) | ||
return ctx.response.noContent() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
inertia/components/posts/feed-list.tsx β inertia/components/posts/feed_list.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
Oops, something went wrong.