D
const result = await this.authorRepository.createQueryBuilder('author').innerJoinAndSelect("author.posts", "post").where("user.id = :id", {id)).getMany()
А чем плохо данное решение? Можно еще прикрепить пагинацию при необходимостиSize: a a a
D
const result = await this.authorRepository.createQueryBuilder('author').innerJoinAndSelect("author.posts", "post").where("user.id = :id", {id)).getMany()
А чем плохо данное решение? Можно еще прикрепить пагинацию при необходимостиD
const result = await this.authorRepository.createQueryBuilder('author').innerJoinAndSelect("author.posts", "post").where("user.id = :id", {id)).getMany()
А чем плохо данное решение? Можно еще прикрепить пагинацию при необходимостиD
D
Пупкин - Статья 1
Пупкин - Статья 2
Пупкин - Статья 3
Пупкин - Статья 4
Пупкин - Статья 5
Пупкин - Статья 6
Пупкин - Статья 7
Пупкин - Статья 8
Пупкин - Статья 9
Пупкин - Статья 10
SS
Пупкин - Статья 1
Пупкин - Статья 2
Пупкин - Статья 3
Пупкин - Статья 4
Пупкин - Статья 5
Пупкин - Статья 6
Пупкин - Статья 7
Пупкин - Статья 8
Пупкин - Статья 9
Пупкин - Статья 10
SS
D
VS
GD
GD
@Injectable()
export class JwtAuthGuard extends AuthGuard('jwt') {}@Injectable()
export class JwtStrategy extends PassportStrategy(Strategy) {
constructor() {
super({
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
ignoreExpiration: false,
secretOrKey: process.env.SECRET,
});
}
async validate(payload: any) {
console.log('validate', payload);
const { userId, role } = payload;
return { userId, role };
}
}@UseGuard(JwtAuthGuard)@UseGuard(ResetGuard)GD
@Injectable()
export class JwtAuthGuard extends AuthGuard('jwt') {}@Injectable()
export class JwtStrategy extends PassportStrategy(Strategy) {
constructor() {
super({
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
ignoreExpiration: false,
secretOrKey: process.env.SECRET,
});
}
async validate(payload: any) {
console.log('validate', payload);
const { userId, role } = payload;
return { userId, role };
}
}@UseGuard(JwtAuthGuard)@UseGuard(ResetGuard)When implementing a strategy, you can provide a name for it by passing a second argument to the PassportStrategy function. If you don't do this, each strategy will have a default name (e.g., 'jwt' for jwt-strategy): export class JwtStrategy extends PassportStrategy(Strategy, 'myjwt')E
installSubscriptionHandlers: true,
context: ({ req, connection }) => {
if (connection) {
return { req: { headers: connection.context } };
} else {
return { req };
}
},
E
E
Д
АС
Д
АС
Д
АС