final-orm
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -25,2 +25,3 @@ import dotenv from 'dotenv' | ||
name: { $type: String, index: true, unique: true }, | ||
email: { $type: String, index: true, unique: true }, | ||
profile: { | ||
@@ -47,6 +48,14 @@ vegan: { $type: Boolean, optional: true } | ||
test('create new user model instance', async () => { | ||
const newUser = await User.add({ name: username }) | ||
const getEmail = () => `test${randomBytes(2).toString('HEX')}@tinyrama.com` | ||
const newUser = await User.add({ | ||
name: username, | ||
email: getEmail() | ||
}) | ||
let newUsers = new Array(10) | ||
newUsers.fill(await User.add({ name: `username-${randomBytes(2).toString('HEX')}` })) | ||
newUsers.fill(await User.add({ | ||
name: `username-${randomBytes(2).toString('HEX')}`, | ||
email: getEmail() | ||
})) | ||
@@ -225,2 +234,13 @@ newUsers = await Promise.all(newUsers) | ||
test('query with $with', async () => { | ||
const posts = await User.findAndCount({ | ||
$with: 'User', | ||
where: { name: username } | ||
}) | ||
console.log('posts.data[0]', posts.data[0]) | ||
expect(posts.data[0].name).toBe(username) | ||
}) | ||
// test('connect without localhost', async () => { | ||
@@ -288,1 +308,3 @@ // /* | ||
}) | ||
@@ -42,2 +42,8 @@ import arangojs, { Database, aql } from 'arangojs' | ||
try { | ||
await db.createDatabase(dbName) | ||
} catch (e) { | ||
// throw new Error(get(e, 'response.body.errorMessage', e)) | ||
} | ||
db.useDatabase(dbName) | ||
@@ -56,2 +62,9 @@ | ||
const db = await this._getDatabase() | ||
try { | ||
await collection.create() | ||
await this._setIndexes(collection) | ||
} catch (e) { | ||
} | ||
const collection = await db.collection(this.name) | ||
@@ -58,0 +71,0 @@ |
{ | ||
"name": "final-orm", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"repository": { | ||
@@ -50,3 +50,3 @@ "type": "git", | ||
"arangojs": "^5.7.0", | ||
"arangolize": "^0.9.8", | ||
"arangolize": "0.10.2", | ||
"core-decorators": "^0.20.0", | ||
@@ -53,0 +53,0 @@ "dotenv": "^4.0.0", |
1
41824
18
1065
+ Addedarangolize@0.10.2(transitive)
- Removedarangolize@0.9.8(transitive)
Updatedarangolize@0.10.2