mirror of
https://github.com/idolpx/csdb-ng.git
synced 2025-12-06 04:38:49 -05:00
Compare commits
No commits in common. "b6ff7deed26f43c41384dc287fd0e8074262010e" and "fcb2a05a4778ca4592130558cff7553218f8a2d7" have entirely different histories.
b6ff7deed2
...
fcb2a05a47
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
|
|
||||||
const globals = {
|
const globals = {
|
||||||
data_path: '/path/to/data'
|
data_path: '/var/www/csdbng/data'
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { globals }
|
module.exports = { globals }
|
||||||
|
|
@ -10,8 +10,7 @@
|
||||||
"author": "Jaime Idolpx",
|
"author": "Jaime Idolpx",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"apollo-server": "^3.13.0",
|
"apollo-server": "^3.7.0",
|
||||||
"graphql": "^16.5.0",
|
"graphql": "^16.5.0"
|
||||||
"mariadb": "^3.3.2"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
|
|
||||||
let globals = require('../config.js').globals;
|
let globals = require('../globals.js').globals;
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
|
|
||||||
Query: {
|
Query: {
|
||||||
bbs: (parent, { id }, context, info) => getBBS(id),
|
getBBS: (parent, { id }, context, info) => getBBS(id),
|
||||||
bbss: (parent, { id }, context, info) => getBBSs(id),
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -18,35 +17,24 @@ const resolvers = {
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
BBS: {
|
BBS: {
|
||||||
Groups: ({ GroupIDs }, args, context, info) => getGroups(GroupIDs),
|
GroupIDs: ({ GroupIDs }, args, context, info) => addGroups(GroupIDs, context),
|
||||||
Handles: ({ HandleIDs }, args, context, info) => getHandles(HandleIDs),
|
UserHandleIDs: ({ UserHandleIDs }, args, context, info) => addHandles(UserHandleIDs, context),
|
||||||
|
|
||||||
|
Groups: (parent, args, context, info) => context.Groups,
|
||||||
|
Handles: (parent, args, context, info) => context.Handles,
|
||||||
},
|
},
|
||||||
BBSSysop: {
|
BBSSysop: {
|
||||||
Handle: ({ HandleID }, args, context, info) => getHandle(HandleID),
|
HandleID: ({ HandleID }, args, context, info) => addHandle(HandleID, context),
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getBBSFile = id => `${globals.data_path}/bbs/${Math.floor(id/1000)}/${id}/bbs.${id}.json`;
|
getBBSFile = id => `${globals.data_path}/bbs/${id}/bbs.${id}.json`;
|
||||||
|
|
||||||
// Object loader
|
// Object loader
|
||||||
getBBS = id => {
|
getBBS = id => {
|
||||||
return loadJSON(getBBSFile(id));
|
return loadJSON(getBBSFile(id));
|
||||||
}
|
}
|
||||||
getBBSs = idArray => {
|
|
||||||
data = [];
|
|
||||||
try {
|
|
||||||
idArray.forEach( id => {
|
|
||||||
// Add object
|
|
||||||
data.push(getBBS(id));
|
|
||||||
})
|
|
||||||
}
|
|
||||||
catch(err) {
|
|
||||||
//console.log(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load object by ID or ID array
|
// Load object by ID or ID array
|
||||||
addBBS = (id, context) => {
|
addBBS = (id, context) => {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
|
|
||||||
let globals = require('../config.js').globals;
|
let globals = require('../globals.js').globals;
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
|
|
||||||
Query: {
|
Query: {
|
||||||
event: (parent, { id }, context, info) => getEvent(id),
|
getEvent: (parent, { id }, context, info) => getEvent(id),
|
||||||
events: (parent, { id }, context, info) => getEvents(id),
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -18,44 +17,32 @@ const resolvers = {
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
Event: {
|
Event: {
|
||||||
// Releases: (parent, args, context, info) => context.Releases,
|
Releases: (parent, args, context, info) => context.Releases,
|
||||||
|
Groups: (parent, args, context, info) => context.Groups,
|
||||||
|
Handles: (parent, args, context, info) => context.Handles,
|
||||||
},
|
},
|
||||||
EventCompo: {
|
EventCompo: {
|
||||||
Releases: ({ ReleaseIDs }, args, context, info) => getReleases(ReleaseIDs),
|
ReleaseIDs: ({ ReleaseIDs }, args, context, info) => addReleases(ReleaseIDs, context),
|
||||||
},
|
},
|
||||||
EventReport: {
|
EventReport: {
|
||||||
Handle: ({ HandleID }, args, context, info) => getHandle(HandleID),
|
HandleID: ({ HandleID }, args, context, info) => addHandle(HandleID, context),
|
||||||
},
|
},
|
||||||
EventComment: {
|
EventComment: {
|
||||||
Handle: ({ HandleID }, args, context, info) => getHandle(HandleID),
|
HandleID: ({ HandleID }, args, context, info) => addHandle(HandleID, context),
|
||||||
},
|
},
|
||||||
EventOrganizers: {
|
EventOrganizers: {
|
||||||
Groups: ({ GroupIDs }, args, context, info) => getGroups(GroupIDs),
|
GroupIDs: ({ GroupIDs }, args, context, info) => addGroups(GroupIDs, context),
|
||||||
Handles: ({ HandleIDs }, args, context, info) => getHandles(HandleIDs),
|
HandleIDs: ({ HandleIDs }, args, context, info) => addHandles(HandleIDs, context),
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getEventFile = id => `${globals.data_path}/event/${Math.floor(id/1000)}/${id}/event.${id}.json`;
|
getEventFile = id => `${globals.data_path}/event/${id}/event.${id}.json`;
|
||||||
|
|
||||||
// Object loader
|
// Object loader
|
||||||
getEvent = id => {
|
getEvent = id => {
|
||||||
return loadJSON(getEventFile(id));
|
return loadJSON(getEventFile(id));
|
||||||
}
|
}
|
||||||
getEvents = idArray => {
|
|
||||||
data = [];
|
|
||||||
try {
|
|
||||||
idArray.forEach( id => {
|
|
||||||
// Add object
|
|
||||||
data.push(getEvent(id));
|
|
||||||
})
|
|
||||||
}
|
|
||||||
catch(err) {
|
|
||||||
//console.log(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load object by ID or ID array
|
// Load object by ID or ID array
|
||||||
addEvent = (id, context) => {
|
addEvent = (id, context) => {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
|
|
||||||
let globals = require('../config.js').globals;
|
let globals = require('../globals.js').globals;
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
|
|
||||||
Query: {
|
Query: {
|
||||||
group: (parent, { id }, context, info) => getGroup(id),
|
getGroup: (parent, { id }, context, info) => getGroup(id),
|
||||||
groups: (parent, { id }, context, info) => getGroups(id),
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -18,43 +17,32 @@ const resolvers = {
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
Group: {
|
Group: {
|
||||||
FounderHandles: ({ FounderHandleIDs }, args, context, info) => getHandles(FounderHandleIDs),
|
ReleaseIDs: ({ ReleaseIDs }, args, context, info) => addReleases(ReleaseIDs, context),
|
||||||
OrganizedEvents: ({ OrganizedEventIDs }, args, context, info) => getEvents(OrganizedEventIDs),
|
FounderHandleIDs: ({ FounderHandleIDs }, args, context, info) => addHandles(FounderHandleIDs, context),
|
||||||
|
OrganizedEventIDs: ({ OrganizedEventIDs }, args, context, info) => addEvents(OrganizedEventIDs, context),
|
||||||
|
BBSIDs: ({ BBSIDs }, args, context, info) => addBBSs(BBSIDs, context),
|
||||||
|
|
||||||
Releases: ({ ReleaseIDs }, args, context, info) => getReleases(ReleaseIDs),
|
Releases: (parent, args, context, info) => context.Releases,
|
||||||
BBSs: ({ BBSIDs }, args, context, info) => getBBSs(BBSIDs),
|
Sceners: (parent, args, context, info) => context.Sceners,
|
||||||
|
Handles: (parent, args, context, info) => context.Handles,
|
||||||
CoOpGroups: ({ CoOpGroupIDs }, args, context, info) => getGroups(CoOpGroupIDs),
|
Events: (parent, args, context, info) => context.Events,
|
||||||
|
BBSs: (parent, args, context, info) => context.BBSs,
|
||||||
},
|
},
|
||||||
GroupCommentData: {
|
GroupCommentData: {
|
||||||
Handle: ({ HandleID }, args, context, info) => getHandle(HandleID),
|
ScenerID: ({ ScenerID }, args, context, info) => addScener(ScenerID, context),
|
||||||
},
|
},
|
||||||
GroupMember: {
|
GroupMember: {
|
||||||
Handle: ({ HandleID }, args, context, info) => getHandle(HandleID),
|
HandleID: ({ HandleID }, args, context, info) => addHandle(HandleID, context),
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getGroupFile = id => `${globals.data_path}/group/${Math.floor(id/1000)}/${id}/group.${id}.json`;
|
getGroupFile = id => `${globals.data_path}/group/${id}/group.${id}.json`;
|
||||||
|
|
||||||
// Object loader
|
// Object loader
|
||||||
getGroup = id => {
|
getGroup = id => {
|
||||||
return loadJSON(getGroupFile(id));
|
return loadJSON(getGroupFile(id));
|
||||||
}
|
}
|
||||||
getGroups = idArray => {
|
|
||||||
data = [];
|
|
||||||
try {
|
|
||||||
idArray.forEach( id => {
|
|
||||||
// Add object
|
|
||||||
data.push(getGroup(id));
|
|
||||||
})
|
|
||||||
}
|
|
||||||
catch(err) {
|
|
||||||
//console.log(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load object by ID or ID array
|
// Load object by ID or ID array
|
||||||
addGroup = (id, context) => {
|
addGroup = (id, context) => {
|
||||||
|
|
@ -62,7 +50,6 @@ addGroup = (id, context) => {
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
addGroups = (idArray, context) => {
|
addGroups = (idArray, context) => {
|
||||||
console.log(idArray);
|
|
||||||
try {
|
try {
|
||||||
idArray.forEach( id => {
|
idArray.forEach( id => {
|
||||||
// Add object if it isn't already added
|
// Add object if it isn't already added
|
||||||
|
|
@ -73,7 +60,7 @@ addGroups = (idArray, context) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
catch(err) {
|
catch(err) {
|
||||||
console.log(err);
|
// console.log(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
return idArray;
|
return idArray;
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
|
|
||||||
let globals = require('../config.js').globals;
|
let globals = require('../globals.js').globals;
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
|
|
||||||
Query: {
|
Query: {
|
||||||
handle: (parent, { id }, context, info) => getHandle(id),
|
getHandle: (parent, { id }, context, info) => getHandle(id),
|
||||||
handles: (parent, { id }, context, info) => getHandles(id),
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -18,47 +17,31 @@ const resolvers = {
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
Handle: {
|
Handle: {
|
||||||
FoundedGroups: ({ FoundedGroupIDs }, args, context, info) => getGroups(FoundedGroupIDs),
|
FoundedGroupIDs: ({ FoundedGroupIDs }, args, context, info) => addGroups(FoundedGroupIDs, context),
|
||||||
MemberGroups: ({ MemberGroupIDs }, args, context, info) => getGroups(MemberGroupIDs),
|
OrganizedEventIDs: ({ OrganizedEventIDs }, args, context, info) => addEvents(OrganizedEventIDs, context),
|
||||||
OrganizedEvents: ({ OrganizedGroupIDs }, args, context, info) => getGroups(OrganizedGroupIDs),
|
AttendedEventIDs: ({ AttendedEventIDs }, args, context, info) => addEvents(AttendedEventIDs, context),
|
||||||
AttendedEvents: ({ AttendedEventIDs }, args, context, info) => getEvents(AttendedEventIDs),
|
ScenerIDs: ({ ScenerIDs }, args, context, info) => addSceners(ScenerIDs, context),
|
||||||
|
|
||||||
BBSSysop: ({ BBSSysopIDs }, args, context, info) => getBBSs(BBSSysopIDs),
|
Releases: (parent, args, context, info) => context.Releases,
|
||||||
BBSUser: ({ BBSUserIDs }, args, context, info) => getBBSs(BBSUserIDs),
|
Groups: (parent, args, context, info) => context.Groups,
|
||||||
|
Sceners: (parent, args, context, info) => context.Sceners,
|
||||||
Releases: ({ ReleaseIDs }, args, context, info) => getReleases(ReleaseIDs),
|
Events: (parent, args, context, info) => context.Events,
|
||||||
Sceners: ({ ScenerIDs }, args, context, info) => getSceners(ScenerIDs),
|
|
||||||
},
|
},
|
||||||
HandleGroup: {
|
HandleGroup: {
|
||||||
Group: ({ GroupID }, args, context, info) => getGroup(GroupID),
|
GroupID: ({ GroupID }, args, context, info) => addGroup(GroupID, context),
|
||||||
},
|
},
|
||||||
HandleCredit: {
|
HandleCredit: {
|
||||||
Releases: ({ ReleaseIDs }, args, context, info) => getReleases(ReleaseIDs),
|
ReleaseID: ({ ReleaseID }, args, context, info) => addRelease(ReleaseID, context),
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getHandleFile = id => `${globals.data_path}/handle/${Math.floor(id/1000)}/${id}/handle.${id}.json`;
|
getHandleFile = id => `${globals.data_path}/handle/${id}/handle.${id}.json`;
|
||||||
|
|
||||||
// Object loader
|
// Object loader
|
||||||
getHandle = id => {
|
getHandle = id => {
|
||||||
return loadJSON(getHandleFile(id));
|
return loadJSON(getHandleFile(id));
|
||||||
}
|
}
|
||||||
getHandles = idArray => {
|
|
||||||
console.log(idArray)
|
|
||||||
data = [];
|
|
||||||
try {
|
|
||||||
idArray.forEach( id => {
|
|
||||||
// Add object
|
|
||||||
data.push(getHandle(id));
|
|
||||||
})
|
|
||||||
}
|
|
||||||
catch(err) {
|
|
||||||
//console.log(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load object by ID or ID array
|
// Load object by ID or ID array
|
||||||
addHandle = (id, context) => {
|
addHandle = (id, context) => {
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ loadJSON = filename => {
|
||||||
|
|
||||||
if ( !fs.existsSync(filename) )
|
if ( !fs.existsSync(filename) )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
const data = fs.readFileSync(filename, {encoding:'utf8', flag:'r'});
|
const data = fs.readFileSync(filename, {encoding:'utf8', flag:'r'});
|
||||||
|
|
||||||
if ( !data )
|
if ( !data )
|
||||||
|
|
@ -64,7 +64,7 @@ addElementToObjectArray = (object, array, element) => {
|
||||||
} else {
|
} else {
|
||||||
// No - Create the array
|
// No - Create the array
|
||||||
object[array] = [element];
|
object[array] = [element];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -86,4 +86,4 @@ objectExists = (object, array, id) => {
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { resolvers }
|
module.exports = { resolvers }
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
|
|
||||||
let globals = require('../config.js').globals;
|
let globals = require('../globals.js').globals;
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
|
|
||||||
Query: {
|
Query: {
|
||||||
release: (parent, { id }, context, info) => getRelease(id),
|
getRelease: (parent, { id }, context, info) => getRelease(id),
|
||||||
releases: (parent, { id }, context, info) => getReleases(id),
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -18,42 +17,34 @@ const resolvers = {
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
Release: {
|
Release: {
|
||||||
ReleasedAtEvent: ({ ReleasedAt }, args, context, info) => getEvent(ReleasedAt),
|
ReleasedAt: ({ ReleasedAt }, args, context, info) => addEvent(ReleasedAt, context),
|
||||||
SIDs: ({ SIDIDs }, args, context, info) => getSIDs(SIDIDs),
|
SIDIDs: ({ SIDIDs }, args, context, info) => addSIDs(SIDIDs, context),
|
||||||
|
|
||||||
|
Groups: (parent, args, context, info) => context.Groups,
|
||||||
|
Sceners: (parent, args, context, info) => context.Sceners,
|
||||||
|
Handles: (parent, args, context, info) => context.Handles,
|
||||||
|
Events: (parent, args, context, info) => context.Events,
|
||||||
|
SIDs: (parent, args, context, info) => context.SIDs,
|
||||||
},
|
},
|
||||||
ReleaseGroupsHandles: {
|
ReleaseGroupsHandles: {
|
||||||
Groups: ({ GroupIDs }, args, context, info) => getGroups(GroupIDs),
|
GroupIDs: ({ GroupIDs }, args, context, info) => addGroups(GroupIDs, context),
|
||||||
Handles: ({ HandleIDs }, args, context, info) => getHandles(HandleIDs),
|
HandleIDs: ({ HandleIDs }, args, context, info) => addHandles(HandleIDs, context),
|
||||||
},
|
},
|
||||||
ReleaseCredit: {
|
ReleaseCredit: {
|
||||||
Handles: ({ HandleIDs }, args, context, info) => getHandles(HandleIDs),
|
HandleID: ({ HandleID }, args, context, info) => addHandle(HandleID, context),
|
||||||
},
|
},
|
||||||
ReleaseCommentData: {
|
ReleaseCommentData: {
|
||||||
Handle: ({ HandleID }, args, context, info) => getHandle(HandleID),
|
ScenerID: ({ ScenerID }, args, context, info) => addScener(ScenerID, context),
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getReleaseFile = id => `${globals.data_path}/release/${Math.floor(id/1000)}/${id}/release.${id}.json`;
|
getReleaseFile = id => `${globals.data_path}/release/${id}/release.${id}.json`;
|
||||||
|
|
||||||
// Object loader
|
// Object loader
|
||||||
getRelease = id => {
|
getRelease = id => {
|
||||||
return loadJSON(getReleaseFile(id));
|
return loadJSON(getReleaseFile(id));
|
||||||
}
|
}
|
||||||
getReleases = idArray => {
|
|
||||||
data = [];
|
|
||||||
try {
|
|
||||||
idArray.forEach( id => {
|
|
||||||
// Add object
|
|
||||||
data.push(getRelease(id));
|
|
||||||
})
|
|
||||||
}
|
|
||||||
catch(err) {
|
|
||||||
console.log(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load object by ID or ID array
|
// Load object by ID or ID array
|
||||||
addRelease = (id, context) => {
|
addRelease = (id, context) => {
|
||||||
|
|
@ -71,7 +62,7 @@ addReleases = (idArray, context) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
catch(err) {
|
catch(err) {
|
||||||
console.log(err);
|
// console.log(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
return idArray;
|
return idArray;
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
|
|
||||||
let globals = require('../config.js').globals;
|
let globals = require('../globals.js').globals;
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
|
|
||||||
Query: {
|
Query: {
|
||||||
scener: (parent, { id }, context, info) => getScener(id),
|
getScener: (parent, { id }, context, info) => getScener(id),
|
||||||
sceners: (parent, { id }, context, info) => getSceners(id),
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -18,31 +17,18 @@ const resolvers = {
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
Scener: {
|
Scener: {
|
||||||
Handles: ({ HandleIDs }, args, context, info) => getHandles(HandleIDs),
|
HandleIDs: ({ HandleIDs }, args, context, info) => addHandles(HandleIDs, context),
|
||||||
|
Handles: (parent, args, context, info) => context.Handles,
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getScenerFile = id => `${globals.data_path}/scener/${Math.floor(id/1000)}/${id}/scener.${id}.json`;
|
getScenerFile = id => `${globals.data_path}/scener/${id}/scener.${id}.json`;
|
||||||
|
|
||||||
// Object loader
|
// Object loader
|
||||||
getScener = id => {
|
getScener = id => {
|
||||||
return loadJSON(getScenerFile(id));
|
return loadJSON(getScenerFile(id));
|
||||||
}
|
}
|
||||||
getSceners = idArray => {
|
|
||||||
data = [];
|
|
||||||
try {
|
|
||||||
idArray.forEach( id => {
|
|
||||||
// Add object
|
|
||||||
data.push(getScener(id));
|
|
||||||
})
|
|
||||||
}
|
|
||||||
catch(err) {
|
|
||||||
//console.log(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load object by ID or ID array
|
// Load object by ID or ID array
|
||||||
addScener = (id, context) => {
|
addScener = (id, context) => {
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
|
|
||||||
let globals = require('../config.js').globals;
|
let globals = require('../globals.js').globals;
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
|
|
||||||
Query: {
|
Query: {
|
||||||
sid: (parent, { id }, context, info) => getSID(id),
|
getSID: (parent, { id }, context, info) => getSID(id),
|
||||||
sids: (parent, { id }, context, info) => getSIDs(id),
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -18,31 +17,19 @@ const resolvers = {
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
SID: {
|
SID: {
|
||||||
Releases: ({ ReleaseIDs }, args, context, info) => getReleases(ReleaseIDs),
|
ReleaseIDs: ({ ReleaseIDs }, args, context, info) => addReleases(ReleaseIDs, context),
|
||||||
|
|
||||||
|
Releases: (parent, args, context, info) => context.Releases,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getSIDFile = id => `${globals.data_path}/sid/${Math.floor(id/1000)}/${id}/sid.${id}.json`;
|
getSIDFile = id => `${globals.data_path}/sid/${id}/sid.${id}.json`;
|
||||||
|
|
||||||
// Object loader
|
// Object loader
|
||||||
getSID = id => {
|
getSID = id => {
|
||||||
return loadJSON(getSIDFile(id));
|
return loadJSON(getSIDFile(id));
|
||||||
}
|
}
|
||||||
getSIDs = idArray => {
|
|
||||||
data = [];
|
|
||||||
try {
|
|
||||||
idArray.forEach( id => {
|
|
||||||
// Add object
|
|
||||||
data.push(getSID(id));
|
|
||||||
})
|
|
||||||
}
|
|
||||||
catch(err) {
|
|
||||||
//console.log(err);
|
|
||||||
}
|
|
||||||
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load object by ID or ID array
|
// Load object by ID or ID array
|
||||||
addSID = (id, context) => {
|
addSID = (id, context) => {
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@ type User {
|
||||||
|
|
||||||
MaintainerOf: UserRecords
|
MaintainerOf: UserRecords
|
||||||
|
|
||||||
# Enhanced Data
|
|
||||||
uuid: String
|
uuid: String
|
||||||
dateCreated: String
|
dateCreated: String
|
||||||
dateUpdated: String
|
dateUpdated: String
|
||||||
|
|
@ -36,36 +35,37 @@ type UserRecords {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type Release {
|
type Release {
|
||||||
ID: Int!
|
ID: Int!
|
||||||
Name: String!
|
Name: String!
|
||||||
AKA: String
|
AKA: String
|
||||||
Type: String # should go in tag
|
Type: String
|
||||||
GfxType: String # should go in tag
|
GfxType: String
|
||||||
Rating: Float
|
Rating: Float
|
||||||
ReleaseDate: [FuzzyDate]
|
ReleaseDate: [FuzzyDate]
|
||||||
|
|
||||||
ReleasedAt: Int
|
ReleasedAt: Int
|
||||||
ReleasedAtEvent: Event
|
|
||||||
Achievement: ReleaseAchievement
|
Achievement: ReleaseAchievement
|
||||||
ReleasedBy: ReleaseGroupsHandles
|
ReleasedBy: ReleaseGroupsHandles
|
||||||
Credits: [ReleaseCredit]
|
Credits: [ReleaseCredit]
|
||||||
|
|
||||||
Website: String
|
Website: String
|
||||||
ScreenShot: [String]
|
ScreenShot: String
|
||||||
DownloadLinks: [ReleaseDownload]
|
DownloadLinks: [ReleaseDownload]
|
||||||
OtherLinks: [ReleaseLink]
|
OtherLinks: [ReleaseLink]
|
||||||
|
|
||||||
Comments: [ReleaseComment]
|
Comments: [ReleaseComment]
|
||||||
|
|
||||||
SIDIDs: [Int]
|
SIDIDs: [Int]
|
||||||
SIDs: [SID]
|
|
||||||
|
|
||||||
# Enhanced Data
|
Groups: [Group]
|
||||||
|
Sceners: [Scener]
|
||||||
|
Handles: [Handle]
|
||||||
|
Events: [Event]
|
||||||
|
SIDs: [SID]
|
||||||
|
Tags: [String]
|
||||||
|
|
||||||
uuid: String
|
uuid: String
|
||||||
tags: [String]
|
|
||||||
dateCreated: String
|
dateCreated: String
|
||||||
dateUpdated: String
|
dateUpdated: String
|
||||||
deleted: Boolean
|
deleted: Boolean
|
||||||
|
|
@ -79,15 +79,12 @@ type ReleaseAchievement {
|
||||||
|
|
||||||
type ReleaseGroupsHandles {
|
type ReleaseGroupsHandles {
|
||||||
GroupIDs: [Int]
|
GroupIDs: [Int]
|
||||||
Groups: [Group]
|
|
||||||
HandleIDs: [Int]
|
HandleIDs: [Int]
|
||||||
Handles: [Handle]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReleaseCredit {
|
type ReleaseCredit {
|
||||||
CreditType: String!
|
CreditType: String!
|
||||||
HandleIDs: [Int]
|
HandleID: Int!
|
||||||
Handles: [Handle]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReleaseLink {
|
type ReleaseLink {
|
||||||
|
|
@ -103,13 +100,13 @@ type ReleaseDownload {
|
||||||
Filename: String
|
Filename: String
|
||||||
Link: String!
|
Link: String!
|
||||||
Status: String
|
Status: String
|
||||||
hash: String
|
crc32: String
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReleaseComment {
|
type ReleaseComment {
|
||||||
Summary: [ReleaseCommentData]
|
Summary: [ReleaseCommentData]
|
||||||
Trivia: [ReleaseCommentData]
|
Trivia: [ReleaseCommentData]
|
||||||
Goof: [ReleaseCommentData]
|
Goofs: [ReleaseCommentData]
|
||||||
HiddenPart: [ReleaseCommentData]
|
HiddenPart: [ReleaseCommentData]
|
||||||
ProductionNote: [ReleaseCommentData]
|
ProductionNote: [ReleaseCommentData]
|
||||||
UserComment: [ReleaseCommentData]
|
UserComment: [ReleaseCommentData]
|
||||||
|
|
@ -117,14 +114,11 @@ type ReleaseComment {
|
||||||
|
|
||||||
type ReleaseCommentData {
|
type ReleaseCommentData {
|
||||||
Date: Int!
|
Date: Int!
|
||||||
HandleID: Int!
|
ScenerID: Int!
|
||||||
Handle: Handle
|
|
||||||
Text: String!
|
Text: String!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type Group {
|
type Group {
|
||||||
ID: Int!
|
ID: Int!
|
||||||
Name: String!
|
Name: String!
|
||||||
|
|
@ -133,6 +127,7 @@ type Group {
|
||||||
Rating: Float
|
Rating: Float
|
||||||
Trivia: String
|
Trivia: String
|
||||||
BaseCountry: String
|
BaseCountry: String
|
||||||
|
IsCoOp: Boolean
|
||||||
|
|
||||||
FoundDate: [FuzzyDate]
|
FoundDate: [FuzzyDate]
|
||||||
DissolveDate: [FuzzyDate]
|
DissolveDate: [FuzzyDate]
|
||||||
|
|
@ -140,26 +135,22 @@ type Group {
|
||||||
Website: String
|
Website: String
|
||||||
Grouptypes: [String]
|
Grouptypes: [String]
|
||||||
Slogan: [String]
|
Slogan: [String]
|
||||||
|
|
||||||
FounderHandleIDs: [Int]
|
|
||||||
FounderHandles: [Handle]
|
|
||||||
OrganizedEventIDs: [Int]
|
|
||||||
OrganizedEvents: [Event]
|
|
||||||
Members: [GroupMember]
|
|
||||||
|
|
||||||
ReleaseIDs: [Int]
|
|
||||||
Releases: [Release]
|
|
||||||
BBSIDs: [Int]
|
|
||||||
BBSs: [BBS]
|
|
||||||
|
|
||||||
UserComment: [GroupCommentData]
|
UserComment: [GroupCommentData]
|
||||||
|
|
||||||
# Enhanced Data
|
ReleaseIDs: [Int]
|
||||||
CoOpGroupIDs: [Int]
|
Members: [GroupMember]
|
||||||
CoOpGroups: [Group]
|
FounderHandleIDs: [Int]
|
||||||
|
OrganizedEventIDs: [Int]
|
||||||
|
BBSIDs: [Int]
|
||||||
|
|
||||||
|
Releases: [Release]
|
||||||
|
Sceners: [Scener]
|
||||||
|
Handles: [Handle]
|
||||||
|
Events: [Event]
|
||||||
|
BBSs: [BBS]
|
||||||
|
Tags: [String]
|
||||||
|
|
||||||
uuid: String
|
uuid: String
|
||||||
tags: [String]
|
|
||||||
dateCreated: String
|
dateCreated: String
|
||||||
dateUpdated: String
|
dateUpdated: String
|
||||||
deleted: Boolean
|
deleted: Boolean
|
||||||
|
|
@ -168,14 +159,13 @@ type Group {
|
||||||
|
|
||||||
type GroupCommentData {
|
type GroupCommentData {
|
||||||
Date: Int!
|
Date: Int!
|
||||||
HandleID: Int!
|
ScenerID: Int!
|
||||||
Handle: Handle
|
|
||||||
Text: String!
|
Text: String!
|
||||||
}
|
}
|
||||||
|
|
||||||
type GroupMember {
|
type GroupMember {
|
||||||
HandleID: Int!
|
GroupID: Int
|
||||||
Handle: Handle
|
HandleID: Int
|
||||||
Profession: [String]
|
Profession: [String]
|
||||||
|
|
||||||
JoinDate: [FuzzyDate]
|
JoinDate: [FuzzyDate]
|
||||||
|
|
@ -185,8 +175,6 @@ type GroupMember {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type Scener {
|
type Scener {
|
||||||
ID: Int!
|
ID: Int!
|
||||||
RegisterdDate: String
|
RegisterdDate: String
|
||||||
|
|
@ -196,11 +184,10 @@ type Scener {
|
||||||
DeathDate: [FuzzyDate]
|
DeathDate: [FuzzyDate]
|
||||||
|
|
||||||
HandleIDs: [Int]
|
HandleIDs: [Int]
|
||||||
|
|
||||||
Handles: [Handle]
|
Handles: [Handle]
|
||||||
|
|
||||||
# Enhanced Data
|
|
||||||
uuid: String
|
uuid: String
|
||||||
tags: [String]
|
|
||||||
dateCreated: String
|
dateCreated: String
|
||||||
dateUpdated: String
|
dateUpdated: String
|
||||||
deleted: Boolean
|
deleted: Boolean
|
||||||
|
|
@ -208,8 +195,6 @@ type Scener {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type Handle {
|
type Handle {
|
||||||
ID: Int!
|
ID: Int!
|
||||||
Handle: String!
|
Handle: String!
|
||||||
|
|
@ -220,28 +205,16 @@ type Handle {
|
||||||
Credits: [HandleCredit]
|
Credits: [HandleCredit]
|
||||||
|
|
||||||
FoundedGroupIDs: [Int]
|
FoundedGroupIDs: [Int]
|
||||||
FoundedGroups: [Group]
|
|
||||||
MemberGroupIDs: [Int]
|
|
||||||
MemberGroups: [Group]
|
|
||||||
|
|
||||||
OrganizedEventIDs: [Int]
|
OrganizedEventIDs: [Int]
|
||||||
OrganizedEvents: [Event]
|
|
||||||
AttendedEventIDs: [Int]
|
AttendedEventIDs: [Int]
|
||||||
AttendedEvents: [Event]
|
|
||||||
|
|
||||||
BBSSysopIDs: [Int]
|
|
||||||
BBSSysop: [BBS]
|
|
||||||
BBSUserIDs: [Int]
|
|
||||||
BBSUser: [BBS]
|
|
||||||
|
|
||||||
ReleaseIDs: [Int]
|
|
||||||
Releases: [Release]
|
|
||||||
ScenerIDs: [Int]
|
ScenerIDs: [Int]
|
||||||
Sceners: [Scener]
|
|
||||||
|
|
||||||
# Enhanced Data
|
Releases: [Release]
|
||||||
|
Groups: [Group]
|
||||||
|
Sceners: [Scener]
|
||||||
|
Events: [Event]
|
||||||
|
|
||||||
uuid: String
|
uuid: String
|
||||||
tags: [String]
|
|
||||||
dateCreated: String
|
dateCreated: String
|
||||||
dateUpdated: String
|
dateUpdated: String
|
||||||
deleted: Boolean
|
deleted: Boolean
|
||||||
|
|
@ -251,18 +224,14 @@ type Handle {
|
||||||
type HandleGroup {
|
type HandleGroup {
|
||||||
GroupID: Int!
|
GroupID: Int!
|
||||||
MemberStats: GroupMember
|
MemberStats: GroupMember
|
||||||
Group: Group
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type HandleCredit {
|
type HandleCredit {
|
||||||
CreditType: String!
|
CreditType: String!
|
||||||
ReleaseIDs: [Int]
|
ReleaseID: Int!
|
||||||
Releases: [Release]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type Event {
|
type Event {
|
||||||
ID: Int!
|
ID: Int!
|
||||||
Name: String!
|
Name: String!
|
||||||
|
|
@ -280,14 +249,17 @@ type Event {
|
||||||
Country: String
|
Country: String
|
||||||
Website: String
|
Website: String
|
||||||
|
|
||||||
Organizers: EventOrganizers
|
OrganizerGroup: Group
|
||||||
Compo: [EventCompo]
|
Compo: [EventCompo]
|
||||||
PartyReport: [EventReport]
|
PartyReport: [EventReport]
|
||||||
UserComment: [EventComment]
|
UserComment: [EventComment]
|
||||||
|
Organizers: EventOrganizers
|
||||||
|
|
||||||
|
Releases: [Release]
|
||||||
|
Groups: [Group]
|
||||||
|
Handles: [Handle]
|
||||||
|
|
||||||
# Enhanced Data
|
|
||||||
uuid: String
|
uuid: String
|
||||||
tags: [String]
|
|
||||||
dateCreated: String
|
dateCreated: String
|
||||||
dateUpdated: String
|
dateUpdated: String
|
||||||
deleted: Boolean
|
deleted: Boolean
|
||||||
|
|
@ -297,7 +269,6 @@ type Event {
|
||||||
type EventCompo {
|
type EventCompo {
|
||||||
Type: String
|
Type: String
|
||||||
ReleaseIDs: [Int]
|
ReleaseIDs: [Int]
|
||||||
Releases: [Release]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type EventReport {
|
type EventReport {
|
||||||
|
|
@ -306,26 +277,19 @@ type EventReport {
|
||||||
Date: Int
|
Date: Int
|
||||||
Headline: String
|
Headline: String
|
||||||
Text: String
|
Text: String
|
||||||
Handle: Handle
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type EventComment {
|
type EventComment {
|
||||||
HandleID: Int!
|
HandleID: Int!
|
||||||
Date: Int!
|
Date: Int!
|
||||||
Text: String!
|
Text: String!
|
||||||
Handle: Handle
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type EventOrganizers {
|
type EventOrganizers {
|
||||||
GroupIDs: [Int]
|
GroupIDs: [Int]
|
||||||
Groups: [Group]
|
|
||||||
HandleIDs: [Int]
|
HandleIDs: [Int]
|
||||||
Handles: [Handle]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type BBS {
|
type BBS {
|
||||||
ID: Int!
|
ID: Int!
|
||||||
Name: String!
|
Name: String!
|
||||||
|
|
@ -343,13 +307,12 @@ type BBS {
|
||||||
Status: String
|
Status: String
|
||||||
|
|
||||||
GroupIDs: [Int]
|
GroupIDs: [Int]
|
||||||
|
UserHandleIDs: [Int]
|
||||||
|
|
||||||
Groups: [Group]
|
Groups: [Group]
|
||||||
HandleIDs: [Int]
|
|
||||||
Handles: [Handle]
|
Handles: [Handle]
|
||||||
|
|
||||||
# Enhanced Data
|
|
||||||
uuid: String
|
uuid: String
|
||||||
tags: [String]
|
|
||||||
dateCreated: String
|
dateCreated: String
|
||||||
dateUpdated: String
|
dateUpdated: String
|
||||||
deleted: Boolean
|
deleted: Boolean
|
||||||
|
|
@ -364,12 +327,9 @@ type BBSOnlinePeriod {
|
||||||
type BBSSysop {
|
type BBSSysop {
|
||||||
Type: String
|
Type: String
|
||||||
HandleID: Int
|
HandleID: Int
|
||||||
Handle: Handle
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type SID {
|
type SID {
|
||||||
ID: Int!
|
ID: Int!
|
||||||
HVSCPath: String
|
HVSCPath: String
|
||||||
|
|
@ -386,11 +346,10 @@ type SID {
|
||||||
DataSize: Int
|
DataSize: Int
|
||||||
|
|
||||||
ReleaseIDs: [Int]
|
ReleaseIDs: [Int]
|
||||||
|
|
||||||
Releases: [Release]
|
Releases: [Release]
|
||||||
|
|
||||||
# Enhanced Data
|
|
||||||
uuid: String
|
uuid: String
|
||||||
tags: [String]
|
|
||||||
dateCreated: String
|
dateCreated: String
|
||||||
dateUpdated: String
|
dateUpdated: String
|
||||||
deleted: Boolean
|
deleted: Boolean
|
||||||
|
|
@ -398,29 +357,14 @@ type SID {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type Query {
|
type Query {
|
||||||
release(id: Int!) : Release
|
getRelease(id: Int!) : Release
|
||||||
releases(id: [Int]!) : [Release]
|
getGroup(id: Int!) : Group
|
||||||
|
getScener(id: Int!) : Scener
|
||||||
group(id: Int!) : Group
|
getHandle(id: Int!) : Handle
|
||||||
groups(id: [Int]!) : [Group]
|
getEvent(id: Int!) : Event
|
||||||
|
getBBS(id: Int!) : BBS
|
||||||
scener(id: Int!) : Scener
|
getSID(id: Int!) : SID
|
||||||
sceners(id: [Int]!) : [Scener]
|
|
||||||
|
|
||||||
handle(id: Int!) : Handle
|
|
||||||
handles(id: [Int]!) : [Handle]
|
|
||||||
|
|
||||||
event(id: Int!) : Event
|
|
||||||
events(id: [Int]!) : [Event]
|
|
||||||
|
|
||||||
bbs(id: Int!) : BBS
|
|
||||||
bbss(id: [Int]!) : [BBS]
|
|
||||||
|
|
||||||
sid(id: Int!) : SID
|
|
||||||
sids(id: [Int]!) : [SID]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type Mutation {
|
type Mutation {
|
||||||
|
|
@ -447,4 +391,4 @@ type Mutation {
|
||||||
deleteEvent(id: Int!) : Event
|
deleteEvent(id: Int!) : Event
|
||||||
deleteBBS(id: Int!) : BBS
|
deleteBBS(id: Int!) : BBS
|
||||||
deleteSID(id: Int!) : SID
|
deleteSID(id: Int!) : SID
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user