Skip to content

Commit

Permalink
refactor: remove test utils and validator bindings for now
Browse files Browse the repository at this point in the history
  • Loading branch information
thetutlage committed Sep 19, 2023
1 parent 50b098b commit 49b33b6
Show file tree
Hide file tree
Showing 15 changed files with 129 additions and 2,263 deletions.
45 changes: 22 additions & 23 deletions example/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { DateTime } from 'luxon'
import { BaseModel } from '../src/orm/base_model/index.js'
import { BaseModel, scope } from '../src/orm/base_model/index.js'
import { column, hasOne } from '../src/orm/decorators/index.js'
import { HasOne } from '../src/types/relations.js'
import { scope } from '../src/helpers/scope.js'
import { ModelQueryBuilderContract } from '../src/types/model.js'
// import Factory from '@ioc:Adonis/Lucid/Factory'
import factory from '../src/factories/main.js'

enum ProfileTypes {
TWITTER = 'TWITTER',
Expand Down Expand Up @@ -51,36 +50,36 @@ User.create({ id: '1', username: 'virk' })
User.create({ id: '1', username: 'virk' })
User.create({ id: '1' })

// const F = Factory.define(User, ({ faker }) => {
// return {
// username: faker.internet.userName(),
// }
// })
const F = factory.define(User, ({ faker }) => {
return {
username: faker.internet.userName(),
}
})

// const P = Factory.define(Profile, () => {
// return {}
// })
const P = factory.define(Profile, () => {
return {}
})

// const ProfileF = P.state('social', () => {}).build()
const ProfileF = P.state('social', () => {}).build()

// const UserF = F.state('active', (user) => {
// user.username = 'virk'
// })
// .relation('profile', () => ProfileF)
// .build()
const UserF = F.state('active', (user) => {
user.username = 'virk'
})
.relation('profile', () => ProfileF)
.build()

// UserF.with('profile', 1).merge({})
UserF.with('profile', 1).merge({})
User.query().withCount('profile', (query) => {
query.where('isActive', true).has('user', '>', 1)
})

User.query().withCount('profile')

// User.query()
// .paginate(1, 1)
// .then((users) => {
// users.forEach((user) => user.username)
// })
User.query()
.paginate(1, 1)
.then((users) => {
users.forEach((user) => user.username)
})

const user = new User()
user.loadCount('profile')
10 changes: 10 additions & 0 deletions index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* @adonisjs/lucid
*
* (c) AdonisJS
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

export { defineConfig } from './src/define_config.js'
52 changes: 0 additions & 52 deletions instructions.md

This file was deleted.

222 changes: 0 additions & 222 deletions instructions.ts

This file was deleted.

18 changes: 0 additions & 18 deletions serve.ts

This file was deleted.

0 comments on commit 49b33b6

Please sign in to comment.