Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
90 commits
Select commit Hold shift + click to select a range
e321104
Updated graphql version.
cammoore May 25, 2022
9f3ac77
Update index.md
cammoore May 25, 2022
6754e64
Checkpoint
cammoore May 26, 2022
ba1e9e6
Checkpoint
cammoore May 26, 2022
23a4271
Update SignUp.jsx
cammoore May 26, 2022
1b548cc
Got routing working.
cammoore May 26, 2022
a07ba1d
Using React 18.1.0
cammoore May 26, 2022
3cf3f1b
Merge branch 'issue-003'
cammoore May 26, 2022
39c87ab
Updated testcafe and react-dom.
cammoore May 26, 2022
d59b6fb
Update package.json
cammoore May 26, 2022
46e5ce8
Update App.jsx
cammoore May 26, 2022
cc7125c
Update Startup.jsx
cammoore May 26, 2022
2c7b2c4
Changed to using CSS variables.
cammoore May 29, 2022
0f6cf1b
Slowly getting how the CSS variables work.
cammoore May 29, 2022
27fb32a
Updated landing page images.
cammoore May 29, 2022
03e55a1
Update style.css
cammoore May 29, 2022
0f14b84
Merge branch 'main' of https://github.com/ics-software-engineering/me…
cammoore May 29, 2022
b3d056c
Sticky footer.
cammoore May 29, 2022
cb011ed
Look and feel
cammoore May 29, 2022
cb280d6
Changed documentation to match new styling.
cammoore May 29, 2022
be69be3
Updated to 2.7.2
cammoore Jun 1, 2022
925b728
Sticky footer.
cammoore Jun 8, 2022
e2e7f25
Update Footer.jsx
cammoore Jun 8, 2022
f8b6f44
Update signup.page.js
cammoore Jun 11, 2022
571540d
New eslint rules
cammoore Jun 11, 2022
87a8d47
Update ci.yml
cammoore Jun 11, 2022
79490e2
Update package.json
cammoore Jun 11, 2022
670131a
Cleaned up package.json and eslintrc.js
cammoore Jun 12, 2022
6890b2d
Update ci.yml
cammoore Jun 12, 2022
7f12136
Update release
cammoore Jun 20, 2022
8e0c24e
Update NavBar.jsx
cammoore Jun 22, 2022
c971ddc
Update Landing.jsx
cammoore Jun 22, 2022
814d525
Update .eslintrc.js
cammoore Jun 23, 2022
6f98479
Update .eslintrc.js
cammoore Jun 23, 2022
800a4b9
Back to standard bootstrap light
cammoore Jun 23, 2022
edf4059
Update style.css
cammoore Jun 23, 2022
bf70239
Updated npm versions
cammoore Jun 23, 2022
d064e81
Using arrow functions and forEach.
cammoore Jun 24, 2022
c4c2259
Update EditStuff.jsx
cammoore Jun 25, 2022
5e3fd68
Updated the documentation images.
cammoore Jun 29, 2022
6ef71ea
Fixed review issues.
cammoore Jul 15, 2022
0e27100
Using Bootstrap 5.2.0
cammoore Jul 20, 2022
9c9be42
Checkpoint
cammoore Jul 21, 2022
bd6fbe8
Added some CSS variables.
cammoore Jul 21, 2022
6749db4
Merge branch 'main' into main
cammoore Jul 21, 2022
f6b3937
Added style for the signin and signup pages' alerts.
cammoore Jul 21, 2022
83f7ca5
Merge branch 'main' of https://github.com/ics-software-engineering/me…
cammoore Jul 21, 2022
8f578a7
Update package-lock.json
cammoore Jul 21, 2022
e98fd9d
Update versions
cammoore Jul 21, 2022
509f766
bad
cammoore Jul 21, 2022
5a02590
Revert "Update versions"
cammoore Jul 21, 2022
19fdcf6
Revert "Update package-lock.json"
cammoore Jul 21, 2022
548e5cb
Revert "Merge branch 'main' of https://github.com/ics-software-engine…
cammoore Jul 21, 2022
cd0e57e
Revert "Added style for the signin and signup pages' alerts."
cammoore Jul 21, 2022
4b63e4e
Cleaning up the padding and style.
cammoore Jul 21, 2022
ae1bace
Get rid of superfluous package-lock.json
philipmjohnson Aug 1, 2022
ff4804f
Update to index page with new YouTube links.
philipmjohnson Aug 6, 2022
6f14efe
try to fix build
philipmjohnson Aug 6, 2022
0a37224
Updated npm versions.
cammoore Aug 6, 2022
399dae9
Updated Uniforms version.
cammoore Oct 19, 2022
5a51fad
Updated Bootstrap
cammoore Oct 19, 2022
a09f06c
updated npm packages
cammoore Oct 20, 2022
2ca57b2
updated npm packages 2
cammoore Oct 20, 2022
a498136
Added unimported script.
cammoore Nov 2, 2022
c5994e7
Updated npm packages
cammoore Nov 2, 2022
3e1e206
Updated Meteor and NPM packages.
cammoore Dec 15, 2022
79ea0a0
Updated collection
cammoore Jan 23, 2023
597625f
Update npm versions
cammoore Jan 23, 2023
803e60f
Merge branch 'main' into update-meteor
cammoore Jan 23, 2023
ff7500a
Update Meteor to 2.10.0
cammoore Jan 23, 2023
aa2cbf6
Update App.jsx
cammoore Feb 6, 2023
5d22933
updated npm packages
cammoore Feb 15, 2023
a377b8c
Update Publications.js
cammoore Apr 18, 2023
0256b46
Changed the way we run test the landing page.
cammoore May 1, 2023
9f852f3
Seeing if the changes to testcafe work.
cammoore May 1, 2023
7b1aa1c
Update ci.yml
cammoore May 1, 2023
106e4b3
Update ci.yml
cammoore May 1, 2023
c6a525e
Updated to meteor 2.12.0
cammoore Jul 12, 2023
08ebf2b
Update npm packages
cammoore Jul 12, 2023
a5bca07
Updated testcafe version
cammoore Jul 12, 2023
51bd8c8
Updated Meteor
cammoore Sep 21, 2023
4acd484
Fixed npm vulnerabilities.
cammoore Sep 21, 2023
03831fa
Update package-lock.json
cammoore Oct 16, 2023
88e3250
Update package-lock.json
cammoore Nov 20, 2023
2758eac
Updating Meteor
cammoore Jan 27, 2024
d623c5d
Updated packages
cammoore Jan 27, 2024
0f939cd
Updated Meteor to 2.15
cammoore Feb 20, 2024
ed06b19
Updated npm packages
cammoore Mar 11, 2024
b950dc6
Update task-description.md
cammoore Apr 25, 2024
dfe6deb
Changed tab title and favicon
k-deguz Jun 25, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Issue
about: Use this template to create general issues
title: ''
labels: ''
assignees: ''

