mirror of
https://github.com/idolpx/csdb-ng.git
synced 2025-12-05 20:28:49 -05:00
Compare commits
10 Commits
fcb2a05a47
...
b6ff7deed2
| Author | SHA1 | Date | |
|---|---|---|---|
| b6ff7deed2 | |||
| b9c208c09a | |||
| c93d6c6653 | |||
| 743af25e0e | |||
| 4d3058081b | |||
| 93f11947d1 | |||
| 391b9b5440 | |||
| b4f437571e | |||
| 8330bf1dcf | |||
| d1ddf17dd4 |
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
|
|
||||||
const globals = {
|
const globals = {
|
||||||
data_path: '/var/www/csdbng/data'
|
data_path: '/path/to/data'
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = { globals }
|
module.exports = { globals }
|
||||||
|
|
@ -10,7 +10,8 @@
|
||||||
"author": "Jaime Idolpx",
|
"author": "Jaime Idolpx",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"apollo-server": "^3.7.0",
|
"apollo-server": "^3.13.0",
|
||||||
"graphql": "^16.5.0"
|
"graphql": "^16.5.0",
|
||||||
|
"mariadb": "^3.3.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
|
|
||||||
let globals = require('../globals.js').globals;
|
let globals = require('../config.js').globals;
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
|
|
||||||
Query: {
|
Query: {
|
||||||
getBBS: (parent, { id }, context, info) => getBBS(id),
|
bbs: (parent, { id }, context, info) => getBBS(id),
|
||||||
|
bbss: (parent, { id }, context, info) => getBBSs(id),
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -17,24 +18,35 @@ const resolvers = {
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
BBS: {
|
BBS: {
|
||||||
GroupIDs: ({ GroupIDs }, args, context, info) => addGroups(GroupIDs, context),
|
Groups: ({ GroupIDs }, args, context, info) => getGroups(GroupIDs),
|
||||||
UserHandleIDs: ({ UserHandleIDs }, args, context, info) => addHandles(UserHandleIDs, context),
|
Handles: ({ HandleIDs }, args, context, info) => getHandles(HandleIDs),
|
||||||
|
|
||||||
Groups: (parent, args, context, info) => context.Groups,
|
|
||||||
Handles: (parent, args, context, info) => context.Handles,
|
|
||||||
},
|
},
|
||||||
BBSSysop: {
|
BBSSysop: {
|
||||||
HandleID: ({ HandleID }, args, context, info) => addHandle(HandleID, context),
|
Handle: ({ HandleID }, args, context, info) => getHandle(HandleID),
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getBBSFile = id => `${globals.data_path}/bbs/${id}/bbs.${id}.json`;
|
getBBSFile = id => `${globals.data_path}/bbs/${Math.floor(id/1000)}/${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,10 +1,11 @@
|
||||||
|
|
||||||
let globals = require('../globals.js').globals;
|
let globals = require('../config.js').globals;
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
|
|
||||||
Query: {
|
Query: {
|
||||||
getEvent: (parent, { id }, context, info) => getEvent(id),
|
event: (parent, { id }, context, info) => getEvent(id),
|
||||||
|
events: (parent, { id }, context, info) => getEvents(id),
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -17,32 +18,44 @@ 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: {
|
||||||
ReleaseIDs: ({ ReleaseIDs }, args, context, info) => addReleases(ReleaseIDs, context),
|
Releases: ({ ReleaseIDs }, args, context, info) => getReleases(ReleaseIDs),
|
||||||
},
|
},
|
||||||
EventReport: {
|
EventReport: {
|
||||||
HandleID: ({ HandleID }, args, context, info) => addHandle(HandleID, context),
|
Handle: ({ HandleID }, args, context, info) => getHandle(HandleID),
|
||||||
},
|
},
|
||||||
EventComment: {
|
EventComment: {
|
||||||
HandleID: ({ HandleID }, args, context, info) => addHandle(HandleID, context),
|
Handle: ({ HandleID }, args, context, info) => getHandle(HandleID),
|
||||||
},
|
},
|
||||||
EventOrganizers: {
|
EventOrganizers: {
|
||||||
GroupIDs: ({ GroupIDs }, args, context, info) => addGroups(GroupIDs, context),
|
Groups: ({ GroupIDs }, args, context, info) => getGroups(GroupIDs),
|
||||||
HandleIDs: ({ HandleIDs }, args, context, info) => addHandles(HandleIDs, context),
|
Handles: ({ HandleIDs }, args, context, info) => getHandles(HandleIDs),
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getEventFile = id => `${globals.data_path}/event/${id}/event.${id}.json`;
|
getEventFile = id => `${globals.data_path}/event/${Math.floor(id/1000)}/${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,10 +1,11 @@
|
||||||
|
|
||||||
let globals = require('../globals.js').globals;
|
let globals = require('../config.js').globals;
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
|
|
||||||
Query: {
|
Query: {
|
||||||
getGroup: (parent, { id }, context, info) => getGroup(id),
|
group: (parent, { id }, context, info) => getGroup(id),
|
||||||
|
groups: (parent, { id }, context, info) => getGroups(id),
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -17,32 +18,43 @@ const resolvers = {
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
Group: {
|
Group: {
|
||||||
ReleaseIDs: ({ ReleaseIDs }, args, context, info) => addReleases(ReleaseIDs, context),
|
FounderHandles: ({ FounderHandleIDs }, args, context, info) => getHandles(FounderHandleIDs),
|
||||||
FounderHandleIDs: ({ FounderHandleIDs }, args, context, info) => addHandles(FounderHandleIDs, context),
|
OrganizedEvents: ({ OrganizedEventIDs }, args, context, info) => getEvents(OrganizedEventIDs),
|
||||||
OrganizedEventIDs: ({ OrganizedEventIDs }, args, context, info) => addEvents(OrganizedEventIDs, context),
|
|
||||||
BBSIDs: ({ BBSIDs }, args, context, info) => addBBSs(BBSIDs, context),
|
|
||||||
|
|
||||||
Releases: (parent, args, context, info) => context.Releases,
|
Releases: ({ ReleaseIDs }, args, context, info) => getReleases(ReleaseIDs),
|
||||||
Sceners: (parent, args, context, info) => context.Sceners,
|
BBSs: ({ BBSIDs }, args, context, info) => getBBSs(BBSIDs),
|
||||||
Handles: (parent, args, context, info) => context.Handles,
|
|
||||||
Events: (parent, args, context, info) => context.Events,
|
CoOpGroups: ({ CoOpGroupIDs }, args, context, info) => getGroups(CoOpGroupIDs),
|
||||||
BBSs: (parent, args, context, info) => context.BBSs,
|
|
||||||
},
|
},
|
||||||
GroupCommentData: {
|
GroupCommentData: {
|
||||||
ScenerID: ({ ScenerID }, args, context, info) => addScener(ScenerID, context),
|
Handle: ({ HandleID }, args, context, info) => getHandle(HandleID),
|
||||||
},
|
},
|
||||||
GroupMember: {
|
GroupMember: {
|
||||||
HandleID: ({ HandleID }, args, context, info) => addHandle(HandleID, context),
|
Handle: ({ HandleID }, args, context, info) => getHandle(HandleID),
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getGroupFile = id => `${globals.data_path}/group/${id}/group.${id}.json`;
|
getGroupFile = id => `${globals.data_path}/group/${Math.floor(id/1000)}/${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) => {
|
||||||
|
|
@ -50,6 +62,7 @@ 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
|
||||||
|
|
@ -60,7 +73,7 @@ addGroups = (idArray, context) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
catch(err) {
|
catch(err) {
|
||||||
// console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
return idArray;
|
return idArray;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
|
|
||||||
let globals = require('../globals.js').globals;
|
let globals = require('../config.js').globals;
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
|
|
||||||
Query: {
|
Query: {
|
||||||
getHandle: (parent, { id }, context, info) => getHandle(id),
|
handle: (parent, { id }, context, info) => getHandle(id),
|
||||||
|
handles: (parent, { id }, context, info) => getHandles(id),
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -17,31 +18,47 @@ const resolvers = {
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
Handle: {
|
Handle: {
|
||||||
FoundedGroupIDs: ({ FoundedGroupIDs }, args, context, info) => addGroups(FoundedGroupIDs, context),
|
FoundedGroups: ({ FoundedGroupIDs }, args, context, info) => getGroups(FoundedGroupIDs),
|
||||||
OrganizedEventIDs: ({ OrganizedEventIDs }, args, context, info) => addEvents(OrganizedEventIDs, context),
|
MemberGroups: ({ MemberGroupIDs }, args, context, info) => getGroups(MemberGroupIDs),
|
||||||
AttendedEventIDs: ({ AttendedEventIDs }, args, context, info) => addEvents(AttendedEventIDs, context),
|
OrganizedEvents: ({ OrganizedGroupIDs }, args, context, info) => getGroups(OrganizedGroupIDs),
|
||||||
ScenerIDs: ({ ScenerIDs }, args, context, info) => addSceners(ScenerIDs, context),
|
AttendedEvents: ({ AttendedEventIDs }, args, context, info) => getEvents(AttendedEventIDs),
|
||||||
|
|
||||||
Releases: (parent, args, context, info) => context.Releases,
|
BBSSysop: ({ BBSSysopIDs }, args, context, info) => getBBSs(BBSSysopIDs),
|
||||||
Groups: (parent, args, context, info) => context.Groups,
|
BBSUser: ({ BBSUserIDs }, args, context, info) => getBBSs(BBSUserIDs),
|
||||||
Sceners: (parent, args, context, info) => context.Sceners,
|
|
||||||
Events: (parent, args, context, info) => context.Events,
|
Releases: ({ ReleaseIDs }, args, context, info) => getReleases(ReleaseIDs),
|
||||||
|
Sceners: ({ ScenerIDs }, args, context, info) => getSceners(ScenerIDs),
|
||||||
},
|
},
|
||||||
HandleGroup: {
|
HandleGroup: {
|
||||||
GroupID: ({ GroupID }, args, context, info) => addGroup(GroupID, context),
|
Group: ({ GroupID }, args, context, info) => getGroup(GroupID),
|
||||||
},
|
},
|
||||||
HandleCredit: {
|
HandleCredit: {
|
||||||
ReleaseID: ({ ReleaseID }, args, context, info) => addRelease(ReleaseID, context),
|
Releases: ({ ReleaseIDs }, args, context, info) => getReleases(ReleaseIDs),
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getHandleFile = id => `${globals.data_path}/handle/${id}/handle.${id}.json`;
|
getHandleFile = id => `${globals.data_path}/handle/${Math.floor(id/1000)}/${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,10 +1,11 @@
|
||||||
|
|
||||||
let globals = require('../globals.js').globals;
|
let globals = require('../config.js').globals;
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
|
|
||||||
Query: {
|
Query: {
|
||||||
getRelease: (parent, { id }, context, info) => getRelease(id),
|
release: (parent, { id }, context, info) => getRelease(id),
|
||||||
|
releases: (parent, { id }, context, info) => getReleases(id),
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -17,34 +18,42 @@ const resolvers = {
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
Release: {
|
Release: {
|
||||||
ReleasedAt: ({ ReleasedAt }, args, context, info) => addEvent(ReleasedAt, context),
|
ReleasedAtEvent: ({ ReleasedAt }, args, context, info) => getEvent(ReleasedAt),
|
||||||
SIDIDs: ({ SIDIDs }, args, context, info) => addSIDs(SIDIDs, context),
|
SIDs: ({ SIDIDs }, args, context, info) => getSIDs(SIDIDs),
|
||||||
|
|
||||||
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: {
|
||||||
GroupIDs: ({ GroupIDs }, args, context, info) => addGroups(GroupIDs, context),
|
Groups: ({ GroupIDs }, args, context, info) => getGroups(GroupIDs),
|
||||||
HandleIDs: ({ HandleIDs }, args, context, info) => addHandles(HandleIDs, context),
|
Handles: ({ HandleIDs }, args, context, info) => getHandles(HandleIDs),
|
||||||
},
|
},
|
||||||
ReleaseCredit: {
|
ReleaseCredit: {
|
||||||
HandleID: ({ HandleID }, args, context, info) => addHandle(HandleID, context),
|
Handles: ({ HandleIDs }, args, context, info) => getHandles(HandleIDs),
|
||||||
},
|
},
|
||||||
ReleaseCommentData: {
|
ReleaseCommentData: {
|
||||||
ScenerID: ({ ScenerID }, args, context, info) => addScener(ScenerID, context),
|
Handle: ({ HandleID }, args, context, info) => getHandle(HandleID),
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getReleaseFile = id => `${globals.data_path}/release/${id}/release.${id}.json`;
|
getReleaseFile = id => `${globals.data_path}/release/${Math.floor(id/1000)}/${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) => {
|
||||||
|
|
@ -62,7 +71,7 @@ addReleases = (idArray, context) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
catch(err) {
|
catch(err) {
|
||||||
// console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
return idArray;
|
return idArray;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,11 @@
|
||||||
|
|
||||||
let globals = require('../globals.js').globals;
|
let globals = require('../config.js').globals;
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
|
|
||||||
Query: {
|
Query: {
|
||||||
getScener: (parent, { id }, context, info) => getScener(id),
|
scener: (parent, { id }, context, info) => getScener(id),
|
||||||
|
sceners: (parent, { id }, context, info) => getSceners(id),
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -17,18 +18,31 @@ const resolvers = {
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
Scener: {
|
Scener: {
|
||||||
HandleIDs: ({ HandleIDs }, args, context, info) => addHandles(HandleIDs, context),
|
Handles: ({ HandleIDs }, args, context, info) => getHandles(HandleIDs),
|
||||||
Handles: (parent, args, context, info) => context.Handles,
|
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getScenerFile = id => `${globals.data_path}/scener/${id}/scener.${id}.json`;
|
getScenerFile = id => `${globals.data_path}/scener/${Math.floor(id/1000)}/${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,10 +1,11 @@
|
||||||
|
|
||||||
let globals = require('../globals.js').globals;
|
let globals = require('../config.js').globals;
|
||||||
|
|
||||||
const resolvers = {
|
const resolvers = {
|
||||||
|
|
||||||
Query: {
|
Query: {
|
||||||
getSID: (parent, { id }, context, info) => getSID(id),
|
sid: (parent, { id }, context, info) => getSID(id),
|
||||||
|
sids: (parent, { id }, context, info) => getSIDs(id),
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -17,19 +18,31 @@ const resolvers = {
|
||||||
|
|
||||||
//////////
|
//////////
|
||||||
SID: {
|
SID: {
|
||||||
ReleaseIDs: ({ ReleaseIDs }, args, context, info) => addReleases(ReleaseIDs, context),
|
Releases: ({ ReleaseIDs }, args, context, info) => getReleases(ReleaseIDs),
|
||||||
|
|
||||||
Releases: (parent, args, context, info) => context.Releases,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getSIDFile = id => `${globals.data_path}/sid/${id}/sid.${id}.json`;
|
getSIDFile = id => `${globals.data_path}/sid/${Math.floor(id/1000)}/${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,6 +17,7 @@ type User {
|
||||||
|
|
||||||
MaintainerOf: UserRecords
|
MaintainerOf: UserRecords
|
||||||
|
|
||||||
|
# Enhanced Data
|
||||||
uuid: String
|
uuid: String
|
||||||
dateCreated: String
|
dateCreated: String
|
||||||
dateUpdated: String
|
dateUpdated: String
|
||||||
|
|
@ -35,37 +36,36 @@ type UserRecords {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type Release {
|
type Release {
|
||||||
ID: Int!
|
ID: Int!
|
||||||
Name: String!
|
Name: String!
|
||||||
AKA: String
|
AKA: String
|
||||||
Type: String
|
Type: String # should go in tag
|
||||||
GfxType: String
|
GfxType: String # should go in tag
|
||||||
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]
|
||||||
|
|
||||||
Groups: [Group]
|
|
||||||
Sceners: [Scener]
|
|
||||||
Handles: [Handle]
|
|
||||||
Events: [Event]
|
|
||||||
SIDs: [SID]
|
SIDs: [SID]
|
||||||
Tags: [String]
|
|
||||||
|
|
||||||
|
# Enhanced Data
|
||||||
uuid: String
|
uuid: String
|
||||||
|
tags: [String]
|
||||||
dateCreated: String
|
dateCreated: String
|
||||||
dateUpdated: String
|
dateUpdated: String
|
||||||
deleted: Boolean
|
deleted: Boolean
|
||||||
|
|
@ -79,12 +79,15 @@ 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!
|
||||||
HandleID: Int!
|
HandleIDs: [Int]
|
||||||
|
Handles: [Handle]
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReleaseLink {
|
type ReleaseLink {
|
||||||
|
|
@ -100,13 +103,13 @@ type ReleaseDownload {
|
||||||
Filename: String
|
Filename: String
|
||||||
Link: String!
|
Link: String!
|
||||||
Status: String
|
Status: String
|
||||||
crc32: String
|
hash: String
|
||||||
}
|
}
|
||||||
|
|
||||||
type ReleaseComment {
|
type ReleaseComment {
|
||||||
Summary: [ReleaseCommentData]
|
Summary: [ReleaseCommentData]
|
||||||
Trivia: [ReleaseCommentData]
|
Trivia: [ReleaseCommentData]
|
||||||
Goofs: [ReleaseCommentData]
|
Goof: [ReleaseCommentData]
|
||||||
HiddenPart: [ReleaseCommentData]
|
HiddenPart: [ReleaseCommentData]
|
||||||
ProductionNote: [ReleaseCommentData]
|
ProductionNote: [ReleaseCommentData]
|
||||||
UserComment: [ReleaseCommentData]
|
UserComment: [ReleaseCommentData]
|
||||||
|
|
@ -114,11 +117,14 @@ type ReleaseComment {
|
||||||
|
|
||||||
type ReleaseCommentData {
|
type ReleaseCommentData {
|
||||||
Date: Int!
|
Date: Int!
|
||||||
ScenerID: Int!
|
HandleID: Int!
|
||||||
|
Handle: Handle
|
||||||
Text: String!
|
Text: String!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type Group {
|
type Group {
|
||||||
ID: Int!
|
ID: Int!
|
||||||
Name: String!
|
Name: String!
|
||||||
|
|
@ -127,7 +133,6 @@ type Group {
|
||||||
Rating: Float
|
Rating: Float
|
||||||
Trivia: String
|
Trivia: String
|
||||||
BaseCountry: String
|
BaseCountry: String
|
||||||
IsCoOp: Boolean
|
|
||||||
|
|
||||||
FoundDate: [FuzzyDate]
|
FoundDate: [FuzzyDate]
|
||||||
DissolveDate: [FuzzyDate]
|
DissolveDate: [FuzzyDate]
|
||||||
|
|
@ -135,22 +140,26 @@ type Group {
|
||||||
Website: String
|
Website: String
|
||||||
Grouptypes: [String]
|
Grouptypes: [String]
|
||||||
Slogan: [String]
|
Slogan: [String]
|
||||||
UserComment: [GroupCommentData]
|
|
||||||
|
FounderHandleIDs: [Int]
|
||||||
|
FounderHandles: [Handle]
|
||||||
|
OrganizedEventIDs: [Int]
|
||||||
|
OrganizedEvents: [Event]
|
||||||
|
Members: [GroupMember]
|
||||||
|
|
||||||
ReleaseIDs: [Int]
|
ReleaseIDs: [Int]
|
||||||
Members: [GroupMember]
|
|
||||||
FounderHandleIDs: [Int]
|
|
||||||
OrganizedEventIDs: [Int]
|
|
||||||
BBSIDs: [Int]
|
|
||||||
|
|
||||||
Releases: [Release]
|
Releases: [Release]
|
||||||
Sceners: [Scener]
|
BBSIDs: [Int]
|
||||||
Handles: [Handle]
|
|
||||||
Events: [Event]
|
|
||||||
BBSs: [BBS]
|
BBSs: [BBS]
|
||||||
Tags: [String]
|
|
||||||
|
UserComment: [GroupCommentData]
|
||||||
|
|
||||||
|
# Enhanced Data
|
||||||
|
CoOpGroupIDs: [Int]
|
||||||
|
CoOpGroups: [Group]
|
||||||
|
|
||||||
uuid: String
|
uuid: String
|
||||||
|
tags: [String]
|
||||||
dateCreated: String
|
dateCreated: String
|
||||||
dateUpdated: String
|
dateUpdated: String
|
||||||
deleted: Boolean
|
deleted: Boolean
|
||||||
|
|
@ -159,13 +168,14 @@ type Group {
|
||||||
|
|
||||||
type GroupCommentData {
|
type GroupCommentData {
|
||||||
Date: Int!
|
Date: Int!
|
||||||
ScenerID: Int!
|
HandleID: Int!
|
||||||
|
Handle: Handle
|
||||||
Text: String!
|
Text: String!
|
||||||
}
|
}
|
||||||
|
|
||||||
type GroupMember {
|
type GroupMember {
|
||||||
GroupID: Int
|
HandleID: Int!
|
||||||
HandleID: Int
|
Handle: Handle
|
||||||
Profession: [String]
|
Profession: [String]
|
||||||
|
|
||||||
JoinDate: [FuzzyDate]
|
JoinDate: [FuzzyDate]
|
||||||
|
|
@ -175,6 +185,8 @@ type GroupMember {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type Scener {
|
type Scener {
|
||||||
ID: Int!
|
ID: Int!
|
||||||
RegisterdDate: String
|
RegisterdDate: String
|
||||||
|
|
@ -184,10 +196,11 @@ 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
|
||||||
|
|
@ -195,6 +208,8 @@ type Scener {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type Handle {
|
type Handle {
|
||||||
ID: Int!
|
ID: Int!
|
||||||
Handle: String!
|
Handle: String!
|
||||||
|
|
@ -205,16 +220,28 @@ 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]
|
||||||
ScenerIDs: [Int]
|
AttendedEvents: [Event]
|
||||||
|
|
||||||
|
BBSSysopIDs: [Int]
|
||||||
|
BBSSysop: [BBS]
|
||||||
|
BBSUserIDs: [Int]
|
||||||
|
BBSUser: [BBS]
|
||||||
|
|
||||||
|
ReleaseIDs: [Int]
|
||||||
Releases: [Release]
|
Releases: [Release]
|
||||||
Groups: [Group]
|
ScenerIDs: [Int]
|
||||||
Sceners: [Scener]
|
Sceners: [Scener]
|
||||||
Events: [Event]
|
|
||||||
|
|
||||||
|
# Enhanced Data
|
||||||
uuid: String
|
uuid: String
|
||||||
|
tags: [String]
|
||||||
dateCreated: String
|
dateCreated: String
|
||||||
dateUpdated: String
|
dateUpdated: String
|
||||||
deleted: Boolean
|
deleted: Boolean
|
||||||
|
|
@ -224,14 +251,18 @@ type Handle {
|
||||||
type HandleGroup {
|
type HandleGroup {
|
||||||
GroupID: Int!
|
GroupID: Int!
|
||||||
MemberStats: GroupMember
|
MemberStats: GroupMember
|
||||||
|
Group: Group
|
||||||
}
|
}
|
||||||
|
|
||||||
type HandleCredit {
|
type HandleCredit {
|
||||||
CreditType: String!
|
CreditType: String!
|
||||||
ReleaseID: Int!
|
ReleaseIDs: [Int]
|
||||||
|
Releases: [Release]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type Event {
|
type Event {
|
||||||
ID: Int!
|
ID: Int!
|
||||||
Name: String!
|
Name: String!
|
||||||
|
|
@ -249,17 +280,14 @@ type Event {
|
||||||
Country: String
|
Country: String
|
||||||
Website: String
|
Website: String
|
||||||
|
|
||||||
OrganizerGroup: Group
|
Organizers: EventOrganizers
|
||||||
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
|
||||||
|
|
@ -269,6 +297,7 @@ type Event {
|
||||||
type EventCompo {
|
type EventCompo {
|
||||||
Type: String
|
Type: String
|
||||||
ReleaseIDs: [Int]
|
ReleaseIDs: [Int]
|
||||||
|
Releases: [Release]
|
||||||
}
|
}
|
||||||
|
|
||||||
type EventReport {
|
type EventReport {
|
||||||
|
|
@ -277,19 +306,26 @@ 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!
|
||||||
|
|
@ -307,12 +343,13 @@ 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
|
||||||
|
|
@ -327,9 +364,12 @@ 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
|
||||||
|
|
@ -346,10 +386,11 @@ 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
|
||||||
|
|
@ -357,14 +398,29 @@ type SID {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
type Query {
|
type Query {
|
||||||
getRelease(id: Int!) : Release
|
release(id: Int!) : Release
|
||||||
getGroup(id: Int!) : Group
|
releases(id: [Int]!) : [Release]
|
||||||
getScener(id: Int!) : Scener
|
|
||||||
getHandle(id: Int!) : Handle
|
group(id: Int!) : Group
|
||||||
getEvent(id: Int!) : Event
|
groups(id: [Int]!) : [Group]
|
||||||
getBBS(id: Int!) : BBS
|
|
||||||
getSID(id: Int!) : SID
|
scener(id: Int!) : Scener
|
||||||
|
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 {
|
||||||
|
|
@ -391,4 +447,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