mirror of
https://github.com/idolpx/csdb-ng.git
synced 2025-12-06 04:38: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 = {
|
const resolvers = {
|
||||||
|
|
||||||
Query: {
|
Query: {
|
||||||
getBBS: (parent, { id }, context, info) => getBBS(id),
|
bbs: (parent, { id }, context, info) => getBBS(id),
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -17,24 +17,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,10 @@
|
||||||
|
|
||||||
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),
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -17,32 +17,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,10 @@
|
||||||
|
|
||||||
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),
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -17,32 +17,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 +61,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 +72,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, { ids }, context, info) => getHandles(ids),
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -17,31 +18,46 @@ 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) => getSceners(ReleaseIDs),
|
||||||
|
Sceners: ({ ScenerIDs }, args, context, info) => getSceners(ScenerIDs),
|
||||||
},
|
},
|
||||||
HandleGroup: {
|
HandleGroup: {
|
||||||
GroupID: ({ GroupID }, args, context, info) => addGroup(GroupID, context),
|
GroupID: ({ GroupID }, args, context, info) => getGroup(GroupID),
|
||||||
},
|
},
|
||||||
HandleCredit: {
|
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
|
// Object loader
|
||||||
getHandle = id => {
|
getHandle = id => {
|
||||||
return loadJSON(getHandleFile(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
|
// Load object by ID or ID array
|
||||||
addHandle = (id, context) => {
|
addHandle = (id, context) => {
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
|
|
||||||
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),
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -17,34 +17,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 +70,7 @@ addReleases = (idArray, context) => {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
catch(err) {
|
catch(err) {
|
||||||
// console.log(err);
|
console.log(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
return idArray;
|
return idArray;
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
|
|
||||||
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),
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -17,18 +17,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,10 @@
|
||||||
|
|
||||||
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),
|
||||||
},
|
},
|
||||||
|
|
||||||
Mutation: {
|
Mutation: {
|
||||||
|
|
@ -17,19 +17,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) => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user