Browse Source

Refactored mong.js; Implemented majorList for ProfilCard;

master
Erik Römmelt 5 years ago
parent
commit
633dbc90f0
9 changed files with 97 additions and 34 deletions
  1. 8
    13
      mong.js
  2. 9
    0
      mong_msg.js
  3. 3
    0
      mong_tag.js
  4. 11
    0
      mong_usr.js
  5. 1
    1
      public/index.html
  6. 46
    0
      public/routes/majorData.js
  7. 15
    5
      public/routes/profilCard.js
  8. 0
    10
      public/routes/profilData.js
  9. 4
    5
      server/dbs.js

+ 8
- 13
mong.js View File

db = db.getSiblingDB('omdb')
var db = db.getSiblingDB('omdb');


db.messages.insert([
{"subject":"DOLORE LABORIS AUTE","message":"Ex sunt elit elit in ex ad labore minim. Elit amet irure sit aliquip excepteur sit qui et aute qui mollit cillum.","user":"Jaime Potter","tag":["sit","in","dolore","ullamco"]},
{"subject":"NON IPSUM MOLLIT","message":"Ut laborum proident magna magna qui non in voluptate reprehenderit labore. Qui consectetur dolor nisi culpa cillum quis.","user":"Goff Durham","tag":["aliqua","sunt","labore","minim"]},
{"subject": "ESSE IPSUM INCIDIDUNT","message":"Esse enim amet laboris proident do do ut cupidatat laborum ex. Sit esse id laborum aliqua id.","user":"Helena Mercado","tag":["fugiat","nisi","incididunt","ullamco"]},
{"subject":"PARIATUR DOLOR SUNT","message":"Exercitation officia ad consequat est voluptate est incididunt ut culpa consectetur. Consectetur irure veniam ipsum sint sit anim minim aute exercitation ullamco nostrud reprehenderit consequat.","user":"Christi Walker","tag":["consectetur","sint","qui","ipsum"]},
{"subject":"TEMPOR ID VOLUPTATE","message":"Anim ex commodo officia consequat in magna esse sunt mollit sunt commodo. Ex sit aute reprehenderit elit magna sunt irure pariatur cupidatat labore.","user":"Kent Schroeder","tag":["adipisicing","nulla","tempor","veniam"]},
{"subject":"LOREM EST AUTE","message":"Irure excepteur laborum quis tempor officia cillum officia est ea adipisicing duis enim aliqua. Est dolor laborum officia elit ullamco.","user":"Dominguez Stevens","tag":["mollit","amet","consectetur","dolore"]},
{"subject":"ESSE MOLLIT CILLUM","message":"Eu culpa laborum consequat sunt aliqua excepteur. Voluptate pariatur deserunt consequat id nostrud do magna occaecat sint nulla non nostrud.","user":"Terrell Padilla","tag":["Lorem","consequat","fugiat","aliqua"]}
])
// Insert data in collections
load('mong_msg.js');
load('mong_tag.js');
load('mong_usr.js');


db.tags.insert([
{"name":"Lorem"},{"name":"fugiat"},{"name":"aliqua"},{"name":"consequat"},{"name":"mollit"},{"name":"aet"},{"name":"consectetur"},{"name":"dolore"},{"name":"nulla"},{"name":"tempor"},{"name":"veniam"},{"name":"ipsum"},{"name":"adipisicing"},{"name":"qui"},{"name":"sint"},{"name":"ullamco"},{"name":"incididunt"},{"name":"nisi"},{"name":"sit"},{"name":"minim"},{"name":"labore"},{"name":"sunt"},{"name":"in"}
])
// Delete all collections + all records
//db.messages.drop(); db.tags.drop(); db.user.drop(); db.sessions.drop()


