-
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.
- Loading branch information
1 parent
613eb6f
commit c4829cd
Showing
16 changed files
with
81 additions
and
37 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 |
---|---|---|
@@ -1,8 +1,8 @@ | ||
import { authService } from '~/server/services/auth.service'; | ||
import { useAuthService } from '~/server/services/auth.service'; | ||
import { VerifyNonce } from '~/types/auth'; | ||
|
||
export default defineEventHandler(async (event) => { | ||
const { verifyNonce } = authService(); | ||
const { signature, address } = await readBody<VerifyNonce>(event); | ||
return await verifyNonce(signature, address); | ||
const service = useAuthService(); | ||
return await service.verifyNonce(signature, address); | ||
}); |
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,8 +1,8 @@ | ||
import { authService } from '~/server/services/auth.service'; | ||
import { useAuthService } from '~/server/services/auth.service'; | ||
import { GetNonceDTO } from '~/types/auth'; | ||
|
||
export default defineEventHandler(async (event) => { | ||
const { address } = await readBody<GetNonceDTO>(event); | ||
const { getNonce } = authService(); | ||
return await getNonce(address); | ||
const service = useAuthService(); | ||
return await service.getNonce(address); | ||
}); |
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,10 +1,10 @@ | ||
import { authService } from '~/server/services/auth.service'; | ||
import { useAuthService } from '~/server/services/auth.service'; | ||
import { AuthenticatedUser, RefreshTokenRequestDTO } from '~/types/auth'; | ||
|
||
type Body = RefreshTokenRequestDTO & AuthenticatedUser; | ||
|
||
export default defineEventHandler(async (event) => { | ||
const { refreshToken: refToken, jwt } = await readBody<Body>(event); | ||
const { refreshToken } = authService(jwt); | ||
return await refreshToken(refToken); | ||
const service = useAuthService(jwt); | ||
return await service.refreshToken(refToken); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { useCommentService } from '~/server/services/comment.service'; | ||
import { AuthenticatedUser } from '~/types/auth'; | ||
|
||
export default defineEventHandler(async (event) => { | ||
const { jwt } = await readBody<AuthenticatedUser>(event); | ||
const commentId = getRouterParam(event, 'id'); | ||
if (Number.isNaN(commentId)) { | ||
return createError({ | ||
message: 'Invalid comment id', | ||
}); | ||
} | ||
|
||
const service = useCommentService(jwt); | ||
return await service.unlike(Number(commentId)); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { commentService } from '~/server/services/comment.service'; | ||
import { useCommentService } from '~/server/services/comment.service'; | ||
import { AuthenticatedUser } from '~/types/auth'; | ||
import { AddCommentDTO, NFTAddress } from '~/types/dtos'; | ||
|
||
type Body = AuthenticatedUser & AddCommentDTO & NFTAddress; | ||
|
||
export default defineEventHandler(async (event) => { | ||
const { jwt, content, parentCommentId, address } = await readBody<Body>(event); | ||
const service = commentService(jwt); | ||
const service = useCommentService(jwt); | ||
return await service.add(address, content, parentCommentId); | ||
}); |
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,15 @@ | ||
import { usePostService } from '~/server/services/post.service'; | ||
import { AuthenticatedUser } from '~/types/auth'; | ||
|
||
export default defineEventHandler(async (event) => { | ||
const { jwt } = await readBody<AuthenticatedUser>(event); | ||
const nftAddress = getRouterParam(event, 'id'); | ||
if (!nftAddress) { | ||
return createError({ | ||
message: 'Invalid NFT address', | ||
}); | ||
} | ||
|
||
const service = usePostService(jwt); | ||
return await service.unlike(nftAddress); | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { postService } from '~/server/services/post.service'; | ||
import { usePostService } from '~/server/services/post.service'; | ||
import { AuthenticatedUser } from '~/types/auth'; | ||
import { PaginationDTO } from '~/types/dtos'; | ||
|
||
export default defineEventHandler(async (event) => { | ||
const { jwt } = await readBody<AuthenticatedUser>(event); | ||
const { pageNumber, pageSize } = getQuery<PaginationDTO>(event); | ||
|
||
const { getMyPosts } = postService(jwt); | ||
return await getMyPosts(pageNumber, pageSize); | ||
const service = usePostService(jwt); | ||
return await service.getMyPosts(pageNumber, pageSize); | ||
}); |
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