File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff 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 ) {
Original file line number Diff line number Diff line change @@ -2,23 +2,23 @@ import { prisma } from "../config/prisma";
22import { CreatePostInput , UpdatePostInput } from "../dto/blog.dto" ;
33
44export 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
Original file line number Diff line number Diff line change 11import jwt from "jsonwebtoken" ;
22
33export interface AuthUserPayload {
4- id : number ;
4+ id : string ;
55 email : string ;
66 role : "USER" | "ADMIN" ;
77}
You can’t perform that action at this time.
0 commit comments