mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
Refactor all dependencies without dependencies
This commit is contained in:
parent
ee5a2349c0
commit
63939fa9e0
@ -1,15 +1,19 @@
|
||||
import { Factory } from 'rosie'
|
||||
import { getNeode } from '../db/neo4j'
|
||||
|
||||
const neode = getNeode()
|
||||
|
||||
Factory.define('badge')
|
||||
.attr('type', 'crowdfunding')
|
||||
.attr('status', 'permanent')
|
||||
.after((buildObject, options) => {
|
||||
return neode.create('Badge', buildObject)
|
||||
})
|
||||
|
||||
export default function create() {
|
||||
return {
|
||||
factory: async ({ args, neodeInstance }) => {
|
||||
const defaults = {
|
||||
type: 'crowdfunding',
|
||||
status: 'permanent',
|
||||
}
|
||||
args = {
|
||||
...defaults,
|
||||
...args,
|
||||
}
|
||||
return neodeInstance.create('Badge', args)
|
||||
factory: ({ args, neodeInstance }) => {
|
||||
return Factory.build('badge', args)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,18 +1,21 @@
|
||||
import uuid from 'uuid/v4'
|
||||
import { Factory } from 'rosie'
|
||||
import { getNeode } from '../db/neo4j'
|
||||
|
||||
const neode = getNeode()
|
||||
|
||||
Factory.define('category')
|
||||
.attr('id', uuid)
|
||||
.attr('icon', 'img/badges/fundraisingbox_de_airship.svg')
|
||||
.attr('name', 'Some category name')
|
||||
.after((buildObject, options) => {
|
||||
return neode.create('Category', buildObject)
|
||||
})
|
||||
|
||||
export default function create() {
|
||||
return {
|
||||
factory: async ({ args, neodeInstance }) => {
|
||||
const defaults = {
|
||||
id: uuid(),
|
||||
icon: 'img/badges/fundraisingbox_de_airship.svg',
|
||||
name: 'Some category name',
|
||||
}
|
||||
args = {
|
||||
...defaults,
|
||||
...args,
|
||||
}
|
||||
return neodeInstance.create('Category', args)
|
||||
return Factory.build('category', args)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,18 +1,21 @@
|
||||
import uuid from 'uuid/v4'
|
||||
import { Factory } from 'rosie'
|
||||
import { getNeode } from '../db/neo4j'
|
||||
|
||||
const neode = getNeode()
|
||||
|
||||
Factory.define('donations')
|
||||
.attr('id', uuid)
|
||||
.attr('goal', 15000)
|
||||
.attr('progress', 0)
|
||||
.after((buildObject, options) => {
|
||||
return neode.create('Donations', buildObject)
|
||||
})
|
||||
|
||||
export default function create() {
|
||||
return {
|
||||
factory: async ({ args, neodeInstance }) => {
|
||||
const defaults = {
|
||||
id: uuid(),
|
||||
goal: 15000,
|
||||
progress: 0,
|
||||
}
|
||||
args = {
|
||||
...defaults,
|
||||
...args,
|
||||
}
|
||||
return neodeInstance.create('Donations', args)
|
||||
return Factory.build('donations', args)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,22 +1,24 @@
|
||||
import faker from 'faker'
|
||||
import { Factory } from 'rosie'
|
||||
import { getNeode } from '../db/neo4j'
|
||||
|
||||
export function defaults({ args }) {
|
||||
const defaults = {
|
||||
email: faker.internet.email(),
|
||||
verifiedAt: new Date().toISOString(),
|
||||
}
|
||||
args = {
|
||||
...defaults,
|
||||
...args,
|
||||
}
|
||||
return args
|
||||
export const defaults = {
|
||||
email: faker.internet.email,
|
||||
verifiedAt: () => new Date().toISOString(),
|
||||
}
|
||||
|
||||
const neode = getNeode()
|
||||
|
||||
Factory.define('emailAddress')
|
||||
.attr(defaults)
|
||||
.after((buildObject, options) => {
|
||||
return neode.create('EmailAddress', buildObject)
|
||||
})
|
||||
|
||||
export default function create() {
|
||||
return {
|
||||
factory: async ({ args, neodeInstance }) => {
|
||||
args = defaults({ args })
|
||||
return neodeInstance.create('EmailAddress', args)
|
||||
return Factory.build('emailAddress', args)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,24 +1,30 @@
|
||||
import { Factory } from 'rosie'
|
||||
import { getNeode } from '../db/neo4j'
|
||||
|
||||
const neode = getNeode()
|
||||
|
||||
Factory.define('location')
|
||||
.attrs({
|
||||
name: 'Germany',
|
||||
namePT: 'Alemanha',
|
||||
nameDE: 'Deutschland',
|
||||
nameES: 'Alemania',
|
||||
nameNL: 'Duitsland',
|
||||
namePL: 'Niemcy',
|
||||
nameFR: 'Allemagne',
|
||||
nameIT: 'Germania',
|
||||
nameEN: 'Germany',
|
||||
id: 'country.10743216036480410',
|
||||
type: 'country',
|
||||
})
|
||||
.after((buildObject, options) => {
|
||||
return neode.create('Location', buildObject)
|
||||
})
|
||||
|
||||
export default function create() {
|
||||
return {
|
||||
factory: async ({ args, neodeInstance }) => {
|
||||
const defaults = {
|
||||
name: 'Germany',
|
||||
namePT: 'Alemanha',
|
||||
nameDE: 'Deutschland',
|
||||
nameES: 'Alemania',
|
||||
nameNL: 'Duitsland',
|
||||
namePL: 'Niemcy',
|
||||
nameFR: 'Allemagne',
|
||||
nameIT: 'Germania',
|
||||
nameEN: 'Germany',
|
||||
id: 'country.10743216036480410',
|
||||
type: 'country',
|
||||
}
|
||||
args = {
|
||||
...defaults,
|
||||
...args,
|
||||
}
|
||||
return neodeInstance.create('Location', args)
|
||||
return Factory.build('location', args)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,7 +1,16 @@
|
||||
import { Factory } from 'rosie'
|
||||
import { getNeode } from '../db/neo4j'
|
||||
|
||||
const neode = getNeode()
|
||||
|
||||
Factory.define('report').after((buildObject, options) => {
|
||||
return neode.create('Report', buildObject)
|
||||
})
|
||||
|
||||
export default function create() {
|
||||
return {
|
||||
factory: async ({ args, neodeInstance }) => {
|
||||
return neodeInstance.create('Report', args)
|
||||
factory: async ({ args }) => {
|
||||
return Factory.build('report', args)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,14 +1,20 @@
|
||||
import { Factory } from 'rosie'
|
||||
import { getNeode } from '../db/neo4j'
|
||||
|
||||
const neode = getNeode()
|
||||
|
||||
Factory.define('socialMedia')
|
||||
.attrs({
|
||||
url: 'https://mastodon.social/@Gargron',
|
||||
})
|
||||
.after((buildObject, options) => {
|
||||
return neode.create('SocialMedia', buildObject)
|
||||
})
|
||||
|
||||
export default function create() {
|
||||
return {
|
||||
factory: async ({ args, neodeInstance }) => {
|
||||
const defaults = {
|
||||
url: 'https://mastodon.social/@Gargron',
|
||||
}
|
||||
args = {
|
||||
...defaults,
|
||||
...args,
|
||||
}
|
||||
return neodeInstance.create('SocialMedia', args)
|
||||
return Factory.build('socialMedia', args)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,20 @@
|
||||
import { Factory } from 'rosie'
|
||||
import { getNeode } from '../db/neo4j'
|
||||
|
||||
const neode = getNeode()
|
||||
|
||||
Factory.define('tag')
|
||||
.attrs({
|
||||
name: '#human-connection',
|
||||
})
|
||||
.after((buildObject, options) => {
|
||||
return neode.create('Tag', buildObject)
|
||||
})
|
||||
|
||||
export default function create() {
|
||||
return {
|
||||
factory: async ({ args, neodeInstance }) => {
|
||||
const defaults = { name: '#human-connection' }
|
||||
args = {
|
||||
...defaults,
|
||||
...args,
|
||||
}
|
||||
return neodeInstance.create('Tag', args)
|
||||
return Factory.build('tag', args)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,10 +1,19 @@
|
||||
import { defaults } from './emailAddresses.js'
|
||||
import { Factory } from 'rosie'
|
||||
import { getNeode } from '../db/neo4j'
|
||||
|
||||
const neode = getNeode()
|
||||
|
||||
Factory.define('unverifiedEmailAddress')
|
||||
.attr(defaults)
|
||||
.after((buildObject, options) => {
|
||||
return neode.create('UnverifiedEmailAddress', buildObject)
|
||||
})
|
||||
|
||||
export default function create() {
|
||||
return {
|
||||
factory: async ({ args, neodeInstance }) => {
|
||||
args = defaults({ args })
|
||||
return neodeInstance.create('UnverifiedEmailAddress', args)
|
||||
return Factory.build('unverifiedEmailAddress', args)
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user