11import { Model , Config , attr , hasMany , belongsTo , hasOne } from '../src/main' ;
22
3- // typescript class
4- class Person extends Model {
3+ class ApplicationRecord extends Model {
54 static baseUrl = 'http://example.com' ;
65 static apiNamespace = '/api' ;
7- static endpoint = '/v1/people' ;
6+ }
87
8+ // typescript class
9+ class Person extends ApplicationRecord {
10+ static endpoint = '/v1/people' ;
911 static jsonapiType = 'people' ;
1012
1113 firstName : string = attr ( ) ;
@@ -27,36 +29,39 @@ let Author = Person.extend({
2729 bio : hasOne ( 'bios' )
2830} ) ;
2931
30- class Book extends Model {
32+ class Book extends ApplicationRecord {
3133 static jsonapiType = 'books' ;
3234
3335 title : string = attr ( ) ;
3436}
3537
36- class Genre extends Model {
38+ class Genre extends ApplicationRecord {
3739 static jsonapiType = 'genres' ;
3840
3941 authors : any = hasMany ( 'authors' )
4042
4143 name : string = attr ( ) ;
4244}
4345
44- class Bio extends Model {
46+ class Bio extends ApplicationRecord {
4547 static jsonapiType = 'bios' ;
4648
4749 description : string = attr ( )
4850}
4951
50- class Tag extends Model {
52+ class Tag extends ApplicationRecord {
5153 static jsonapiType = 'tags' ;
5254
5355 name : string = attr ( )
5456}
5557
56- class MultiWord extends Model {
58+ class MultiWord extends ApplicationRecord {
5759 static jsonapiType = 'multi_words' ;
5860}
5961
60- Config . setup ( ) ;
62+ const TestJWTSubclass = ApplicationRecord . extend ( {
63+ } ) ;
64+
65+ Config . setup ( { jwtOwners : [ ApplicationRecord , TestJWTSubclass ] } ) ;
6166
62- export { Author , Person , Book , Genre , Bio , Tag } ;
67+ export { ApplicationRecord , TestJWTSubclass , Author , Person , Book , Genre , Bio , Tag } ;
0 commit comments