feat: move some stuff over to the new adapter pattern (#2880)

* chore: add jsdocs for limit

* moar jsdocs

* Replace find in deleteByID

* (check this:) add missing locale

* move findByID

* Make findByID return only one document

* _id => id

* _id => id

* Improve version types

* Improve sortOrder types

* move version stuff over

* version stuff

* fix: sort types

* fix params

* fix: findVersionByID generic

* fix: type error for versions

* remove unused value

* fix: Document import

* add todo

* feat: updateOne to mongoose

* remove unnecessary Model

* more update stuff

* remove unnecessary imports

* remove unnecessary function arguments

* fix: auth db update calls

* fix: bad updateByID which made tests fail

* fix: update returned docs to fix tests

* fix: update from version using mongoose directly even though the Model does not exist

* feat: implement deleteOne

* fix: assign verificationToken only when it exists - fixes test

* migrate saveVersion partly

* feat: make dev:generate-graphql-schema work even without specifying extra argument

* fix: this.db can be null

* chore: use destructured locale where possible

* chore: improve variable name

* fix: SanitizedConfig type

* feat: findGlobal database adapter

* fix: flaky e2e test

* chore: improve incorrect comment

* chore: undo diffs

* fix: id types

* fix: id typing
This commit is contained in:
Alessio Gravili
2023-06-26 17:45:52 +02:00
committed by GitHub
parent b0b30f5aef
commit 696a215dd0
29 changed files with 304 additions and 223 deletions

View File

@@ -4,9 +4,24 @@ import { generateGraphQLSchema } from '../src/bin/generateGraphQLSchema';
const [testConfigDir] = process.argv.slice(2);
const testDir = path.resolve(__dirname, testConfigDir);
setPaths(testDir);
generateGraphQLSchema();
let testDir;
if (testConfigDir) {
testDir = path.resolve(__dirname, testConfigDir);
setPaths(testDir);
generateGraphQLSchema();
} else {
// Generate graphql schema for entire directory
testDir = __dirname;
fs.readdirSync(__dirname, { withFileTypes: true })
.filter((f) => f.isDirectory())
.forEach((dir) => {
const suiteDir = path.resolve(testDir, dir.name);
const configFound = setPaths(suiteDir);
if (configFound) generateGraphQLSchema();
});
}
// Set config path and TS output path using test dir
function setPaths(dir) {