Skip to content

Commit

Permalink
Merge pull request #132 from elwayman02/br-models
Browse files Browse the repository at this point in the history
Model updates
  • Loading branch information
Dhaulagiri committed Feb 10, 2018
2 parents fa90427 + f4a248f commit d162bd1
Show file tree
Hide file tree
Showing 14 changed files with 129 additions and 123 deletions.
15 changes: 8 additions & 7 deletions addon/models/github-blob.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import DS from 'ember-data';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';

export default DS.Model.extend({
sha: DS.attr('string'),
url: DS.attr('string'),
content: DS.attr('string'),
encoding: DS.attr('string'),
size: DS.attr('number')
export default Model.extend({
sha: attr('string'),
url: attr('string'),
content: attr('string'),
encoding: attr('string'),
size: attr('number')
});
11 changes: 6 additions & 5 deletions addon/models/github-branch.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import DS from 'ember-data';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';

export default DS.Model.extend({
name: DS.attr('string'),
commit: DS.attr(),
protected: DS.attr('boolean')
export default Model.extend({
name: attr('string'),
commit: attr(),
protected: attr('boolean')
});
17 changes: 10 additions & 7 deletions addon/models/github-organization.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import DS from 'ember-data';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { hasMany } from 'ember-data/relationships';

export default DS.Model.extend({
login: DS.attr('string'),
name: DS.attr('string'),
avatarUrl: DS.attr('string'),
users: DS.hasMany('githubUser', { async: true }),
repositories: DS.hasMany('githubRepository', { async: true })
export default Model.extend({
login: attr('string'),
name: attr('string'),
avatarUrl: attr('string'),

users: hasMany('github-user'),
repositories: hasMany('github-repository')
});
34 changes: 17 additions & 17 deletions addon/models/github-pull.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
import DS from 'ember-data';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { belongsTo } from 'ember-data/relationships';

export default DS.Model.extend({
number: DS.attr('number'),
title: DS.attr('string'),
state: DS.attr('string'),
htmlUrl: DS.attr('string'),
body: DS.attr('string'),
createdAt: DS.attr('date'),
updatedAt: DS.attr('date'),
closedAt: DS.attr('date'),
mergedAt: DS.attr('date'),
userLogin: DS.attr('string'),
userAvatarUrl: DS.attr('string'),
user: DS.belongsTo('githubUser', {
async: true,
inverse: null
})
export default Model.extend({
number: attr('number'),
title: attr('string'),
state: attr('string'),
htmlUrl: attr('string'),
body: attr('string'),
createdAt: attr('date'),
updatedAt: attr('date'),
closedAt: attr('date'),
mergedAt: attr('date'),
userLogin: attr('string'),
userAvatarUrl: attr('string'),

user: belongsTo('github-user', { inverse: null })
});
42 changes: 20 additions & 22 deletions addon/models/github-release.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,23 @@
import DS from 'ember-data';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { belongsTo } from 'ember-data/relationships';

export default DS.Model.extend({
name: DS.attr('string'),
url: DS.attr('string'),
htmlUrl: DS.attr('string'),
assetsUrl: DS.attr('string'),
uploadUrl: DS.attr('string'),
tarballUrl: DS.attr('string'),
zipballUrl: DS.attr('string'),
tagName: DS.attr('string'),
targetCommitish: DS.attr('string'),
body: DS.attr('string'),
draft: DS.attr('boolean'),
prerelease: DS.attr('boolean'),
createdAt: DS.attr('date'),
publishedAt: DS.attr('date'),
export default Model.extend({
name: attr('string'),
url: attr('string'),
htmlUrl: attr('string'),
assetsUrl: attr('string'),
uploadUrl: attr('string'),
tarballUrl: attr('string'),
zipballUrl: attr('string'),
tagName: attr('string'),
targetCommitish: attr('string'),
body: attr('string'),
draft: attr('boolean'),
prerelease: attr('boolean'),
createdAt: attr('date'),
publishedAt: attr('date'),

user: DS.belongsTo('githubUser', {
async: true,
inverse: null
}),

repository: DS.belongsTo('githubRepository')
user: belongsTo('github-user', { inverse: null }),
repository: belongsTo('github-repository')
});
43 changes: 20 additions & 23 deletions addon/models/github-repository.js
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
import DS from 'ember-data';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { belongsTo, hasMany } from 'ember-data/relationships';

export default DS.Model.extend({
fullName: DS.attr('string'),
name: DS.attr('string'),
htmlUrl: DS.attr('string'),
language: DS.attr('string'),
description: DS.attr('string'),
fork: DS.attr('boolean'),
private: DS.attr('boolean'),
createdAt: DS.attr('date'),
updatedAt: DS.attr('date'),
pushedAt: DS.attr('date'),
owner: DS.belongsTo('githubUser', {
async: true,
inverse: null
}),
defaultBranch: DS.belongsTo('githubBranch', {
async: true,
inverse: null
}),
branches: DS.hasMany('githubBranch', { async: true }),
pulls: DS.hasMany('githubPull', { async: true }),
releases: DS.hasMany('githubRelease', { async: true })
export default Model.extend({
fullName: attr('string'),
name: attr('string'),
htmlUrl: attr('string'),
language: attr('string'),
description: attr('string'),
fork: attr('boolean'),
private: attr('boolean'),
createdAt: attr('date'),
updatedAt: attr('date'),
pushedAt: attr('date'),

owner: belongsTo('github-user'),
defaultBranch: belongsTo('github-branch', { inverse: null }),
branches: hasMany('github-branch'),
pulls: hasMany('github-pull'),
releases: hasMany('github-release')
});
21 changes: 12 additions & 9 deletions addon/models/github-tree.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import DS from 'ember-data';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { hasMany } from 'ember-data/relationships';

export default DS.Model.extend({
sha: DS.attr('string'),
url: DS.attr('string'),
files: DS.attr(), // object
directories: DS.attr(), // object
blobs: DS.hasMany('github-blob', { async: true }),
trees: DS.hasMany('github-tree', { async: true }),
truncated: DS.attr('boolean')
export default Model.extend({
sha: attr('string'),
url: attr('string'),
files: attr(), // object
directories: attr(), // object
truncated: attr('boolean'),

blobs: hasMany('github-blob'),
trees: hasMany('github-tree')
});
43 changes: 23 additions & 20 deletions addon/models/github-user.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
import DS from 'ember-data';
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { hasMany } from 'ember-data/relationships';

export default DS.Model.extend({
login: DS.attr('string'),
name: DS.attr('string'),
type: DS.attr('string'),
avatarUrl: DS.attr('string'),
htmlUrl: DS.attr('string'),
publicRepos: DS.attr('number'),
publicGists: DS.attr('number'),
followers: DS.attr('number'),
following: DS.attr('number'),
createdAt: DS.attr('date'),
updatedAt: DS.attr('date'),
url: DS.attr('string'),
company: DS.attr('string'),
blog: DS.attr('string'),
location: DS.attr('string'),
email: DS.attr('string'),
bio: DS.attr('string'),
repositories: DS.hasMany('githubRepository', { async: true })
export default Model.extend({
login: attr('string'),
name: attr('string'),
type: attr('string'),
avatarUrl: attr('string'),
htmlUrl: attr('string'),
publicRepos: attr('number'),
publicGists: attr('number'),
followers: attr('number'),
following: attr('number'),
createdAt: attr('date'),
updatedAt: attr('date'),
url: attr('string'),
company: attr('string'),
blog: attr('string'),
location: attr('string'),
email: attr('string'),
bio: attr('string'),

repositories: hasMany('github-repository')
});
2 changes: 1 addition & 1 deletion tests/dummy/mirage/models/github-branch.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Model, belongsTo } from 'ember-cli-mirage';

export default Model.extend({
repository: belongsTo('githubRepository')
repository: belongsTo('github-repository')
});
4 changes: 2 additions & 2 deletions tests/dummy/mirage/models/github-organization.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Model, hasMany } from 'ember-cli-mirage';

export default Model.extend({
users: hasMany('githubUser'),
repositories: hasMany('githubRepository')
users: hasMany('github-user'),
repositories: hasMany('github-repository')
});
4 changes: 2 additions & 2 deletions tests/dummy/mirage/models/github-pull.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Model, belongsTo } from 'ember-cli-mirage';

export default Model.extend({
repository: belongsTo('githubRepository'),
user: belongsTo('githubUser')
repository: belongsTo('github-repository'),
user: belongsTo('github-user')
});
4 changes: 2 additions & 2 deletions tests/dummy/mirage/models/github-release.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Model, belongsTo } from 'ember-cli-mirage';

export default Model.extend({
repository: belongsTo('githubRepository'),
author: belongsTo('githubUser')
repository: belongsTo('github-repository'),
author: belongsTo('github-user')
});
8 changes: 4 additions & 4 deletions tests/dummy/mirage/models/github-repository.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Model, belongsTo, hasMany } from 'ember-cli-mirage';

export default Model.extend({
owner: belongsTo('githubUser', { inverse: null }),
defaultBranch: belongsTo('githubBranch', { inverse: null }),
pulls: hasMany('githubPull'),
branches: hasMany('githubBranch'),
releases: hasMany('githubRelease')
defaultBranch: belongsTo('github-branch', { inverse: null }),
pulls: hasMany('github-pull'),
branches: hasMany('github-branch'),
releases: hasMany('github-release')
});
4 changes: 2 additions & 2 deletions tests/dummy/mirage/models/github-user.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Model, hasMany } from 'ember-cli-mirage';

export default Model.extend({
repositories: hasMany('githubRepository'),
releases: hasMany('githubRelease')
repositories: hasMany('github-repository'),
releases: hasMany('github-release')
});

0 comments on commit d162bd1

Please sign in to comment.