mirror of
https://github.com/idolpx/csdb-ng.git
synced 2025-12-05 20:28:49 -05:00
Add files via upload
This commit is contained in:
parent
fcb2a05a47
commit
d1ddf17dd4
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
let globals = require('../globals.js').globals;
|
||||
let globals = require('../config.js').globals;
|
||||
|
||||
const resolvers = {
|
||||
|
||||
Query: {
|
||||
getBBS: (parent, { id }, context, info) => getBBS(id),
|
||||
bbs: (parent, { id }, context, info) => getBBS(id),
|
||||
},
|
||||
|
||||
Mutation: {
|
||||
|
|
@ -17,24 +17,35 @@ const resolvers = {
|
|||
|
||||
//////////
|
||||
BBS: {
|
||||
GroupIDs: ({ GroupIDs }, args, context, info) => addGroups(GroupIDs, context),
|
||||
UserHandleIDs: ({ UserHandleIDs }, args, context, info) => addHandles(UserHandleIDs, context),
|
||||
|
||||
Groups: (parent, args, context, info) => context.Groups,
|
||||
Handles: (parent, args, context, info) => context.Handles,
|
||||
Groups: ({ GroupIDs }, args, context, info) => getGroups(GroupIDs),
|
||||
Handles: ({ HandleIDs }, args, context, info) => getHandles(HandleIDs),
|
||||
},
|
||||
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
|
||||
getBBS = 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
|
||||
addBBS = (id, context) => {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
let globals = require('../globals.js').globals;
|
||||
let globals = require('../config.js').globals;
|
||||
|
||||
const resolvers = {
|
||||
|
||||
Query: {
|
||||
getEvent: (parent, { id }, context, info) => getEvent(id),
|
||||
event: (parent, { id }, context, info) => getEvent(id),
|
||||
},
|
||||
|
||||
Mutation: {
|
||||
|
|
@ -17,32 +17,44 @@ const resolvers = {
|
|||
|
||||
//////////
|
||||
Event: {
|
||||
Releases: (parent, args, context, info) => context.Releases,
|
||||
Groups: (parent, args, context, info) => context.Groups,
|
||||
Handles: (parent, args, context, info) => context.Handles,
|
||||
// Releases: (parent, args, context, info) => context.Releases,
|
||||
},
|
||||
EventCompo: {
|
||||
ReleaseIDs: ({ ReleaseIDs }, args, context, info) => addReleases(ReleaseIDs, context),
|
||||
Releases: ({ ReleaseIDs }, args, context, info) => getReleases(ReleaseIDs),
|
||||
},
|
||||
EventReport: {
|
||||
HandleID: ({ HandleID }, args, context, info) => addHandle(HandleID, context),
|
||||
Handle: ({ HandleID }, args, context, info) => getHandle(HandleID),
|
||||
},
|
||||
EventComment: {
|
||||
HandleID: ({ HandleID }, args, context, info) => addHandle(HandleID, context),
|
||||
Handle: ({ HandleID }, args, context, info) => getHandle(HandleID),
|
||||
},
|
||||
EventOrganizers: {
|
||||
GroupIDs: ({ GroupIDs }, args, context, info) => addGroups(GroupIDs, context),
|
||||
HandleIDs: ({ HandleIDs }, args, context, info) => addHandles(HandleIDs, context),
|
||||
Groups: ({ GroupIDs }, args, context, info) => getGroups(GroupIDs),
|
||||
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
|
||||
getEvent = 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
|
||||
addEvent = (id, context) => {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
let globals = require('../globals.js').globals;
|
||||
let globals = require('../config.js').globals;
|
||||
|
||||
const resolvers = {
|
||||
|
||||
Query: {
|
||||
getGroup: (parent, { id }, context, info) => getGroup(id),
|
||||
group: (parent, { id }, context, info) => getGroup(id),
|
||||
},
|
||||
|
||||
Mutation: {
|
||||
|
|
@ -17,32 +17,43 @@ const resolvers = {
|
|||
|
||||
//////////
|
||||
Group: {
|
||||
ReleaseIDs: ({ ReleaseIDs }, args, context, info) => addReleases(ReleaseIDs, context),
|
||||
FounderHandleIDs: ({ FounderHandleIDs }, args, context, info) => addHandles(FounderHandleIDs, context),
|
||||
OrganizedEventIDs: ({ OrganizedEventIDs }, args, context, info) => addEvents(OrganizedEventIDs, context),
|
||||
BBSIDs: ({ BBSIDs }, args, context, info) => addBBSs(BBSIDs, context),
|
||||
FounderHandles: ({ FounderHandleIDs }, args, context, info) => getHandles(FounderHandleIDs),
|
||||
OrganizedEvents: ({ OrganizedEventIDs }, args, context, info) => getEvents(OrganizedEventIDs),
|
||||
|
||||
Releases: (parent, args, context, info) => context.Releases,
|
||||
Sceners: (parent, args, context, info) => context.Sceners,
|
||||
Handles: (parent, args, context, info) => context.Handles,
|
||||
Events: (parent, args, context, info) => context.Events,
|
||||
BBSs: (parent, args, context, info) => context.BBSs,
|
||||
Releases: ({ ReleaseIDs }, args, context, info) => getReleases(ReleaseIDs),
|
||||
BBSs: ({ BBSIDs }, args, context, info) => getBBSs(BBSIDs),
|
||||
|
||||
CoOpGroups: ({ CoOpGroupIDs }, args, context, info) => getGroups(CoOpGroupIDs),
|
||||
},
|
||||
GroupCommentData: {
|
||||
ScenerID: ({ ScenerID }, args, context, info) => addScener(ScenerID, context),
|
||||
Handle: ({ HandleID }, args, context, info) => getHandle(HandleID),
|
||||
},
|
||||
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
|
||||
getGroup = 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
|
||||
addGroup = (id, context) => {
|
||||
|
|
@ -50,6 +61,7 @@ addGroup = (id, context) => {
|
|||
return id;
|
||||
}
|
||||
addGroups = (idArray, context) => {
|
||||
console.log(idArray);
|
||||
try {
|
||||
idArray.forEach( id => {
|
||||
// Add object if it isn't already added
|
||||
|
|
@ -60,7 +72,7 @@ addGroups = (idArray, context) => {
|
|||
})
|
||||
}
|
||||
catch(err) {
|
||||
// console.log(err);
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
return idArray;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,11 @@
|
|||
|
||||
let globals = require('../globals.js').globals;
|
||||
let globals = require('../config.js').globals;
|
||||
|
||||
const resolvers = {
|
||||
|
||||
Query: {
|
||||
getHandle: (parent, { id }, context, info) => getHandle(id),
|
||||
handle: (parent, { id }, context, info) => getHandle(id),
|
||||
handles: (parent, { ids }, context, info) => getHandles(ids),
|
||||
},
|
||||
|
||||
Mutation: {
|
||||
|
|
@ -17,31 +18,46 @@ const resolvers = {
|
|||
|
||||
//////////
|
||||
Handle: {
|
||||
FoundedGroupIDs: ({ FoundedGroupIDs }, args, context, info) => addGroups(FoundedGroupIDs, context),
|
||||
OrganizedEventIDs: ({ OrganizedEventIDs }, args, context, info) => addEvents(OrganizedEventIDs, context),
|
||||
AttendedEventIDs: ({ AttendedEventIDs }, args, context, info) => addEvents(AttendedEventIDs, context),
|
||||
ScenerIDs: ({ ScenerIDs }, args, context, info) => addSceners(ScenerIDs, context),
|
||||
FoundedGroups: ({ FoundedGroupIDs }, args, context, info) => getGroups(FoundedGroupIDs),
|
||||
MemberGroups: ({ MemberGroupIDs }, args, context, info) => getGroups(MemberGroupIDs),
|
||||
OrganizedEvents: ({ OrganizedGroupIDs }, args, context, info) => getGroups(OrganizedGroupIDs),
|
||||
AttendedEvents: ({ AttendedEventIDs }, args, context, info) => getEvents(AttendedEventIDs),
|
||||
|
||||
Releases: (parent, args, context, info) => context.Releases,
|
||||
Groups: (parent, args, context, info) => context.Groups,
|
||||
Sceners: (parent, args, context, info) => context.Sceners,
|
||||
Events: (parent, args, context, info) => context.Events,
|
||||
BBSSysop: ({ BBSSysopIDs }, args, context, info) => getBBSs(BBSSysopIDs),
|
||||
BBSUser: ({ BBSUserIDs }, args, context, info) => getBBSs(BBSUserIDs),
|
||||
|
||||
Releases: ({ ReleaseIDs }, args, context, info) => getSceners(ReleaseIDs),
|
||||
Sceners: ({ ScenerIDs }, args, context, info) => getSceners(ScenerIDs),
|
||||
},
|
||||
HandleGroup: {
|
||||
GroupID: ({ GroupID }, args, context, info) => addGroup(GroupID, context),
|
||||
GroupID: ({ GroupID }, args, context, info) => getGroup(GroupID),
|
||||
},
|
||||
HandleCredit: {
|
||||
ReleaseID: ({ ReleaseID }, args, context, info) => addRelease(ReleaseID, context),
|
||||
ReleaseID: ({ ReleaseID }, args, context, info) => getRelease(ReleaseID),
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
getHandle = id => {
|
||||
return loadJSON(getHandleFile(id));
|
||||
}
|
||||
getHandles = 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
|
||||
addHandle = (id, context) => {
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ loadJSON = filename => {
|
|||
|
||||
if ( !fs.existsSync(filename) )
|
||||
return null;
|
||||
|
||||
|
||||
const data = fs.readFileSync(filename, {encoding:'utf8', flag:'r'});
|
||||
|
||||
if ( !data )
|
||||
|
|
@ -64,7 +64,7 @@ addElementToObjectArray = (object, array, element) => {
|
|||
} else {
|
||||
// No - Create the array
|
||||
object[array] = [element];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -86,4 +86,4 @@ objectExists = (object, array, id) => {
|
|||
return found;
|
||||
}
|
||||
|
||||
module.exports = { resolvers }
|
||||
module.exports = { resolvers }
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
let globals = require('../globals.js').globals;
|
||||
let globals = require('../config.js').globals;
|
||||
|
||||
const resolvers = {
|
||||
|
||||
Query: {
|
||||
getRelease: (parent, { id }, context, info) => getRelease(id),
|
||||
release: (parent, { id }, context, info) => getRelease(id),
|
||||
},
|
||||
|
||||
Mutation: {
|
||||
|
|
@ -17,34 +17,42 @@ const resolvers = {
|
|||
|
||||
//////////
|
||||
Release: {
|
||||
ReleasedAt: ({ ReleasedAt }, args, context, info) => addEvent(ReleasedAt, context),
|
||||
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,
|
||||
ReleasedAtEvent: ({ ReleasedAt }, args, context, info) => getEvent(ReleasedAt),
|
||||
SIDs: ({ SIDIDs }, args, context, info) => getSIDs(SIDIDs),
|
||||
},
|
||||
ReleaseGroupsHandles: {
|
||||
GroupIDs: ({ GroupIDs }, args, context, info) => addGroups(GroupIDs, context),
|
||||
HandleIDs: ({ HandleIDs }, args, context, info) => addHandles(HandleIDs, context),
|
||||
Groups: ({ GroupIDs }, args, context, info) => getGroups(GroupIDs),
|
||||
Handles: ({ HandleIDs }, args, context, info) => getHandles(HandleIDs),
|
||||
},
|
||||
ReleaseCredit: {
|
||||
HandleID: ({ HandleID }, args, context, info) => addHandle(HandleID, context),
|
||||
},
|
||||
Handles: ({ HandleIDs }, args, context, info) => getHandles(HandleIDs),
|
||||
},
|
||||
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
|
||||
getRelease = 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
|
||||
addRelease = (id, context) => {
|
||||
|
|
@ -62,7 +70,7 @@ addReleases = (idArray, context) => {
|
|||
})
|
||||
}
|
||||
catch(err) {
|
||||
// console.log(err);
|
||||
console.log(err);
|
||||
}
|
||||
|
||||
return idArray;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
let globals = require('../globals.js').globals;
|
||||
let globals = require('../config.js').globals;
|
||||
|
||||
const resolvers = {
|
||||
|
||||
Query: {
|
||||
getScener: (parent, { id }, context, info) => getScener(id),
|
||||
scener: (parent, { id }, context, info) => getScener(id),
|
||||
},
|
||||
|
||||
Mutation: {
|
||||
|
|
@ -17,18 +17,31 @@ const resolvers = {
|
|||
|
||||
//////////
|
||||
Scener: {
|
||||
HandleIDs: ({ HandleIDs }, args, context, info) => addHandles(HandleIDs, context),
|
||||
Handles: (parent, args, context, info) => context.Handles,
|
||||
Handles: ({ HandleIDs }, args, context, info) => getHandles(HandleIDs),
|
||||
},
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
getScener = 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
|
||||
addScener = (id, context) => {
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
|
||||
let globals = require('../globals.js').globals;
|
||||
let globals = require('../config.js').globals;
|
||||
|
||||
const resolvers = {
|
||||
|
||||
Query: {
|
||||
getSID: (parent, { id }, context, info) => getSID(id),
|
||||
sid: (parent, { id }, context, info) => getSID(id),
|
||||
},
|
||||
|
||||
Mutation: {
|
||||
|
|
@ -17,19 +17,31 @@ const resolvers = {
|
|||
|
||||
//////////
|
||||
SID: {
|
||||
ReleaseIDs: ({ ReleaseIDs }, args, context, info) => addReleases(ReleaseIDs, context),
|
||||
|
||||
Releases: (parent, args, context, info) => context.Releases,
|
||||
Releases: ({ ReleaseIDs }, args, context, info) => getReleases(ReleaseIDs),
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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
|
||||
getSID = 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
|
||||
addSID = (id, context) => {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user