-
-
Notifications
You must be signed in to change notification settings - Fork 195
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: adding new static methods for querying on the model
This commit has some loose changes, which will be addressed after we improve and restructure the test to cover broad use cases
- Loading branch information
1 parent
eb4de43
commit ee75a1d
Showing
5 changed files
with
141 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
import { BaseModel } from '@ioc:Adonis/Lucid/Orm' | ||
// import { BaseModel } from '@ioc:Adonis/Lucid/Orm' | ||
// import Database from '@ioc:Adonis/Lucid/Database' | ||
|
||
class Profile extends BaseModel { | ||
} | ||
// class Profile extends BaseModel { | ||
// } | ||
|
||
class User extends BaseModel { | ||
public username: string | ||
// class User extends BaseModel { | ||
// public username: string | ||
// public profile: Profile[] | ||
// } | ||
|
||
public profile: Profile | ||
} | ||
|
||
const user = new User() | ||
const profile = user.$getRelated('profile') | ||
console.log(profile) | ||
// user.saveRelated('profile', new Profile()) | ||
// const profile = user.$getRelated('profile') | ||
// console.log(profile) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters