-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add v2 models, adapters, and serializers
- Loading branch information
1 parent
ffb16e4
commit 0c41c31
Showing
12 changed files
with
145 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import OsfAdapter from './osf-adapter'; | ||
|
||
export default class AddonAdapter extends OsfAdapter { | ||
} | ||
|
||
declare module 'ember-data/types/registries/adapter' { | ||
export default interface AdapterRegistry { | ||
addon: AddonAdapter; | ||
} // eslint-disable-line semi | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import OsfAdapter from './osf-adapter'; | ||
|
||
export default class ExternalAccountAdapter extends OsfAdapter { | ||
} | ||
|
||
declare module 'ember-data/types/registries/adapter' { | ||
export default interface AdapterRegistry { | ||
'external-account': ExternalAccountAdapter; | ||
} // eslint-disable-line semi | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import OsfAdapter from './osf-adapter'; | ||
|
||
export default class NodeAddonAdapter extends OsfAdapter { | ||
} | ||
|
||
declare module 'ember-data/types/registries/adapter' { | ||
export default interface AdapterRegistry { | ||
'node-addon': NodeAddonAdapter; | ||
} // eslint-disable-line semi | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import OsfAdapter from './osf-adapter'; | ||
|
||
export default class UserAddonAdapter extends OsfAdapter { | ||
} | ||
|
||
declare module 'ember-data/types/registries/adapter' { | ||
export default interface AdapterRegistry { | ||
'user-addon': UserAddonAdapter; | ||
} // eslint-disable-line semi | ||
} |
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { attr } from '@ember-data/model'; | ||
|
||
import OsfModel from './osf-model'; | ||
|
||
export default class AddonModel extends OsfModel { | ||
@attr('string') name!: string; | ||
@attr('array') categories!: string[]; | ||
} | ||
|
||
declare module 'ember-data/types/registries/model' { | ||
export default interface ModelRegistry { | ||
addon: AddonModel; | ||
} // eslint-disable-line semi | ||
} |
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { attr } from '@ember-data/model'; | ||
|
||
import OsfModel from './osf-model'; | ||
|
||
export default class ExternalAccountsModel extends OsfModel { | ||
@attr('string') provider!: string; | ||
@attr('string') profileUrl?: string; | ||
@attr('string') displayName!: string; | ||
} | ||
|
||
declare module 'ember-data/types/registries/model' { | ||
export default interface ModelRegistry { | ||
'external-account': ExternalAccountsModel; | ||
} // eslint-disable-line semi | ||
} |
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { attr } from '@ember-data/model'; | ||
|
||
import OsfModel from './osf-model'; | ||
|
||
export default class NodeAddonModel extends OsfModel { | ||
@attr('boolean') nodeHasAuth!: boolean; | ||
@attr('boolean') configured!: boolean; | ||
@attr('string') external_account_id!: string; | ||
@attr('string') folder_id?: string; | ||
@attr('string') folder_path?: string; | ||
} | ||
|
||
declare module 'ember-data/types/registries/model' { | ||
export default interface ModelRegistry { | ||
'node-addon': NodeAddonModel; | ||
} // eslint-disable-line semi | ||
} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { AsyncHasMany, attr, hasMany } from '@ember-data/model'; | ||
|
||
import ExternalAccountsModel from 'ember-osf-web/models/external-accounts'; | ||
|
||
import OsfModel from './osf-model'; | ||
|
||
|
||
export default class UserAddonModel extends OsfModel { | ||
@attr('boolean') userHasAuth!: boolean; | ||
|
||
@hasMany('external-accounts', { inverse: null }) | ||
externalAccounts!: AsyncHasMany<ExternalAccountsModel> & ExternalAccountsModel[]; | ||
} | ||
|
||
declare module 'ember-data/types/registries/model' { | ||
export default interface ModelRegistry { | ||
'user-addon': UserAddonModel; | ||
} // eslint-disable-line semi | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import OsfSerializer from './osf-serializer'; | ||
|
||
export default class AddonSerializer extends OsfSerializer { | ||
} | ||
|
||
declare module 'ember-data/types/registries/serializer' { | ||
export default interface SerializerRegistry { | ||
addon: AddonSerializer; | ||
} // eslint-disable-line semi | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import OsfSerializer from './osf-serializer'; | ||
|
||
export default class ExternalAccountSerializer extends OsfSerializer { | ||
} | ||
|
||
declare module 'ember-data/types/registries/serializer' { | ||
export default interface SerializerRegistry { | ||
'external-account': ExternalAccountSerializer; | ||
} // eslint-disable-line semi | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import OsfSerializer from './osf-serializer'; | ||
|
||
export default class NodeAddonSerializer extends OsfSerializer { | ||
} | ||
|
||
declare module 'ember-data/types/registries/serializer' { | ||
export default interface SerializerRegistry { | ||
'node-addon': NodeAddonSerializer; | ||
} // eslint-disable-line semi | ||
} |
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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import OsfSerializer from './osf-serializer'; | ||
|
||
export default class UserAddonSerializer extends OsfSerializer { | ||
} | ||
|
||
declare module 'ember-data/types/registries/serializer' { | ||
export default interface SerializerRegistry { | ||
'user-addon': UserAddonSerializer; | ||
} // eslint-disable-line semi | ||
} |