Skip to content

Commit bda2640

Browse files
committed
fixed:type conflict
1 parent f7ebe81 commit bda2640

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/services/adminServices.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export class AdminService {
1616
});
1717
}
1818

19-
async deleteUser(userId: number) {
19+
async deleteUser(userId: string) {
2020
const user = await prisma.user.findUnique({ where: { id: userId } });
2121

2222
if (!user) {

src/services/blogServices.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ import { prisma } from "../config/prisma";
22
import { CreatePostInput, UpdatePostInput } from "../dto/blog.dto";
33

44
export class BlogService {
5-
async createPost(data: CreatePostInput, userId: number) {
5+
async createPost(data: CreatePostInput, userId: string) {
66
return prisma.post.create({ data: { ...data, authorId: userId } });
77
}
88

9-
async updatePost(postId: number, data: UpdatePostInput, userId: number) {
9+
async updatePost(postId: string, data: UpdatePostInput, userId: string) {
1010
const post = await prisma.post.findUnique({ where: { id: postId } });
1111
if (!post) throw new Error("Post not found");
1212
if (post.authorId !== userId) throw new Error("Unauthorized");
1313

1414
return prisma.post.update({ where: { id: postId }, data });
1515
}
1616

17-
async deletePost(postId: number) {
17+
async deletePost(postId: string) {
1818
return prisma.post.delete({ where: { id: postId } });
1919
}
2020

21-
async getPostsByUser(userId: number) {
21+
async getPostsByUser(userId: string) {
2222
return prisma.post.findMany({ where: { authorId: userId } });
2323
}
2424

src/utils/generateTokenJWT.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import jwt from "jsonwebtoken";
22

33
export interface AuthUserPayload {
4-
id: number;
4+
id: string;
55
email: string;
66
role: "USER" | "ADMIN";
77
}

0 commit comments

Comments
 (0)