darkenpeng / mini-board Goto Github PK
View Code? Open in Web Editor NEWnestjs-react로 만드는 커뮤니티
License: MIT License
nestjs-react로 만드는 커뮤니티
License: MIT License
참고 이전에 typeORM + postgre(supabase)를 쓰는 걸 한 번 꺼낸 적이 있습니다!
unit test 작성 시 혼동되는 부분이 있어 작업의 단위를 쪼갰습니다.
이유와 함께 적어주세요!
Repository 를 적용하며 DB 테스트를 하고
Auth 에서 사용하는 userService를 userRepository로 바꿔야한다
+DB연결 후 userserivce 의 singUp에서 pw를 가려야한다
분리 엔티티를 인터페이스로 사용한 코드를 고쳐놔야함 이유
userDTO
export class UserDto {
readonly email: string;
readonly password: string;
readonly username: string;
}
UserEntity
abstract class CommonEntity {
_id: string;
createdAt: Date;
updatedAt: Date;
}
export class UserEntity extends CommonEntity {
email: string;
username: string;
password: string;
imgUrl?: string;
}
// src/users.repository
async getOneByEmail(email: string): Promise<UserDto> {
const test = await this.userModel.findOneBy({ email });
return test;
}
repository 의 getOneByEmail에서 Promise면 UserEntity 보다 프로퍼티가
_id
cratedAt
updateAt
세 개 적기 때문에 반환이 안되어야 한다고 생각하는데 response 가 밑처럼 나옵니다
// GET /users
{
"_id": 1,
"createdAt": "2022-12-08T01:31:47.740Z",
"updatedAt": "2022-12-08T01:31:47.740Z",
"email": "[email protected]",
"username": "gune",
"password": "$2b$10$UvrtZ0J.GSJYbFhBArhBU.zISxoazYZ22wU3dAQ7cuLIeDJ2fainm",
"imgUrl": null
},
도움을 구합니다...
명세 변경users -> user
POST API service unit test 작성 시 혼동되는 부분이 있어 공유합니다.
생각해본 방법
권한에 따른 인가 구현하기 (jwt guard, strategy)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.