Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import { hasMany, belongsTo } from 'ember-data/relationships';
export default Model.extend({
type: attr('string', { defaultValue: 'Company' }),
name: attr('string'),
profile: belongsTo('profile', { async: false }),
users: hasMany('user', { async: true, inverse: 'company' }),
projects: hasMany('project', { async: true })
});
import Model from 'ember-data/model';
import attr from 'ember-data/attr';
import {belongsTo, hasMany} from 'ember-data/relationships';
export default Model.extend({
changeTracker: { trackHasMany: true, auto: false, enableIsDirty: true },
title: attr('string'),
blob: attr(),
company: belongsTo('company', { async: true }),
details: hasMany('detail')
});
validator('presence', true),
]
});
export default Base.extend(Validations, {
disabledReason: attr('string'),
externalUserId: attr('string'),
kind: attr('string'),
shareFrom: attr('boolean'),
shareTo: attr('boolean'),
syncTo: attr('boolean'),
token: attr('string'),
user: belongsTo('user'),
libraryEntryLogs: hasMany('library-entry-log', { async: false }),
});
name: attr('string'),
neighborsCount: attr('number'),
nsfw: attr('boolean'),
privacy: attr('string', { defaultValue: 'open' }),
rules: attr('string'),
rulesFormatted: attr('string'),
slug: attr('string'),
tagline: attr('string'),
category: belongsTo('group-category', { async: false }),
categoryHack: attr('boolean'),
actionLogs: hasMany('group-action-log', { inverse: 'group' }),
invites: hasMany('group-invite', { inverse: 'group' }),
members: hasMany('group-member', { inverse: 'group' }),
neighbors: hasMany('group-neighbor', { inverse: 'source' }),
reports: hasMany('group-report', { inverse: 'group' }),
tickets: hasMany('group-ticket', { inverse: 'group' }),
isOpen: equal('privacy', 'isOpen'),
isClosed: equal('privacy', 'closed'),
isRestricted: equal('privacy', 'restricted')
});
heardFrom : attr('string'),
complexFieldValues : attr(),
segmentedLinkWebsite : computedSegmentedLink.bind(this)('website'),
segmentedLinkTwitter : computedSegmentedLink.bind(this)('twitter'),
segmentedLinkGithub : computedSegmentedLink.bind(this)('github'),
segmentedLinkFacebook : computedSegmentedLink.bind(this)('facebook'),
segmentedLinkLinkedIn : computedSegmentedLink.bind(this)('linkedin'),
/**
* Relationships
*/
user : belongsTo('user'),
event : belongsTo('event'),
sessions : hasMany('session')
});
export default Model.extend({
blocked: attr('boolean'),
content: attr('string'),
contentFormatted: attr('string'),
createdAt: attr('date', { defaultValue() { return new Date(); } }),
deletedAt: attr('date'),
likesCount: attr('number'),
repliesCount: attr('number'),
parent: belongsTo('comment', { inverse: 'replies' }),
post: belongsTo('post', { inverse: 'comments' }),
user: belongsTo('user'),
likes: hasMany('comment-like', { inverse: 'comment' }),
replies: hasMany('comment', { inverse: 'parent' })
});
iconLargeUrl: attr(),
iconThumbUrl: attr(),
longDescriptionBody: attr(),
longDescriptionMarkdown: attr(),
openTasksCount: attr('number'),
shouldLinkExternally: attr(),
slug: attr(),
title: attr(),
totalMonthlyDonated: attr('dollar-cents'),
website: attr(),
categories: hasMany('category', { async: true }),
donationGoals: hasMany('donation-goal', { async: true }),
githubRepos: hasMany('github-repo', { async: true }),
organization: belongsTo('organization', { async: true }),
taskLists: hasMany('task-list', { async: true }),
tasks: hasMany('tasks', { async: true }),
projectCategories: hasMany('project-category', { async: true }),
projectSkills: hasMany('project-skill', { async: true }),
projectUsers: hasMany('project-user', { async: true }),
stripeConnectPlan: belongsTo('stripe-connect-plan', { async: true }),
currentDonationGoal: computed('_currentGoals', function() {
return get(this, '_currentGoals.firstObject');
}),
hasOpenTasks: gt('openTasksCount', 0),
_currentGoals: filterBy('donationGoals', 'current', true)
});
isDeprecated: attr('boolean'),
note: attr('string'),
isOfficial: attr('boolean'),
isCliDependency: attr('boolean'),
isHidden: attr('boolean'),
hasInvalidGithubRepo: attr('boolean'),
score: attr('number'),
ranking: attr('number'),
githubUsers: hasMany('github-user'),
lastMonthDownloads: attr('number'),
isWip: attr('boolean'),
isTopDownloaded: attr('boolean'),
isTopStarred: attr('boolean'),
demoUrl: attr('string'),
githubStats: belongsTo('github-stats', { async: true }),
categories: hasMany('category', { async: false }),
keywords: hasMany('keyword', { async: true }),
versions: hasMany('version', { async: true }),
maintainers: hasMany('maintainer', { async: true }),
reviews: hasMany('review', { async: true }),
readme: belongsTo('readme', { async: true }),
hasMoreThan1Contributor: gt('githubUsers.length', 1),
npmUrl: computed('name', function() {
return `https://www.npmjs.com/package/${this.get('name')}`;
}),
escapedName: computed('name', function() {
return this.get('name').replace('/', '%2F');
}),
isNewAddon: computed('publishedDate', function() {
return moment(this.get('publishedDate')).isAfter(moment().subtract(2, 'weeks'));
})
});
const { inject: { service }, computed, isEmpty } = Ember;
export default Model.extend({
me: service(),
title: attr(),
body: attr(),
'support-count': attr(),
author: belongsTo('participant'),
supports: hasMany(),
suggestions: hasMany(),
delegates: hasMany('participant'),
delegations: hasMany(),
counterProposals: hasMany('proposal', { inverse: 'previousProposal' }),
previousProposal: belongsTo('proposal', { inverse: 'counterProposals' }),
authoredByMe: computed('author.id', 'me.id', function() {
return this.get('author.id') === this.get('me.id');
}),
backedByMe: computed('supports.[]', 'me.supports.[]', function() {
return this.get('me').supporting(this);
}),
supportDelegated: computed('currentDelegate', function() {
return this.get('currentDelegate') ? true : false;
}),
currentDelegate: computed('delegates.[]', 'me.delegates.[]', function() {
const proposalDelegates = this.get('delegates').toArray();
event_time_zone: DS.attr('string'),
all_day: DS.attr('string'),
venue_id: DS.attr('string'),
venue_name: DS.attr('string'),
venue_address: DS.attr('string'),
postal_code: DS.attr('string'),
venue_url: DS.attr('string'),
geocode_type: DS.attr('string'),
latitude: DS.attr('string'),
longitude: DS.attr('string'),
image_information: DS.attr('string'),
medium_image_url: DS.attr('string'),
city: belongsTo('city'),
attraction_suggestions: hasMany('attraction_suggestion', {
inverse: 'attraction'
}),
attraction_categories: hasMany('attraction_category', {
inverse: 'attraction'
}),
});