From 229283bf6d0c15abb4e0dd8cf6bb2e528b8f9c9a Mon Sep 17 00:00:00 2001
From: muqiuhan 然后实现一个 以上。 Sunday, March 30, 2025 7:58 PM: 感觉以上全错,不应该过度抽象 Repository 的,就让它分散在各个模块中,还可以参考 https://github.com/Papooch/nestjs-cls 实现不会抽象泄漏的事务性 Repository 方法。 然后实现一个 以上。 Sunday, March 30, 2025 7:58 PM: 感觉以上全错,不应该过度抽象 Repository 的,就让它分散在各个模块中,还可以参考 https://github.com/Papooch/nestjs-cls 实现不会抽象泄漏的事务性 Repository 方法。 “欢迎醒来,乐乐” 我抖了抖身上的花瓣,还未说话,就听见了爸爸兴奋的欢呼声。爷爷奶奶眼睛一亮,立刻跑了过来,春天的风似乎都柔软了,我摊了摊手,将他们卷到自己怀里。 春暖花开,一切都在,真好。MongoDataServices:1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40import { Injectable, OnApplicationBootstrap } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { Model } from 'mongoose';
import { IDataServices } from '../../../core';
import { MongoGenericRepository } from './mongo-generic-repository';
import {
Author,
AuthorDocument,
Book,
BookDocument,
Genre,
GenreDocument,
} from './model';
()
export class MongoDataServices
implements IDataServices, OnApplicationBootstrap
{
authors: MongoGenericRepository<Author>;
books: MongoGenericRepository<Book>;
genres: MongoGenericRepository<Genre>;
constructor(
(Author.name)
private AuthorRepository: Model<AuthorDocument>,
(Book.name)
private BookRepository: Model<BookDocument>,
(Genre.name)
private GenreRepository: Model<GenreDocument>,
) {}
onApplicationBootstrap() {
this.authors = new MongoGenericRepository<Author>(this.AuthorRepository);
this.books = new MongoGenericRepository<Book>(this.BookRepository, [
'author',
'genre',
]);
this.genres = new MongoGenericRepository<Genre>(this.GenreRepository);
}
}
+MongoDataServices:import { Injectable, OnApplicationBootstrap } from '@nestjs/common';
import { InjectModel } from '@nestjs/mongoose';
import { Model } from 'mongoose';
import { IDataServices } from '../../../core';
import { MongoGenericRepository } from './mongo-generic-repository';
import {
Author,
AuthorDocument,
Book,
BookDocument,
Genre,
GenreDocument,
} from './model';
()
export class MongoDataServices
implements IDataServices, OnApplicationBootstrap
{
authors: MongoGenericRepository<Author>;
books: MongoGenericRepository<Book>;
genres: MongoGenericRepository<Genre>;
constructor(
(Author.name)
private AuthorRepository: Model<AuthorDocument>,
(Book.name)
private BookRepository: Model<BookDocument>,
(Genre.name)
private GenreRepository: Model<GenreDocument>,
) {}
onApplicationBootstrap() {
this.authors = new MongoGenericRepository<Author>(this.AuthorRepository);
this.books = new MongoGenericRepository<Book>(this.BookRepository, [
'author',
'genre',
]);
this.genres = new MongoGenericRepository<Genre>(this.GenreRepository);
}
}
+
我足不出户,一直缩在一方小世界里面,我用了无数的理由和所有人说我的生活态度,其实勇敢的人根本不需要理由就能走出去,只有懦弱的人会用各种理由说服自己退缩
请以我为戒,大胆往前走,走到灯火通明。
+何须纵酒方能舞翩迁,
赤诚相见时便是少年。
接收到的评论不必急于改变,先存起来,让它们陪着自己,跟着时间走,路上会慢慢的和其他的事情连结起来,这样就能择其善者而从之,其不善者而改之了。
应当早日从这喧扰的世界冷静下来,让脑子里满是憧憬和情爱的灵魂得到一丝陈酿,理性点抬头看看世界上方的二氧化碳,自己晃晃头打破能回到最初的样子再重来的梦。
爱你们。
-]]> -请以我为戒,大胆往前走,走到灯火通明。
-何须纵酒方能舞翩迁,
赤诚相见时便是少年。