Compare commits

...

10 Commits

Author SHA1 Message Date
b6ff7deed2
Add files via upload 2024-10-06 21:19:12 -05:00
b9c208c09a
Add files via upload 2024-10-06 21:18:54 -05:00
c93d6c6653
Add files via upload 2024-10-06 20:19:34 -05:00
743af25e0e
Add files via upload 2024-10-06 20:18:24 -05:00
4d3058081b
Add files via upload 2024-10-06 20:17:52 -05:00
93f11947d1
Update config.js 2024-10-06 18:02:45 -05:00
391b9b5440
Add files via upload 2024-10-06 18:02:11 -05:00
b4f437571e
Delete server/globals.js 2024-10-06 17:55:21 -05:00
8330bf1dcf
Add files via upload 2024-10-06 17:55:04 -05:00
d1ddf17dd4
Add files via upload 2024-10-06 17:54:32 -05:00
11 changed files with 279 additions and 131 deletions

View File

@ -1,7 +1,7 @@
const globals = {
data_path: '/var/www/csdbng/data'
data_path: '/path/to/data'
}
module.exports = { globals }

View File

@ -10,7 +10,8 @@
"author": "Jaime Idolpx",
"license": "MIT",
"dependencies": {
"apollo-server": "^3.7.0",
"graphql": "^16.5.0"
"apollo-server": "^3.13.0",
"graphql": "^16.5.0",
"mariadb": "^3.3.2"
}
}

View File

@ -1,10 +1,11 @@
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),
bbss: (parent, { id }, context, info) => getBBSs(id),
},
Mutation: {
@ -17,24 +18,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) => {

View File

@ -1,10 +1,11 @@
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),
events: (parent, { id }, context, info) => getEvents(id),
},
Mutation: {
@ -17,32 +18,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) => {

View File

@ -1,10 +1,11 @@
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),
groups: (parent, { id }, context, info) => getGroups(id),
},
Mutation: {
@ -17,32 +18,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 +62,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 +73,7 @@ addGroups = (idArray, context) => {
})
}
catch(err) {
// console.log(err);
console.log(err);
}
return idArray;

View File

@ -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, { id }, context, info) => getHandles(id),
},
Mutation: {
@ -17,31 +18,47 @@ 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) => getReleases(ReleaseIDs),
Sceners: ({ ScenerIDs }, args, context, info) => getSceners(ScenerIDs),
},
HandleGroup: {
GroupID: ({ GroupID }, args, context, info) => addGroup(GroupID, context),
Group: ({ GroupID }, args, context, info) => getGroup(GroupID),
},
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
getHandle = 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
addHandle = (id, context) => {

View File

@ -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 }

View File

@ -1,10 +1,11 @@
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),
releases: (parent, { id }, context, info) => getReleases(id),
},
Mutation: {
@ -17,34 +18,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 +71,7 @@ addReleases = (idArray, context) => {
})
}
catch(err) {
// console.log(err);
console.log(err);
}
return idArray;

View File

