diff --git a/backend/models/Character.js b/backend/models/Character.js
deleted file mode 100644
index 1b3f66f9..00000000
--- a/backend/models/Character.js
+++ /dev/null
@@ -1,11 +0,0 @@
-const mongoose = require("mongoose");
-const Schema = mongoose.Schema;
-
-const CharacterSchema = new Schema({
- name: {type: String, required: true},
- data: { type: Object },
- owner: {type: mongoose.Types.ObjectId, ref: "CampaignUser"},
- splash_image: { type: String },
-});
-
-module.exports = mongoose.model('Character', CharacterSchema);
\ No newline at end of file
diff --git a/backend/routes/character.js b/backend/routes/character.js
deleted file mode 100644
index 719de306..00000000
--- a/backend/routes/character.js
+++ /dev/null
@@ -1,35 +0,0 @@
-const express = require('express');
-const router = express.Router();
-
-const passport = require('passport');
-const rateLimitMiddleware = require("../config/rate-limiter");
-
-const Campaign = require("../models/Campaign");
-const CampaignUser = require("../models/CampaignUser");
-const Character = require('../models/Character');
-
-const upload = require("../config/storage");
-
-// Get characters from a campaign
-router.get('/list', (req, res) => {
-
-});
-
-// Character info
-router.post('/create', rateLimitMiddleware, (req, res) => {
-
-});
-
-router.delete('/delete', rateLimitMiddleware, (req, res) => {
-
-});
-
-router.get('/get', (req, res) => {
-
-});
-
-router.put('/update', (req, res) => {
-
-});
-
-module.exports = router;
\ No newline at end of file
diff --git a/backend/routes/datagen.js b/backend/routes/datagen.js
new file mode 100644
index 00000000..61c7ee8d
--- /dev/null
+++ b/backend/routes/datagen.js
@@ -0,0 +1,13 @@
+const express = require('express');
+const router = express.Router();
+
+// Get characters from a campaign
+router.get('/:plugin', (req, res) => {
+ res.json({
+ datagens: [
+ {title: "Hello world"}
+ ]
+ })
+});
+
+module.exports = router;
\ No newline at end of file
diff --git a/backend/server.js b/backend/server.js
index e8217847..0b00369d 100755
--- a/backend/server.js
+++ b/backend/server.js
@@ -77,7 +77,8 @@ app.use(checkAuth);
// ROUTES WITH AUTH
app.use('/campaign', require('./routes/campaign'));
-app.use('/maps', require('./routes/map'))
+app.use('/maps', require('./routes/map'));
+app.use('/datagen', require('./routes/datagen'))
app.use('/admin', require('./routes/admin'))
// GET localhost:8081/concept/list
diff --git a/client/src/services/Api.js b/client/src/services/Api.js
index 610f3e84..1b41e341 100644
--- a/client/src/services/Api.js
+++ b/client/src/services/Api.js
@@ -156,6 +156,7 @@ class ClientModule {
#_plugin;
#_id;
#_router;
+ #_baseRouter;
#_buttons;
#_previewData;
@@ -169,6 +170,7 @@ class ClientModule {
this.#_plugin = plugin;
this.#_id = id;
this.#_router = new ClientRouter(`/plugins/${plugin.package}/_module/${id}`, {});
+ this.#_baseRouter = new ClientRouter("", {})
this.#_socket = new ClientSocket(`plugins/${plugin.package}/${id}`)
}
@@ -215,6 +217,10 @@ class ClientModule {
get _plugin(){
return this.#_plugin;
}
+
+ getDatagen(){
+ return this.#_baseRouter.get(`/datagen/${this.#_id}`);
+ }
}
class ClientSocket {
diff --git a/plugins/dnd-5e/client/data.js b/plugins/dnd-5e/client/data.js
index 001090fd..305e605e 100644
--- a/plugins/dnd-5e/client/data.js
+++ b/plugins/dnd-5e/client/data.js
@@ -24,20 +24,15 @@ function FetchConcepts(){
}).catch(err => console.log(err));
}
-function FetchData(){
- FetchConcepts();
-}
-
let GetConcepts = () => data.value.concepts;
-let GetConcept = (id) => dndModule.router.get('/item/get', {id})
+let GetItem = (id) => dndModule.router.get('/item/get', {id})
export {
InitData,
- FetchData,
FetchConcepts,
GetConcepts,
- GetConcept,
+ GetItem,
}
\ No newline at end of file
diff --git a/plugins/dnd-5e/client/main.js b/plugins/dnd-5e/client/main.js
index c8fe124c..7ba4ae6c 100644
--- a/plugins/dnd-5e/client/main.js
+++ b/plugins/dnd-5e/client/main.js
@@ -1,4 +1,4 @@
-import { FetchConcepts, FetchData, InitData } from "./data";
+import { FetchConcepts, InitData } from "./data";
import { Global } from '@/services/PluginGlobals';
var dndModule;
@@ -23,9 +23,12 @@ function Main(Api){
let databaseWindow = Api.registerWindow('database', Api.createView('Database'));
let actorsWindow = Api.registerWindow('actors', Api.createView('Actors'));
+ let booksWindow = Api.registerWindow('books', Api.createView('Books'))
Global('dnd-5e').Data = {
windows: {
+ database: databaseWindow,
+ actors: actorsWindow,
character_sheet: Api.registerWindow('character_sheet', Api.createView('CharacterSheet')),
item_sheet: Api.registerWindow('item_sheet', Api.createView('ItemSheet')),
create_item_prompt: Api.registerWindow('create_item_prompt', Api.createView('CreateItemPrompt'))
@@ -36,15 +39,27 @@ function Main(Api){
right: [
{
id: 'database-button',
- icon: '/icons/iconoir/regular/bookmark-book.svg',
+ icon: '/icons/iconoir/regular/book.svg',
action: () => {
Api.createWindow(databaseWindow, {
- title: "Database",
- id: databaseWindow,
- close: () => Api.clearWindow(databaseWindow)
+ title: "Campaign items",
+ id: 'campaign-items-window',
+ close: () => Api.clearWindow("campaign-items-window")
});
}
- }, {
+ },
+ {
+ id: 'database-button',
+ icon: '/icons/iconoir/regular/bookmark-book.svg',
+ action: () => {
+ Api.createWindow(booksWindow, {
+ title: "Books",
+ id: booksWindow,
+ close: () => Api.clearWindow(booksWindow)
+ });
+ }
+ },
+ {
id: 'group-button',
icon: '/icons/iconoir/regular/group.svg',
action: () => {
@@ -64,7 +79,7 @@ function Main(Api){
dndModule.onInit = () => {
InitData();
- FetchData();
+ FetchConcepts();
}
Api.registerModule(dndModule);
diff --git a/plugins/dnd-5e/client/views/Books.vue b/plugins/dnd-5e/client/views/Books.vue
new file mode 100644
index 00000000..1536aaff
--- /dev/null
+++ b/plugins/dnd-5e/client/views/Books.vue
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
diff --git a/plugins/dnd-5e/client/views/ItemSheet.vue b/plugins/dnd-5e/client/views/ItemSheet.vue
index 5c2de3ff..76d41ac6 100644
--- a/plugins/dnd-5e/client/views/ItemSheet.vue
+++ b/plugins/dnd-5e/client/views/ItemSheet.vue
@@ -1,7 +1,7 @@