-
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.
chore(structure): Refactor APIs structure
- Loading branch information
Showing
60 changed files
with
1,281 additions
and
1,070 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,31 @@ | ||
import { authGuard } from "@libs/authGuard"; | ||
import { createElysia } from "@libs/elysia"; | ||
import { prismaClient } from "@libs/prismaDatabase"; | ||
|
||
export default createElysia() | ||
.use(authGuard) | ||
.get( | ||
"/:id", | ||
async ({ params: { id }, user }) => { | ||
const aiChat = await prismaClient.aIChat.findUnique({ | ||
where: { | ||
id, | ||
userId: user.id, | ||
}, | ||
select: { | ||
chatTitle: true, | ||
messages: true, | ||
}, | ||
}); | ||
|
||
return { | ||
status: 200, | ||
data: aiChat, | ||
}; | ||
}, | ||
{ | ||
detail: { | ||
tags: ["Tidy AI"], | ||
}, | ||
} | ||
); |
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,32 @@ | ||
import { authGuard } from "@libs/authGuard"; | ||
import { createElysia } from "@libs/elysia"; | ||
import { prismaClient } from "@libs/prismaDatabase"; | ||
|
||
export default createElysia() | ||
.use(authGuard) | ||
.get( | ||
"/", | ||
async ({ user }) => { | ||
const aiChats = await prismaClient.aIChat.findMany({ | ||
where: { | ||
userId: user.id, | ||
}, | ||
select: { | ||
userId: false, | ||
chatTitle: true, | ||
id: true, | ||
createdAt: true, | ||
}, | ||
}); | ||
|
||
return { | ||
status: 200, | ||
data: aiChats, | ||
}; | ||
}, | ||
{ | ||
detail: { | ||
tags: ["Tidy AI"], | ||
}, | ||
} | ||
); |
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,5 @@ | ||
import getAIChatById from "./getAIChatById"; | ||
import getCurrentAIChat from "./getCurrentAIChat"; | ||
import requestAIChat from "./requestAIChat"; | ||
|
||
export { getAIChatById, getCurrentAIChat, requestAIChat }; |
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,3 @@ | ||
import cloudinaryUpload from "./cloudinaryUpload"; | ||
|
||
export { cloudinaryUpload }; |
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,15 +1,7 @@ | ||
import { createElysia } from "@libs/elysia"; | ||
import { login } from "./login"; | ||
import { signup } from "./signup"; | ||
import { logout } from "./logout"; | ||
import { provider } from "./provider"; | ||
import { providerCallback } from "./providerCallback"; | ||
import login from "./login"; | ||
import signup from "./signup"; | ||
import logout from "./logout"; | ||
import provider from "./provider"; | ||
import providerCallback from "./providerCallback"; | ||
|
||
const auth = createElysia() | ||
.use(provider) | ||
.use(providerCallback) | ||
.use(login) | ||
.use(signup) | ||
.use(logout); | ||
|
||
export { auth }; | ||
export { login, signup, logout, provider, providerCallback }; |
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
Oops, something went wrong.