@ -1,10 +1,11 @@
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),
sceners: (parent, { id }, context, info) => getSceners(id),
},
Mutation: {
@ -17,18 +18,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) => {

View File

@ -1,10 +1,11 @@
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),
sids: (parent, { id }, context, info) => getSIDs(id),
},
Mutation: {
@ -17,19 +18,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) => {

View File

@ -17,6 +17,7 @@ type User {
MaintainerOf: UserRecords
# Enhanced Data
uuid: String
dateCreated: String
dateUpdated: String
@ -35,37 +36,36 @@ type UserRecords {
}
type Release {
ID: Int!
Name: String!
AKA: String
Type: String
GfxType: String
Type: String # should go in tag
GfxType: String # should go in tag
Rating: Float
ReleaseDate: [FuzzyDate]
ReleasedAt: Int
ReleasedAtEvent: Event
Achievement: ReleaseAchievement
ReleasedBy: ReleaseGroupsHandles
Credits: [ReleaseCredit]
Website: String
ScreenShot: String
ScreenShot: [String]
DownloadLinks: [ReleaseDownload]
OtherLinks: [ReleaseLink]
Comments: [ReleaseComment]
SIDIDs: [Int]
Groups: [Group]
Sceners: [Scener]
Handles: [Handle]
Events: [Event]
SIDs: [SID]
Tags: [String]
# Enhanced Data
uuid: String
tags: [String]
dateCreated: String
dateUpdated: String
deleted: Boolean
@ -79,12 +79,15 @@ type ReleaseAchievement {
type ReleaseGroupsHandles {
GroupIDs: [Int]
Groups: [Group]
HandleIDs: [Int]
Handles: [Handle]
}
type ReleaseCredit {
CreditType: String!
HandleID: Int!
HandleIDs: [Int]
Handles: [Handle]
}
type ReleaseLink {
@ -100,13 +103,13 @@ type ReleaseDownload {
Filename: String
Link: String!
Status: String
crc32: String
hash: String
}
type ReleaseComment {
Summary: [ReleaseCommentData]
Trivia: [ReleaseCommentData]
Goofs: [ReleaseCommentData]
Goof: [ReleaseCommentData]
HiddenPart: [ReleaseCommentData]
ProductionNote: [ReleaseCommentData]
UserComment: [ReleaseCommentData]
@ -114,11 +117,14 @@ type ReleaseComment {
type ReleaseCommentData {
Date: Int!
ScenerID: Int!
HandleID: Int!
Handle: Handle
Text: String!
}
type Group {
ID: Int!
Name: String!
@ -127,7 +133,6 @@ type Group {
Rating: Float
Trivia: String
BaseCountry: String
IsCoOp: Boolean
FoundDate: [FuzzyDate]
DissolveDate: [FuzzyDate]
@ -135,22 +140,26 @@ type Group {
Website: String
Grouptypes: [String]
Slogan: [String]
UserComment: [GroupCommentData]
FounderHandleIDs: [Int]
FounderHandles: [Handle]
OrganizedEventIDs: [Int]
OrganizedEvents: [Event]
Members: [GroupMember]
ReleaseIDs: [Int]
Members: [GroupMember]
FounderHandleIDs: [Int]
OrganizedEventIDs: [Int]
BBSIDs: [Int]
Releases: [Release]
Sceners: [Scener]
Handles: [Handle]
Events: [Event]
BBSIDs: [Int]
BBSs: [BBS]
Tags: [String]
UserComment: [GroupCommentData]
# Enhanced Data
CoOpGroupIDs: [Int]
CoOpGroups: [Group]
uuid: String
tags: [String]
dateCreated: String
dateUpdated: String
deleted: Boolean
@ -159,13 +168,14 @@ type Group {
type GroupCommentData {
Date: Int!
ScenerID: Int!
HandleID: Int!
Handle: Handle
Text: String!
}
type GroupMember {
GroupID: Int
HandleID: Int
HandleID: Int!
Handle: Handle
Profession: [String]
JoinDate: [FuzzyDate]
@ -175,6 +185,8 @@ type GroupMember {
}
type Scener {
ID: Int!
RegisterdDate: String
@ -184,10 +196,11 @@ type Scener {
DeathDate: [FuzzyDate]
HandleIDs: [Int]
Handles: [Handle]
# Enhanced Data
uuid: String
tags: [String]
dateCreated: String
dateUpdated: String
deleted: Boolean
@ -195,6 +208,8 @@ type Scener {
}
type Handle {
ID: Int!
Handle: String!
@ -205,16 +220,28 @@ type Handle {
Credits: [HandleCredit]
FoundedGroupIDs: [Int]
FoundedGroups: [Group]
MemberGroupIDs: [Int]
MemberGroups: [Group]
OrganizedEventIDs: [Int]
OrganizedEvents: [Event]
AttendedEventIDs: [Int]
ScenerIDs: [Int]
AttendedEvents: [Event]
BBSSysopIDs: [Int]
BBSSysop: [BBS]
BBSUserIDs: [Int]
BBSUser: [BBS]
ReleaseIDs: [Int]
Releases: [Release]
Groups: [Group]
ScenerIDs: [Int]
Sceners: [Scener]
Events: [Event]
# Enhanced Data
uuid: String
tags: [String]
dateCreated: String
dateUpdated: String
deleted: Boolean
@ -224,14 +251,18 @@ type Handle {
type HandleGroup {
GroupID: Int!
MemberStats: GroupMember
Group: Group
}
type HandleCredit {
CreditType: String!
ReleaseID: Int!
ReleaseIDs: [Int]
Releases: [Release]
}
type Event {
ID: Int!
Name: String!
@ -249,17 +280,14 @@ type Event {
Country: String
Website: String
OrganizerGroup: Group
Organizers: EventOrganizers
Compo: [EventCompo]
PartyReport: [EventReport]
UserComment: [EventComment]
Organizers: EventOrganizers
Releases: [Release]
Groups: [Group]
Handles: [Handle]
# Enhanced Data
uuid: String
tags: [String]
dateCreated: String
dateUpdated: String
deleted: Boolean
@ -269,6 +297,7 @@ type Event {
type EventCompo {
Type: String
ReleaseIDs: [Int]
Releases: [Release]
}
type EventReport {
@ -277,19 +306,26 @@ type EventReport {
Date: Int
Headline: String
Text: String
Handle: Handle
}
type EventComment {
HandleID: Int!
Date: Int!
Text: String!
Handle: Handle
}
type EventOrganizers {
GroupIDs: [Int]
Groups: [Group]
HandleIDs: [Int]
Handles: [Handle]
}
type BBS {
ID: Int!
Name: String!
@ -307,12 +343,13 @@ type BBS {
Status: String
GroupIDs: [Int]
UserHandleIDs: [Int]
Groups: [Group]
HandleIDs: [Int]
Handles: [Handle]
# Enhanced Data
uuid: String
tags: [String]
dateCreated: String
dateUpdated: String
deleted: Boolean
@ -327,9 +364,12 @@ type BBSOnlinePeriod {
type BBSSysop {
Type: String
HandleID: Int
Handle: Handle
}
type SID {
ID: Int!
HVSCPath: String
@ -346,10 +386,11 @@ type SID {
DataSize: Int
ReleaseIDs: [Int]
Releases: [Release]
# Enhanced Data
uuid: String
tags: [String]
dateCreated: String
dateUpdated: String
deleted: Boolean
@ -357,14 +398,29 @@ type SID {
}
type Query {
getRelease(id: Int!) : Release
getGroup(id: Int!) : Group
getScener(id: Int!) : Scener
getHandle(id: Int!) : Handle
getEvent(id: Int!) : Event
getBBS(id: Int!) : BBS
getSID(id: Int!) : SID
release(id: Int!) : Release
releases(id: [Int]!) : [Release]
group(id: Int!) : Group
groups(id: [Int]!) : [Group]
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 {
@ -391,4 +447,4 @@ type Mutation {
deleteEvent(id: Int!) : Event
deleteBBS(id: Int!) : BBS
deleteSID(id: Int!) : SID
}
}