// Print all collections + records count
var collections = db.getCollectionNames(); var collections = db.getCollectionNames();
print('Collections inside the db:'); print('Collections inside the db:');
for(var i = 0; i < collections.length; i++){ for(var i = 0; i < collections.length; i++){

+ 9
- 0
mong_msg.js View File

db.messages.insert([
{"subject":"DOLORE LABORIS AUTE","message":"Ex sunt elit elit in ex ad labore minim. Elit amet irure sit aliquip excepteur sit qui et aute qui mollit cillum.","user":"Jaime Potter","tag":["sit","in","dolore","ullamco"]},
{"subject":"NON IPSUM MOLLIT","message":"Ut laborum proident magna magna qui non in voluptate reprehenderit labore. Qui consectetur dolor nisi culpa cillum quis.","user":"Goff Durham","tag":["aliqua","sunt","labore","minim"]},
{"subject": "ESSE IPSUM INCIDIDUNT","message":"Esse enim amet laboris proident do do ut cupidatat laborum ex. Sit esse id laborum aliqua id.","user":"Helena Mercado","tag":["fugiat","nisi","incididunt","ullamco"]},
{"subject":"PARIATUR DOLOR SUNT","message":"Exercitation officia ad consequat est voluptate est incididunt ut culpa consectetur. Consectetur irure veniam ipsum sint sit anim minim aute exercitation ullamco nostrud reprehenderit consequat.","user":"Christi Walker","tag":["consectetur","sint","qui","ipsum"]},
{"subject":"TEMPOR ID VOLUPTATE","message":"Anim ex commodo officia consequat in magna esse sunt mollit sunt commodo. Ex sit aute reprehenderit elit magna sunt irure pariatur cupidatat labore.","user":"Kent Schroeder","tag":["adipisicing","nulla","tempor","veniam"]},
{"subject":"LOREM EST AUTE","message":"Irure excepteur laborum quis tempor officia cillum officia est ea adipisicing duis enim aliqua. Est dolor laborum officia elit ullamco.","user":"Dominguez Stevens","tag":["mollit","amet","consectetur","dolore"]},
{"subject":"ESSE MOLLIT CILLUM","message":"Eu culpa laborum consequat sunt aliqua excepteur. Voluptate pariatur deserunt consequat id nostrud do magna occaecat sint nulla non nostrud.","user":"Terrell Padilla","tag":["Lorem","consequat","fugiat","aliqua"]}
])

+ 3
- 0
mong_tag.js View File

db.tags.insert([
{"name":"Lorem"},{"name":"fugiat"},{"name":"aliqua"},{"name":"consequat"},{"name":"mollit"},{"name":"aet"},{"name":"consectetur"},{"name":"dolore"},{"name":"nulla"},{"name":"tempor"},{"name":"veniam"},{"name":"ipsum"},{"name":"adipisicing"},{"name":"qui"},{"name":"sint"},{"name":"ullamco"},{"name":"incididunt"},{"name":"nisi"},{"name":"sit"},{"name":"minim"},{"name":"labore"},{"name":"sunt"},{"name":"in"}
])

+ 11
- 0
mong_usr.js View File

db.user.insert([
// author,OHMNEWS2019
{"_id":"author","name":"Test Author","type":"author","roles":["user","author"],"hash":"sha256","salt":"cy5CkPrplcEze6o4psURhw==","pwd":"Gc8ozlxjEGITkS+fW9tz2xLROzws44s04EOCWuP04qE=","tags":["wichtig","th"],"bookmarks":["th"],},
// admin,oZuse1
{"_id":"admin","name":"Test Admin","type":"admin","roles":["user","author","admin"],"hash":"sha256","salt":"PoIUHbDp7tP34ji31iQ0zw==","pwd":"mJpIfIksYs6LJJwYRBemFKqR6TacsSl2E0ZtpO1GMuk=","tags":["wichtig","th"],"bookmarks":["wichtig"],},
])

//var c = require('./server/crypto.js'),
// e = {"_id":"writer","hash":"sha256"};
//c.fillLocalAuth(e,"pwd");
//console.info(JSON.stringify(e));

+ 1
- 1
public/index.html View File

<script src="routes/msgCard.js"></script> <script src="routes/msgCard.js"></script>
<script src="routes/messageData.js"></script> <script src="routes/messageData.js"></script>
<script src="routes/tagData.js"></script> <script src="routes/tagData.js"></script>
<script src="routes/majorData.js"></script>
<script src="routes/profilCard.js"></script> <script src="routes/profilCard.js"></script>
<script src="routes/profilData.js"></script>
<script src="routes/navRoutes.js"></script> <script src="routes/navRoutes.js"></script>
<script src="search.js"></script> <script src="search.js"></script>
</head> </head>

+ 46
- 0
public/routes/majorData.js View File

var majorList = [
{id:'B-AC',name:'Bachelor Angewandte Chemie'},
{id:'B-AMP',name:'Bachelor Angewandte Mathematik und Physik'},
{id:'B-TJ',name:'Bachelor Technikjournalismus/Technik-PR'},
{id:'B-AR',name:'Bachelor Architektur'},
{id:'B-BI',name:'Bachelor Bauingenieurwesen'},
{id:'B-BW',name:'Bachelor Betriebswirtschaft'},
{id:'B-BIO',name:'Bachelor Management in der Biobranche'},
{id:'B-IB',name:'Bachelor International Business'},
{id:'B-IBT',name:'Bachelor International Business and Technology'},
{id:'B-DE',name:'Bachelor Design'},
{id:'B-EI',name:'Bachelor Elektrotechnik und Informationstechnik'},
{id:'B-MED',name:'Bachelor Medizintechnik'},
{id:'B-MF',name:'Bachelor Mechatronik/Feinwerktechnik'},
{id:'B-ME',name:'Bachelor Media Engineering'},
{id:'B-IN',name:'Bachelor Informatik'},
{id:'B-MIN',name:'Bachelor Medieninformatik'},
{id:'B-WIN',name:'Bachelor Wirtschaftsinformatik'},
{id:'B-MB',name:'Bachelor Maschinenbau'},
{id:'B-EGT',name:'Bachelor Energie- und Gebäudetechnik'},
{id:'B-EBL',name:'Bachelor Soziale Arbeit: Erziehung und Bildung im Lebenslauf'},
{id:'B-SA',name:'Bachelor Soziale Arbeit'},
{id:'B-EPT',name:'Bachelor Energieprozesstechnik'},
{id:'B-VT',name:'Bachelor Verfahrenstechnik'},
{id:'B-WT',name:'Bachelor Werkstofftechnik'},
{id:'M-AMP',name:'Master Angewandte Mathematik und Physik'},
{id:'M-AR',name:'Master Architektur'},
{id:'M-BI',name:'Master Internationales Bauwesen'},
{id:'M-URB',name:'Master Urbane Mobilität (Verkehrsingenieurwesen)'},
{id:'M-BW',name:'Master Betriebswirtschaft'},
{id:'M-TAX',name:'Master Steuerberatung'},
{id:'M-WR',name:'Master Wirtschaftsrecht'},
{id:'M-IFE',name:'Master International Finance and Economics'},
{id:'M-IMA',name:'Master International Marketing'},
{id:'M-APR',name:'Master Applied Research in Engineering Sciences'},
{id:'M-SY',name:'Master Elektronische und Mechatronische Systeme'},
{id:'M-IN',name:'Master Informatik'},
{id:'M-MIN',name:'Master Medieninformatik'},
{id:'M-WIN',name:'Master Wirtschaftsinformatik'},
{id:'M-MB',name:'Master Maschinenbau'},
{id:'M-EE',name:'Master Energiemanagement und Energietechnik'},
{id:'M-GT',name:'Master Gebäudetechnik'},
{id:'M-SA',name:'Master Soziale Arbeit'},
{id:'M-VT',name:'Master Chemieingenieurwesen und Verfahrenstechnik'},
{id:'M-WT',name:'Master Werkstofftechnik'},
];

+ 15
- 5
public/routes/profilCard.js View File



<div class="profil-text"> <div class="profil-text">
<span style="font-size:120%; display:inline-block; margin: 0.8rem 0 0 0;"><b>{{ auth.name }}</b></span><br><br> <span style="font-size:120%; display:inline-block; margin: 0.8rem 0 0 0;"><b>{{ auth.name }}</b></span><br><br>
<span style="font-size:90%; display:inline-block; margin: 0 0 0.8rem 0;"><b>{{ auth.type }}</b></span>
<span style="font-size:90%; display:inline-block; margin: 0 0 0.8rem 0;"><b>{{ major }}</b></span>
<br><br> <br><br>
</div> </div>


abo: 7, abo: 7,
saved: 3, saved: 3,
isCardModalActive: false, isCardModalActive: false,
majorList: {
},
}; };
}, },
computed: { computed: {

major: function() {
// e.g. ST@B-ME;ST@EFI;
var majorID = auth.type.split(';')[0].split('@')[1];
//console.info(majorID);
//console.info(majorList);
var majorName = 'Studiengang Unbekannt';
majorList.forEach(function(major) {
if (major.id == majorID) {
majorName = major.name;
}
});
return majorName;
},
}, },
methods: { methods: {
logout: function() { logout: function() {
clearAuthState(); clearAuthState();
$.ajax({ url: "api/logout", method: "POST" }); $.ajax({ url: "api/logout", method: "POST" });
router.push('/profil'); router.push('/profil');
}
},
} }
}); });

+ 0
- 10
public/routes/profilData.js View File

_profilcard = [
{
id: 1,
user: '',
major: '',
semester: '',
abos: '7',
saved: '3',
},
];

+ 4
- 5
server/dbs.js View File

model.Tags._list = [ "" ]; model.Tags._list = [ "" ];


var userSchema = common.mongoose.Schema({ var userSchema = common.mongoose.Schema({
//_id: { type: String },
_id: { type: String },
name: { type: String, required: true, name: { type: String, required: true,
_comment: "" }, _comment: "" },
pwd: { type: String, pwd: { type: String,
_comment: "" }, _comment: "" },
//hash: { type: String },
//salt: { type: String },
//type: { type: String },
hash: { type: String },
salt: { type: String },
type: { type: String },
roles: { type: [String], required: true, roles: { type: [String], required: true,
_comment: "" }, _comment: "" },
tags: { type: [String], tags: { type: [String],
_comment: "" }, _comment: "" },
//deactivated: { type: Boolean }, //deactivated: { type: Boolean },
//participating: { type: [String] },
//host: { type: Boolean }, //host: { type: Boolean },
bookmarks: { type: [String], bookmarks: { type: [String],
_comment: "" }, _comment: "" },

Loading…
Cancel
Save