---

Please do work for this task in a branch called issue-XXX.
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/review.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Review
about: Use this template to create a new review
title: 'Review: '
labels: 'Review'
assignees: ''

---

## Overview

The focus for this code review will be centered around the _____ page.
Please pay attention too:
* Javascript issues
* React components

## Review Branch

review-xxx

## Files to review

* file1
* file2

## Checklists

* [Architecture](../../checklists/architecture-checklist.md)
* [Design](../../checklists/design-checklist.md)
* [JS](../../checklists/js-checklist.md)
* [React](../../checklists/react-checklist.md)
* [Testing](../../checklists/testing-checklist.md)

## Due date

Day, Month Day Time

## For more information

The review process is documented at: http://courses.ics.hawaii.edu/ics414s21/morea/review/reading-idpm-review.html
10 changes: 0 additions & 10 deletions .github/ISSUE_TEMPLATE/task-description.md

This file was deleted.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[![ci-meteor-application-template-react](https://github.com/ics-software-engineering/meteor-application-template-react/actions/workflows/ci.yml/badge.svg)](https://github.com/ics-software-engineering/meteor-application-template-react/actions/workflows/ci.yml)
[![ci-meteor-application-template-production](https://github.com/ics-software-engineering/meteor-application-template-production/actions/workflows/ci.yml/badge.svg)](https://github.com/ics-software-engineering/meteor-application-template-production/actions/workflows/ci.yml)

For details, please see http://ics-software-engineering.github.io/meteor-application-template-react/
For details, please see http://ics-software-engineering.github.io/meteor-application-template-production/
6 changes: 4 additions & 2 deletions app/.meteor/packages
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ ecmascript@0.16.2 # Enable ECMAScript2015+ syntax in app code
# typescript@3.7.6 # Enable TypeScript syntax in .ts and .tsx modules
shell-server@0.5.0 # Server-side component of the `meteor shell` command

# autopublish@1.0.7 # Publish all data to the clients (for prototyping)
insecure@1.0.7 # Allow all DB writes from clients (for prototyping)
static-html@1.3.2 # Define static page content in .html files
react-meteor-data # React higher-order component for reactively tracking Meteor data

Expand All @@ -42,3 +40,7 @@ montiapm:agent # see http://montiapm.com
zodern:hide-production-sourcemaps
hot-module-replacement@0.5.1
dev-error-overlay@0.1.1
mdg:validated-method
didericis:callpromise-mixin
meteortesting:mocha
udondan:zipzap
8 changes: 7 additions & 1 deletion app/.meteor/versions
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ ddp-common@1.4.0
ddp-rate-limiter@1.1.0
ddp-server@2.5.0
dev-error-overlay@0.1.1
didericis:callpromise-mixin@0.0.1
diff-sequence@1.1.1
dynamic-import@0.7.2
ecmascript@0.16.2
Expand All @@ -36,14 +37,18 @@ hot-code-push@1.0.4
hot-module-replacement@0.5.1
html-tools@1.1.3
htmljs@1.1.1
http@1.0.10
id-map@1.1.1
insecure@1.0.7
inter-process-messaging@0.1.1
launch-screen@1.3.0
localstorage@1.2.0
logging@1.3.1
mdg:validated-method@1.2.0
meteor@1.10.0
meteor-base@1.5.1
meteortesting:browser-tests@1.3.5
meteortesting:mocha@2.0.3
meteortesting:mocha-core@8.0.1
minifier-css@1.6.0
minifier-js@2.7.4
minimongo@1.8.0
Expand Down Expand Up @@ -83,6 +88,7 @@ templating-tools@1.2.2
tmeasday:check-npm-versions@1.0.2
tracker@1.2.0
typescript@4.5.4
udondan:zipzap@2.2.2_1
underscore@1.0.10
url@1.3.2
webapp@1.13.1
Expand Down
269 changes: 269 additions & 0 deletions app/imports/api/base/BaseCollection.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,269 @@
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
import { _ } from 'meteor/underscore';
import { check } from 'meteor/check';
import { Roles } from 'meteor/alanning:roles';
import { ROLE } from '../role/Role';

class BaseCollection {
/**
* Superclass constructor for all entities.
* Defines internal fields needed by all entities: _type, _collectionName, _collection, and _schema.
* @param {String} type The name of the entity defined by the subclass.
* @param {SimpleSchema} schema The schema for validating fields on insertion to the DB.
*/
constructor(type, schema) {
this._type = type;
this._collectionName = `${this._type}Collection`;
this._collection = new Mongo.Collection(this._collectionName);
this._schema = schema;
this._collection.attachSchema(this._schema);
}

/**
* Returns the number of documents in this collection.
* @returns { Number } The number of elements in this collection.
*/
count() {
return this._collection.find().count();
}

/**
* Defines documents in this collection. Must be overridden in subclasses.
* @param {Object} obj the object defining the new document.
*/
define(obj) {
throw new Meteor.Error(`The define(${obj}) method is not defined in BaseCollection.`);
}

/**
* Runs a simplified version of update on this collection. This method must be overriden in subclasses.
* @see {@link http://docs.meteor.com/api/collections.html#Mongo-Collection-update}
* @param { Object } selector A MongoDB selector.
* @param { Object } modifier A MongoDB modifier
*/
update(selector, modifier) {
throw new Meteor.Error(`update(${selector}, ${modifier}) is not not defined in BaseCollection.`);
}

/**
* A stricter form of remove that throws an error if the document or docID could not be found in this collection.
* @param { String | Object } id A document or docID in this collection.
*/
removeIt(id) {
const doc = this.findDoc(id);
check(doc, Object);
this._collection.remove(doc._id);
return true;
}

/**
* Runs find on this collection.
* @see {@link http://docs.meteor.com/#/full/find|Meteor Docs on Mongo Find}
* @param { Object } selector A MongoDB selector.
* @param { Object } options MongoDB options.
* @returns {Mongo.Cursor}
*/
find(selector, options) {
const theSelector = (typeof selector === 'undefined') ? {} : selector;
return this._collection.find(theSelector, options);
}

/**
* A stricter form of findOne, in that it throws an exception if the entity isn't found in the collection.
* @param { String | Object } name Either the docID, or an object selector, or the 'name' field value.
* @returns { Object } The document associated with name.
* @throws { Meteor.Error } If the document cannot be found.
*/
findDoc(name) {
if (_.isNull(name) || _.isUndefined(name)) {
throw new Meteor.Error(`${name} is not a defined ${this.type}`);
}
const doc = (
this._collection.findOne(name)
|| this._collection.findOne({ name })
|| this._collection.findOne({ _id: name }));
if (!doc) {
if (typeof name !== 'string') {
throw new Meteor.Error(`${JSON.stringify(name)} is not a defined ${this._type}`, '', Error().stack);
} else {
throw new Meteor.Error(`${name} is not a defined ${this._type}`, '', Error().stack);
}
}
return doc;
}

/**
* Runs findOne on this collection.
* @see {@link http://docs.meteor.com/#/full/findOne|Meteor Docs on Mongo Find}
* @param { Object } selector A MongoDB selector.
* @param { Object } options MongoDB options.
* @returns {Mongo.Cursor}
*/
findOne(selector, options) {
const theSelector = (typeof selector === 'undefined') ? {} : selector;
return this._collection.findOne(theSelector, options);
}

/**
* Return the type of this collection.
* @returns { String } The type, as a string.
*/
getType() {
return this._type;
}

/**
* Return the publication name.
* @returns { String } The publication name, as a string.
*/
getPublicationName() {
return this._collectionName;
}

/**
* Returns the collection name.
* @return {string} The collection name as a string.
*/
getCollectionName() {
return this._collectionName;
}

/**
* Returns the schema attached to this collection.
* @return {SimpleSchema}
*/
getSchema() {
return this._schema;
}

/**
* Returns true if the passed entity is in this collection.
* @param { String | Object } name The docID, or an object specifying a document.
* @returns {boolean} True if name exists in this collection.
*/
isDefined(name) {
if (_.isUndefined(name)) {
return false;
}
return (
!!this._collection.findOne(name)
|| !!this._collection.findOne({ name })
|| !!this._collection.findOne({ _id: name }));
}

/**
* Default publication method for entities.
* It publishes the entire collection. This should be overridden in subclasses.
*/
publish() {
if (Meteor.isServer) {
Meteor.publish(this._collectionName, () => this._collection.find());
}
}

/**
* Default subscription method for entities.
* It subscribes to the entire collection. Should be overridden in subclass
*/
subscribe() {
if (Meteor.isClient) {
return Meteor.subscribe(this._collectionName);
}
return undefined;
}

assertRole(userId, roles) {
// console.log(userId, roles, Roles.userIsInRole(userId, roles));
if (!userId) {
throw new Meteor.Error('unauthorized', 'You must be logged in.');
} else if (!Roles.userIsInRole(userId, roles)) {
throw new Meteor.Error('unauthorized', `You must be one of the following roles: ${roles}`);
}
return true;
}

/**
* Verifies that the passed object is one of this collection's instances.
* @param { String | List } name Should be a defined ID or doc in this collection.
* @throws { Meteor.Error } If not defined.
*/
assertDefined(name) {
if (!this.isDefined(name)) {
throw new Meteor.Error(`${name} is not a valid instance of ${this._type}.`);
}
}

/**
* Default implementation of assertValidRoleForMethod. Asserts that userId is logged in as an Admin or Advisor.
* This is used in the define, update, and removeIt Meteor methods associated with each class.
* @param userId The userId of the logged in user. Can be null or undefined
* @throws { Meteor.Error } If there is no logged in user, or the user is not an Admin or Advisor.
*/
assertValidRoleForMethod(userId) {
this.assertRole(userId, [ROLE.ADMIN]);
}

/**
* Define the default integrity checker for all applications.
* Returns an array with a string indicating that this method is not overridden.
* @returns { array } An array containing a string indicating the use of the default integrity checker.
*/
checkIntegrity() {
return ['There is no integrity checker defined for this collection.'];
}

/**
* Returns an object with two fields: name and contents.
* Name is the name of this collection.
* Contents is an array of objects suitable for passing to the restore() method.
* @returns {Object} An object representing the contents of this collection.
*/
dumpAll() {
const dumpObject = {
name: this._collectionName,
contents: this.find().map((docID) => this.dumpOne(docID)),
};
// If a collection doesn't want to be dumped, it can just return null from dumpOne.
dumpObject.contents = _.without(dumpObject.contents, null);
// sort the contents array by slug (if present)
if (dumpObject.contents[0] && dumpObject.contents[0].slug) {
dumpObject.contents = _.sortBy(dumpObject.contents, (obj) => obj.slug);
}
return dumpObject;
}

/**
* Returns an object representing the definition of docID in a format appropriate to the restoreOne function.
* Must be overridden by each collection.
* @param docID A docID from this collection.
* @returns { Object } An object representing this document.
*/
dumpOne(docID) {
throw new Meteor.Error(`Default dumpOne method invoked by collection ${this._collectionName} on ${docID}`);
}

/**
* Defines the entity represented by dumpObject.
* Defaults to calling the define() method if it exists.
* @param dumpObject An object representing one document in this collection.
* @returns { String } The docID of the newly created document.
*/
restoreOne(dumpObject) {
if (typeof this.define === 'function') {
return this.define(dumpObject);
}
return null;
}

/**
* Defines all the entities in the passed array of objects.
* @param dumpObjects The array of objects representing the definition of a document in this collection.
*/
restoreAll(dumpObjects) {
dumpObjects.forEach((dumpObject) => this.restoreOne(dumpObject));
}

}

export default BaseCollection;
Loading