Share todo category and sub categories?


#1

Hi,

I’m making a todo app where people can make 5-6 subcategory levels.with tasks to every level

level 1
– level 2
— level 3
---- level 4
----- level 5
------ level 6

How can I share e.g. level 3 with one og more persons and when I share there also can se levels under level 3 plus tasks that is not make privat


#2

It’s more so a server side issue.


#3

User an Owner ID collection field.

Examples:

var task_park_id = "d8salkdjas08ff"; 
var tasks_level_1 = Tasks.find({parent_id:task_parent_id});
tasks_level_1.forEach(function(task){
  var tasks_level_2 = Taks.find({parent_id:task._id});
  tasks_level_2.forEach(function(task){
    console.log(task.title);
  }
}

For example :slight_smile:


#4

Hi SkyRooms

Can you help me a bit more :slight_smile:

I have:

{{#each cats}}
    {{> cat}} 
{{/each}}

and helper to find categories where user is owner or shared with:

Template.mainLayout.helpers({
    'cats': function(){
        return Categories.find({userid: Meteor.userId()}, { sort: { createdAt: -1 } });
    }
});

insert new category


// Insert a category into the collection
    Categories.insert({
      categori: thecat,
      userid: Meteor.userId(),
      createdAt: new Date() // current time
    });

add category template:

<template name="addcat">
    <form class="new-cat" style="text-align:center;">
    <button class="mdl-button mdl-js-button mdl-button--fab mdl-button--mini-fab mdl-button--colored">
    <i class="material-icons">add</i>
    </button>
    </form>
</template>

howto use your code with this and how do i use the collection for the Owner ID collection

this is still a bit over my meteor rookie level.


#5
{{#each category_1}}
  The parent is: _id
  {{#each category_2}}    
      The parent is: parent_id
    {{#each category_3}}  
      The parent is: parent_id  
    {{/each}}
  {{/each}}
{{/each}}

Now you’ll need to create helpers for each category_1, category_2, category_3 for which you do a find();

See it yet?


#6

He’s telling you to find category_2 where Meteor.user() is in list of users that are allowed to see this category (data entry).


#7

Finally i have time to make some meteor.

I think that I understand how to find categories but where do i store the users who have permissions to se category_2 and all categories under that (cat4 + cat5…)


#8

Basically on that document of. category “find caregory, fmeteor user”. The guide for meteor walks privacy and ownership “settings”


#9

Do you have a link to the document?


#10

document is mongodb record in collection. go to meteor.com, press on guide in navigation bar I imagine. *tutorial: https://www.meteor.com/tutorials, the to do app on left.


#11
{{#each category_1}}
  The parent is: _id
  {{#each category_2}}  **<- How to share this category and all categories under it plus all task with a person, but if child todo og category is privat then dont share it.**
      The parent is: parent_id
    {{#each category_3}}  
      The parent is: parent_id  
    {{/each}}
  {{/each}}
{{/each}}

I’m new to mongodb


#12

category_3 helper: find({parent_id, whiteList: this.userId}). you can pass several params to query?
If is not private, I suppose {whiteList: true}, if it is private add users for whitelist. I’m unclear myself how MongoDB treats “true==something”.