diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 00000000..a050ba19 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + // Use IntelliSense para saber los atributos posibles. + // Mantenga el puntero para ver las descripciones de los existentes atributos + // Para más información, visite: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "node", + "request": "launch", + "name": "Launch Program", + "program": "${workspaceFolder}/packages\\moloch-backend\\src\\controllers\\event.controller.ts", + "outFiles": [ + "${workspaceFolder}/**/*.js" + ] + } + ] +} \ No newline at end of file diff --git a/packages/moloch-backend/data/db.json b/packages/moloch-backend/data/db.json index a7930098..45a6140a 100644 --- a/packages/moloch-backend/data/db.json +++ b/packages/moloch-backend/data/db.json @@ -1,20 +1,25 @@ { "ids": { - "Member": 1.112671014000922e+48, - "Project": 5, - "Event": 58, + "Member": 1.1651873397861142e+48, + "Project": 8, + "Event": 91, "Config": 2, - "Period": 12, + "Period": 26, "Asset": 2 }, "models": { "Member": { - "0xaa22d833fc31f74c13613aec5ed3c2955c968a97": "{\"address\":\"0xaa22d833fc31f74c13613aec5ed3c2955c968a97\",\"nonce\":688847,\"title\":\"Membership 1\",\"description\":\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\",\"shares\":100,\"tribute\":0,\"assets\":[{\"asset\":\"ETH\",\"amount\":\"5\"}],\"name\":\"0xaa22d833fc31f74c13613aec5ed3c2955c968a97\",\"status\":\"founder\",\"period\":\"\",\"proposals\":[{\"id\":\"0x091fecd2b293f1ebddd2e72b83de5386c020ca52\",\"title\":\"Membership 2\",\"vote\":\"yes\",\"date\":\"2019-02-04T15:46:01.171Z\"},{\"id\":\"0x1cbf9ced4112efc554f9086b6048d3c244fc05d1\",\"title\":\"Membership 3\",\"vote\":\"yes\",\"date\":\"2019-02-06T15:00:26.393Z\"}]}", - "0x091fecd2b293f1ebddd2e72b83de5386c020ca52": "{\"address\":\"0x091fecd2b293f1ebddd2e72b83de5386c020ca52\",\"nonce\":23476,\"title\":\"Membership 2\",\"description\":\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\\n\\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\",\"shares\":0,\"tribute\":0,\"assets\":[{\"asset\":\"BTC\",\"amount\":\"5\"}],\"name\":\"0x091fecd2b293f1ebddd2e72b83de5386c020ca52\",\"status\":\"active\",\"period\":\"34b941f2-e8ec-b09e-4ea8-f48dcc00f833\",\"voters\":[{\"member\":\"0xaa22d833fc31f74c13613aec5ed3c2955c968a97\",\"vote\":\"yes\",\"shares\":100}],\"end\":4,\"gracePeriod\":6}", + "0xaa22d833fc31f74c13613aec5ed3c2955c968a97": "{\"address\":\"0xaa22d833fc31f74c13613aec5ed3c2955c968a97\",\"nonce\":793483,\"title\":\"Membership 1\",\"description\":\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\",\"shares\":100,\"tribute\":0,\"assets\":[{\"asset\":\"ETH\",\"amount\":\"5\"}],\"name\":\"0xaa22d833fc31f74c13613aec5ed3c2955c968a97\",\"status\":\"founder\",\"period\":\"\",\"proposals\":[{\"id\":\"0x091fecd2b293f1ebddd2e72b83de5386c020ca52\",\"title\":\"Membership 2\",\"vote\":\"yes\",\"date\":\"2019-02-04T15:46:01.171Z\"},{\"id\":\"0x1cbf9ced4112efc554f9086b6048d3c244fc05d1\",\"title\":\"Membership 3\",\"vote\":\"yes\",\"date\":\"2019-02-06T15:00:26.393Z\"}]}", + "0x091fecd2b293f1ebddd2e72b83de5386c020ca52": "{\"address\":\"0x091fecd2b293f1ebddd2e72b83de5386c020ca52\",\"nonce\":23476,\"title\":\"Membership 2\",\"description\":\"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\\n\\nLorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.\",\"shares\":70,\"tribute\":0,\"assets\":[{\"asset\":\"BTC\",\"amount\":\"5\"}],\"name\":\"0x091fecd2b293f1ebddd2e72b83de5386c020ca52\",\"status\":\"active\",\"period\":\"34b941f2-e8ec-b09e-4ea8-f48dcc00f833\",\"voters\":[{\"member\":\"0xaa22d833fc31f74c13613aec5ed3c2955c968a97\",\"vote\":\"yes\",\"shares\":100}],\"end\":4,\"gracePeriod\":6}", "0x1cbf9ced4112efc554f9086b6048d3c244fc05d1": "{\"address\":\"0x1cbf9ced4112efc554f9086b6048d3c244fc05d1\",\"nonce\":385372,\"title\":\"Membership 3\",\"description\":\"Lorem Ipsum is the single greatest threat. We are not - we are not keeping up with other websites. Lorem Ipsum best not make any more threats to your website. It will be met with fire and fury like the world has never seen. Does everybody know that pig named Lorem Ipsum? An ‘extremely credible source’ has called my office and told me that Barack Obama’s placeholder text is a fraud.\\n\\nLorem Ipsum is the single greatest threat. We are not - we are not keeping up with other websites. Lorem Ipsum best not make any more threats to your website. It will be met with fire and fury like the world has never seen. Does everybody know that pig named Lorem Ipsum? An ‘extremely credible source’ has called my office and told me that Barack Obama’s placeholder text is a fraud.\",\"shares\":0,\"tribute\":0,\"assets\":[{\"asset\":\"ETH\",\"amount\":\"12\"}],\"name\":\"0x1cbf9ced4112efc554f9086b6048d3c244fc05d1\",\"status\":\"inactive\",\"period\":\"057449c4-3e3f-0415-15c0-88e9ec01ae51\",\"end\":5,\"gracePeriod\":7,\"voters\":[{\"member\":\"0xaa22d833fc31f74c13613aec5ed3c2955c968a97\",\"vote\":\"yes\",\"shares\":100}]}", - "0xc2e5e4d434587c5915bad0395871b7ce9d58bbf4": "{\"address\":\"0xc2e5e4d434587c5915bad0395871b7ce9d58bbf4\",\"nonce\":596171,\"title\":\"Test 1\",\"description\":\"Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit​​, morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium.\",\"shares\":20,\"tribute\":0,\"assets\":[{\"asset\":\"BTC\",\"amount\":\"10\"}],\"name\":\"0xc2e5e4d434587c5915bad0395871b7ce9d58bbf4\",\"status\":\"pending\",\"period\":\"54d46ddb-251a-080d-21dd-fd9fcadc38a3\",\"end\":5,\"gracePeriod\":7}" + "0xc2e5e4d434587c5915bad0395871b7ce9d58bbf4": "{\"address\":\"0xc2e5e4d434587c5915bad0395871b7ce9d58bbf4\",\"nonce\":596171,\"title\":\"Test 1\",\"description\":\"Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit​​, morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium.\",\"shares\":20,\"tribute\":0,\"assets\":[{\"asset\":\"BTC\",\"amount\":\"10\"}],\"name\":\"0xc2e5e4d434587c5915bad0395871b7ce9d58bbf4\",\"status\":\"pending\",\"period\":\"54d46ddb-251a-080d-21dd-fd9fcadc38a3\",\"end\":0,\"gracePeriod\":0}", + "0xc7e4214148387adc9b3ec63e956df206292a4f8a": "{\"address\":\"0xc7e4214148387adc9b3ec63e956df206292a4f8a\",\"nonce\":181296,\"title\":\"Member A\",\"description\":\"Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit​​, morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium.\\n\\nZombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit​​, morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium.\",\"shares\":10,\"tribute\":0,\"assets\":[{\"asset\":\"ETH\",\"amount\":\"1\"}],\"name\":\"0xc7e4214148387adc9b3ec63e956df206292a4f8a\",\"proposals\":[{\"id\":\"0xc7e4214148387adc9b3ec63e956df206292a4f8a\",\"title\":\"Member A\",\"vote\":\"owner\",\"date\":\"2019-02-07T00:00:00.000Z\"}],\"period\":\"ebde06ff-c828-6c4c-e5a8-87936043020c\",\"status\":\"inprogress\",\"end\":6,\"gracePeriod\":8}", + "0xcc18ceaeebaa398759edd1828ad7414d31df7c1c": "{\"address\":\"0xcc18ceaeebaa398759edd1828ad7414d31df7c1c\",\"nonce\":504254,\"title\":\"Member B\",\"description\":\"Bacon ipsum dolor amet short ribs brisket venison rump drumstick pig sausage prosciutto chicken spare ribs salami picanha doner. Kevin capicola sausage, buffalo bresaola venison turkey shoulder picanha ham pork tri-tip meatball meatloaf ribeye. Doner spare ribs andouille bacon sausage. Ground round jerky brisket pastrami shank.\\n\\nBacon ipsum dolor amet short ribs brisket venison rump drumstick pig sausage prosciutto chicken spare ribs salami picanha doner. Kevin capicola sausage, buffalo bresaola venison turkey shoulder picanha ham pork tri-tip meatball meatloaf ribeye. Doner spare ribs andouille bacon sausage. Ground round jerky brisket pastrami shank.\",\"shares\":20,\"tribute\":0,\"assets\":[{\"asset\":\"BTC\",\"amount\":\"1\"}],\"name\":\"0xcc18ceaeebaa398759edd1828ad7414d31df7c1c\",\"proposals\":[{\"id\":\"0xcc18ceaeebaa398759edd1828ad7414d31df7c1c\",\"title\":\"Member B\",\"vote\":\"owner\",\"date\":\"2019-02-07T00:00:00.000Z\"}],\"period\":\"db65e95c-6492-9964-8d40-971d0ed127cc\",\"status\":\"pending\"}", + "0x7993441ee70024f9ca815f1c2e5dc4dd4df4ead3": "{\"address\":\"0x7993441ee70024f9ca815f1c2e5dc4dd4df4ead3\",\"nonce\":885020,\"title\":\"Member C\",\"description\":\"Cupcake ipsum dolor. Sit amet marshmallow topping cheesecake muffin. Halvah croissant candy canes bonbon candy. Apple pie jelly beans topping carrot cake danish tart cake cheesecake. Muffin danish chocolate soufflé pastry icing bonbon oat cake. Powder cake jujubes oat cake. Lemon drops tootsie roll marshmallow halvah carrot cake.\\n\\nCupcake ipsum dolor. Sit amet marshmallow topping cheesecake muffin. Halvah croissant candy canes bonbon candy. Apple pie jelly beans topping carrot cake danish tart cake cheesecake. Muffin danish chocolate soufflé pastry icing bonbon oat cake. Powder cake jujubes oat cake. Lemon drops tootsie roll marshmallow halvah carrot cake.\",\"shares\":30,\"tribute\":0,\"assets\":[{\"asset\":\"ETH\",\"amount\":\"3\"}],\"name\":\"0x7993441ee70024f9ca815f1c2e5dc4dd4df4ead3\",\"proposals\":[{\"id\":\"0x7993441ee70024f9ca815f1c2e5dc4dd4df4ead3\",\"title\":\"Member C\",\"vote\":\"owner\",\"date\":\"2019-02-07T00:00:00.000Z\"}],\"period\":\"7a1fe77f-c299-df8c-2945-bfe4fc37de6a\",\"status\":\"pending\"}" + }, + "Project": { + "9f33d7de-5b8b-bb34-3015-b9d3b513c11c": "{\"id\":\"9f33d7de-5b8b-bb34-3015-b9d3b513c11c\",\"title\":\"Project A\",\"description\":\"Just say anything, George, say what ever's natural, the first thing that comes to your mind. Take that you mutated son-of-a-bitch. My pine, why you. You space bastard, you killed a pine. You do? Yeah, it's 8:00. Hey, McFly, I thought I told you never to come in here. Well it's gonna cost you. How much money you got on you?\\n\\nJust say anything, George, say what ever's natural, the first thing that comes to your mind. Take that you mutated son-of-a-bitch. My pine, why you. You space bastard, you killed a pine. You do? Yeah, it's 8:00. Hey, McFly, I thought I told you never to come in here. Well it's gonna cost you. How much money you got on you?\",\"tribute\":0,\"status\":\"pending\",\"period\":\"cc3e1514-10dc-8451-9667-1f647f228eaf\",\"assets\":[{\"asset\":\"ETH\",\"amount\":\"1\"}]}" }, - "Project": {}, "Asset": {}, "Event": { "f4ddc86c-940e-8fdd-b23d-1b6da4f75cbe": "{\"id\":\"f4ddc86c-940e-8fdd-b23d-1b6da4f75cbe\",\"name\":\"User creation\",\"payload\":{\"address\":\"0xaa22d833fc31f74c13613aec5ed3c2955c968a97\",\"nonce\":688847}}", @@ -52,7 +57,26 @@ "67cde0f0-a3d4-677b-b4b4-e2d52a0ac1bb": "{\"id\":\"67cde0f0-a3d4-677b-b4b4-e2d52a0ac1bb\",\"name\":\"Redeem loot token\",\"payload\":{\"address\":\"0x1cbf9ced4112efc554f9086b6048d3c244fc05d1\"}}", "1aca88e1-71e0-6e80-2f6a-71f3a5bd8c8f": "{\"id\":\"1aca88e1-71e0-6e80-2f6a-71f3a5bd8c8f\",\"name\":\"Redeem loot token\",\"payload\":{\"address\":\"0x1cbf9ced4112efc554f9086b6048d3c244fc05d1\"}}", "dc80a16b-6fc6-8dd2-1c7f-4c3246f99842": "{\"id\":\"dc80a16b-6fc6-8dd2-1c7f-4c3246f99842\",\"name\":\"Redeem loot token\",\"payload\":{\"address\":\"0x1cbf9ced4112efc554f9086b6048d3c244fc05d1\"}}", - "db066982-803a-3921-661f-28acf747810f": "{\"id\":\"db066982-803a-3921-661f-28acf747810f\",\"name\":\"Redeem loot token\",\"payload\":{\"address\":\"0x1cbf9ced4112efc554f9086b6048d3c244fc05d1\"}}" + "db066982-803a-3921-661f-28acf747810f": "{\"id\":\"db066982-803a-3921-661f-28acf747810f\",\"name\":\"Redeem loot token\",\"payload\":{\"address\":\"0x1cbf9ced4112efc554f9086b6048d3c244fc05d1\"}}", + "c02a2e7b-9043-a0b5-2005-d6d3c23d8eaf": "{\"id\":\"c02a2e7b-9043-a0b5-2005-d6d3c23d8eaf\",\"name\":\"Cron job\",\"payload\":{}}", + "d4276a17-ff06-8712-e6f7-cf8dce6473f3": "{\"id\":\"d4276a17-ff06-8712-e6f7-cf8dce6473f3\",\"name\":\"Cron job\",\"payload\":{}}", + "ec5dd6ea-3551-b077-7927-aecf240160d3": "{\"id\":\"ec5dd6ea-3551-b077-7927-aecf240160d3\",\"name\":\"Cron job\",\"payload\":{}}", + "5ec3f8e0-2978-e243-691d-622cfb6a361d": "{\"id\":\"5ec3f8e0-2978-e243-691d-622cfb6a361d\",\"name\":\"Cron job\",\"payload\":{}}", + "da950f8b-76ee-868f-91a9-b068efbdd633": "{\"id\":\"da950f8b-76ee-868f-91a9-b068efbdd633\",\"name\":\"User creation\",\"payload\":{\"address\":\"0xc7e4214148387adc9b3ec63e956df206292a4f8a\",\"nonce\":277682}}", + "0baef3cc-d828-ff0f-faa7-e03229141d30": "{\"id\":\"0baef3cc-d828-ff0f-faa7-e03229141d30\",\"name\":\"Membership proposal\",\"payload\":{\"address\":\"0xc7e4214148387adc9b3ec63e956df206292a4f8a\",\"nonce\":859686,\"title\":\"Member A\",\"description\":\"Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit​​, morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium.\",\"shares\":10,\"tribute\":0,\"assets\":[{\"asset\":\"ETH\",\"amount\":\"1\"}],\"name\":\"0xc7e4214148387adc9b3ec63e956df206292a4f8a\",\"proposals\":[{\"id\":\"0xc7e4214148387adc9b3ec63e956df206292a4f8a\",\"title\":\"Member A\",\"vote\":\"owner\",\"date\":\"2019-02-07T00:00:00.000Z\"}],\"period\":\"c2cea426-e753-fa82-1e39-2b7a7e79caa2\",\"status\":\"inprogress\"}}", + "f3f2e256-7290-fe07-2a71-0ef5896070a2": "{\"id\":\"f3f2e256-7290-fe07-2a71-0ef5896070a2\",\"name\":\"User creation\",\"payload\":{\"address\":\"0xcc18ceaeebaa398759edd1828ad7414d31df7c1c\",\"nonce\":267297}}", + "0eb6b351-218b-369c-4275-bac26c49dbed": "{\"id\":\"0eb6b351-218b-369c-4275-bac26c49dbed\",\"name\":\"Membership proposal\",\"payload\":{\"address\":\"0xcc18ceaeebaa398759edd1828ad7414d31df7c1c\",\"nonce\":530248,\"title\":\"User B\",\"description\":\"Bacon ipsum dolor amet short ribs brisket venison rump drumstick pig sausage prosciutto chicken spare ribs salami picanha doner. Kevin capicola sausage, buffalo bresaola venison turkey shoulder picanha ham pork tri-tip meatball meatloaf ribeye. Doner spare ribs andouille bacon sausage. Ground round jerky brisket pastrami shank.\\n\\nBacon ipsum dolor amet short ribs brisket venison rump drumstick pig sausage prosciutto chicken spare ribs salami picanha doner. Kevin capicola sausage, buffalo bresaola venison turkey shoulder picanha ham pork tri-tip meatball meatloaf ribeye. Doner spare ribs andouille bacon sausage. Ground round jerky brisket pastrami shank.\",\"shares\":20,\"tribute\":0,\"assets\":[{\"asset\":\"BTC\",\"amount\":\"1\"}],\"name\":\"0xcc18ceaeebaa398759edd1828ad7414d31df7c1c\",\"proposals\":[{\"id\":\"0xcc18ceaeebaa398759edd1828ad7414d31df7c1c\",\"title\":\"User B\",\"vote\":\"owner\",\"date\":\"2019-02-07T00:00:00.000Z\"}],\"period\":\"3ae0dfe2-b3cf-33b3-8431-f0476d492fff\",\"status\":\"pending\"}}", + "7eea00ec-94ec-c46f-eadb-112e5eeb9b77": "{\"id\":\"7eea00ec-94ec-c46f-eadb-112e5eeb9b77\",\"name\":\"User creation\",\"payload\":{\"address\":\"0x7993441ee70024f9ca815f1c2e5dc4dd4df4ead3\",\"nonce\":576051}}", + "c11ca597-ed2b-0425-10b5-e328979fd63a": "{\"id\":\"c11ca597-ed2b-0425-10b5-e328979fd63a\",\"name\":\"Membership proposal\",\"payload\":{\"address\":\"0x7993441ee70024f9ca815f1c2e5dc4dd4df4ead3\",\"nonce\":166656,\"title\":\"Member C\",\"description\":\"Cupcake ipsum dolor. Sit amet marshmallow topping cheesecake muffin. Halvah croissant candy canes bonbon candy. Apple pie jelly beans topping carrot cake danish tart cake cheesecake. Muffin danish chocolate soufflé pastry icing bonbon oat cake. Powder cake jujubes oat cake. Lemon drops tootsie roll marshmallow halvah carrot cake.\\n\\nCupcake ipsum dolor. Sit amet marshmallow topping cheesecake muffin. Halvah croissant candy canes bonbon candy. Apple pie jelly beans topping carrot cake danish tart cake cheesecake. Muffin danish chocolate soufflé pastry icing bonbon oat cake. Powder cake jujubes oat cake. Lemon drops tootsie roll marshmallow halvah carrot cake.\",\"shares\":30,\"tribute\":0,\"assets\":[{\"asset\":\"ETH\",\"amount\":\"3\"}],\"name\":\"0x7993441ee70024f9ca815f1c2e5dc4dd4df4ead3\",\"proposals\":[{\"id\":\"0x7993441ee70024f9ca815f1c2e5dc4dd4df4ead3\",\"title\":\"Member C\",\"vote\":\"owner\",\"date\":\"2019-02-07T00:00:00.000Z\"}],\"period\":\"2f04d468-2fb8-1cbd-cfa0-feea3e5221a1\",\"status\":\"pending\"}}", + "11056173-e398-cecd-c4f6-ac7718d0565d": "{\"id\":\"11056173-e398-cecd-c4f6-ac7718d0565d\",\"name\":\"User creation\",\"payload\":{\"address\":\"0xc7e4214148387adc9b3ec63e956df206292a4f8a\",\"nonce\":241928}}", + "5b06f1fd-6b14-d6a2-8311-121adaa3e88b": "{\"id\":\"5b06f1fd-6b14-d6a2-8311-121adaa3e88b\",\"name\":\"Membership proposal\",\"payload\":{\"address\":\"0xc7e4214148387adc9b3ec63e956df206292a4f8a\",\"nonce\":181296,\"title\":\"Member A\",\"description\":\"Zombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit​​, morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium.\\n\\nZombie ipsum reversus ab viral inferno, nam rick grimes malum cerebro. De carne lumbering animata corpora quaeritis. Summus brains sit​​, morbo vel maleficia? De apocalypsi gorger omero undead survivor dictum mauris. Hi mindless mortuis soulless creaturas, imo evil stalking monstra adventus resi dentevil vultus comedat cerebella viventium.\",\"shares\":10,\"tribute\":0,\"assets\":[{\"asset\":\"ETH\",\"amount\":\"1\"}],\"name\":\"0xc7e4214148387adc9b3ec63e956df206292a4f8a\",\"proposals\":[{\"id\":\"0xc7e4214148387adc9b3ec63e956df206292a4f8a\",\"title\":\"Member A\",\"vote\":\"owner\",\"date\":\"2019-02-07T00:00:00.000Z\"}],\"period\":\"ebde06ff-c828-6c4c-e5a8-87936043020c\",\"status\":\"inprogress\"}}", + "085e94e1-363d-a8d9-a484-8d0e8acd9c87": "{\"id\":\"085e94e1-363d-a8d9-a484-8d0e8acd9c87\",\"name\":\"User creation\",\"payload\":{\"address\":\"0xcc18ceaeebaa398759edd1828ad7414d31df7c1c\",\"nonce\":872871}}", + "8487a726-fd65-399b-5b51-2eae8447ad70": "{\"id\":\"8487a726-fd65-399b-5b51-2eae8447ad70\",\"name\":\"Membership proposal\",\"payload\":{\"address\":\"0xcc18ceaeebaa398759edd1828ad7414d31df7c1c\",\"nonce\":504254,\"title\":\"Member B\",\"description\":\"Bacon ipsum dolor amet short ribs brisket venison rump drumstick pig sausage prosciutto chicken spare ribs salami picanha doner. Kevin capicola sausage, buffalo bresaola venison turkey shoulder picanha ham pork tri-tip meatball meatloaf ribeye. Doner spare ribs andouille bacon sausage. Ground round jerky brisket pastrami shank.\\n\\nBacon ipsum dolor amet short ribs brisket venison rump drumstick pig sausage prosciutto chicken spare ribs salami picanha doner. Kevin capicola sausage, buffalo bresaola venison turkey shoulder picanha ham pork tri-tip meatball meatloaf ribeye. Doner spare ribs andouille bacon sausage. Ground round jerky brisket pastrami shank.\",\"shares\":20,\"tribute\":0,\"assets\":[{\"asset\":\"BTC\",\"amount\":\"1\"}],\"name\":\"0xcc18ceaeebaa398759edd1828ad7414d31df7c1c\",\"proposals\":[{\"id\":\"0xcc18ceaeebaa398759edd1828ad7414d31df7c1c\",\"title\":\"Member B\",\"vote\":\"owner\",\"date\":\"2019-02-07T00:00:00.000Z\"}],\"period\":\"db65e95c-6492-9964-8d40-971d0ed127cc\",\"status\":\"pending\"}}", + "0d9fc916-f814-d5cd-9fc1-b1df92aa886c": "{\"id\":\"0d9fc916-f814-d5cd-9fc1-b1df92aa886c\",\"name\":\"User creation\",\"payload\":{\"address\":\"0x7993441ee70024f9ca815f1c2e5dc4dd4df4ead3\",\"nonce\":842368}}", + "ab518e99-5290-144f-9d88-7f6b2d484aa5": "{\"id\":\"ab518e99-5290-144f-9d88-7f6b2d484aa5\",\"name\":\"Membership proposal\",\"payload\":{\"address\":\"0x7993441ee70024f9ca815f1c2e5dc4dd4df4ead3\",\"nonce\":885020,\"title\":\"Member C\",\"description\":\"Cupcake ipsum dolor. Sit amet marshmallow topping cheesecake muffin. Halvah croissant candy canes bonbon candy. Apple pie jelly beans topping carrot cake danish tart cake cheesecake. Muffin danish chocolate soufflé pastry icing bonbon oat cake. Powder cake jujubes oat cake. Lemon drops tootsie roll marshmallow halvah carrot cake.\\n\\nCupcake ipsum dolor. Sit amet marshmallow topping cheesecake muffin. Halvah croissant candy canes bonbon candy. Apple pie jelly beans topping carrot cake danish tart cake cheesecake. Muffin danish chocolate soufflé pastry icing bonbon oat cake. Powder cake jujubes oat cake. Lemon drops tootsie roll marshmallow halvah carrot cake.\",\"shares\":30,\"tribute\":0,\"assets\":[{\"asset\":\"ETH\",\"amount\":\"3\"}],\"name\":\"0x7993441ee70024f9ca815f1c2e5dc4dd4df4ead3\",\"proposals\":[{\"id\":\"0x7993441ee70024f9ca815f1c2e5dc4dd4df4ead3\",\"title\":\"Member C\",\"vote\":\"owner\",\"date\":\"2019-02-07T00:00:00.000Z\"}],\"period\":\"7a1fe77f-c299-df8c-2945-bfe4fc37de6a\",\"status\":\"pending\"}}", + "66e2215d-1a02-8991-2fef-df436e0e2b2a": "{\"id\":\"66e2215d-1a02-8991-2fef-df436e0e2b2a\",\"name\":\"Project proposal\",\"payload\":{\"id\":\"9f33d7de-5b8b-bb34-3015-b9d3b513c11c\",\"title\":\"Project A\",\"tribute\":0,\"description\":\"Just say anything, George, say what ever's natural, the first thing that comes to your mind. Take that you mutated son-of-a-bitch. My pine, why you. You space bastard, you killed a pine. You do? Yeah, it's 8:00. Hey, McFly, I thought I told you never to come in here. Well it's gonna cost you. How much money you got on you?\\n\\nJust say anything, George, say what ever's natural, the first thing that comes to your mind. Take that you mutated son-of-a-bitch. My pine, why you. You space bastard, you killed a pine. You do? Yeah, it's 8:00. Hey, McFly, I thought I told you never to come in here. Well it's gonna cost you. How much money you got on you?\",\"assets\":[{\"asset\":\"ETH\",\"amount\":\"1\"}],\"period\":\"cc3e1514-10dc-8451-9667-1f647f228eaf\",\"status\":\"pending\"}}", + "1636aac0-4237-14c7-7fbf-0923ad6bfe68": "{\"id\":\"1636aac0-4237-14c7-7fbf-0923ad6bfe68\",\"name\":\"Cron job\",\"payload\":{}}", + "056ed733-44e5-8d6f-21c7-297a26997be5": "{\"id\":\"056ed733-44e5-8d6f-21c7-297a26997be5\",\"name\":\"Cron job\",\"payload\":{}}" }, "Config": { "26df14c2-ad25-715c-c389-789bf3d0472d": "{\"id\":\"26df14c2-ad25-715c-c389-789bf3d0472d\",\"start\":\"2019-01-01T00:00:00.000Z\",\"periodLength\":7,\"gracePeriod\":2,\"founders\":[\"0xaa22d833fc31f74c13613aec5ed3c2955c968a97\"]}" @@ -60,7 +84,11 @@ "Period": { "34b941f2-e8ec-b09e-4ea8-f48dcc00f833": "{\"id\":\"34b941f2-e8ec-b09e-4ea8-f48dcc00f833\",\"start\":\"2019-02-04T00:00:00.000Z\",\"end\":\"2019-02-11T00:00:00.000Z\",\"gracePeriod\":\"2019-02-13T00:00:00.000Z\",\"proposals\":[{\"id\":\"0x091fecd2b293f1ebddd2e72b83de5386c020ca52\",\"type\":\"member\"}]}", "057449c4-3e3f-0415-15c0-88e9ec01ae51": "{\"id\":\"057449c4-3e3f-0415-15c0-88e9ec01ae51\",\"start\":\"2019-02-05T00:00:00.000Z\",\"end\":\"2019-02-12T00:00:00.000Z\",\"gracePeriod\":\"2019-02-14T00:00:00.000Z\",\"proposals\":[{\"id\":\"0x1cbf9ced4112efc554f9086b6048d3c244fc05d1\",\"type\":\"member\"}]}", - "54d46ddb-251a-080d-21dd-fd9fcadc38a3": "{\"id\":\"54d46ddb-251a-080d-21dd-fd9fcadc38a3\",\"start\":\"2019-02-05T00:00:00.000Z\",\"end\":\"2019-02-12T00:00:00.000Z\",\"gracePeriod\":\"2019-02-14T00:00:00.000Z\",\"proposals\":[{\"id\":\"0xc2e5e4d434587c5915bad0395871b7ce9d58bbf4\",\"type\":\"member\"}]}" + "54d46ddb-251a-080d-21dd-fd9fcadc38a3": "{\"id\":\"54d46ddb-251a-080d-21dd-fd9fcadc38a3\",\"start\":\"2019-02-05T00:00:00.000Z\",\"end\":\"2019-02-12T00:00:00.000Z\",\"gracePeriod\":\"2019-02-14T00:00:00.000Z\",\"proposals\":[{\"id\":\"0xc2e5e4d434587c5915bad0395871b7ce9d58bbf4\",\"type\":\"member\"}]}", + "ebde06ff-c828-6c4c-e5a8-87936043020c": "{\"id\":\"ebde06ff-c828-6c4c-e5a8-87936043020c\",\"start\":\"2019-02-07T00:00:00.000Z\",\"end\":\"2019-02-14T00:00:00.000Z\",\"gracePeriod\":\"2019-02-16T00:00:00.000Z\",\"proposals\":[{\"id\":\"0xc7e4214148387adc9b3ec63e956df206292a4f8a\",\"type\":\"member\"}]}", + "db65e95c-6492-9964-8d40-971d0ed127cc": "{\"id\":\"db65e95c-6492-9964-8d40-971d0ed127cc\",\"start\":\"2019-02-08T00:00:00.000Z\",\"end\":\"2019-02-15T00:00:00.000Z\",\"gracePeriod\":\"2019-02-17T00:00:00.000Z\",\"proposals\":[{\"id\":\"0xcc18ceaeebaa398759edd1828ad7414d31df7c1c\",\"type\":\"member\"}]}", + "7a1fe77f-c299-df8c-2945-bfe4fc37de6a": "{\"id\":\"7a1fe77f-c299-df8c-2945-bfe4fc37de6a\",\"start\":\"2019-02-09T00:00:00.000Z\",\"end\":\"2019-02-16T00:00:00.000Z\",\"gracePeriod\":\"2019-02-18T00:00:00.000Z\",\"proposals\":[{\"id\":\"0x7993441ee70024f9ca815f1c2e5dc4dd4df4ead3\",\"type\":\"member\"}]}", + "cc3e1514-10dc-8451-9667-1f647f228eaf": "{\"id\":\"cc3e1514-10dc-8451-9667-1f647f228eaf\",\"start\":\"2019-02-10T00:00:00.000Z\",\"end\":\"2019-02-17T00:00:00.000Z\",\"gracePeriod\":\"2019-02-19T00:00:00.000Z\",\"proposals\":[{\"id\":\"9f33d7de-5b8b-bb34-3015-b9d3b513c11c\",\"type\":\"project\"}]}" } } } \ No newline at end of file diff --git a/packages/moloch-backend/src/controllers/event.controller.ts b/packages/moloch-backend/src/controllers/event.controller.ts index 159a5c1a..90b3e469 100644 --- a/packages/moloch-backend/src/controllers/event.controller.ts +++ b/packages/moloch-backend/src/controllers/event.controller.ts @@ -136,15 +136,19 @@ export class EventController { case 'Membership proposal': let memberPatch = event.payload as Member; memberPatch.name = memberPatch.address; - memberPatch.status = 'pending'; + // Current date at midnight + let currentDate = new Date(); + currentDate.setHours(1, 0, 0, 0); + // Add the new proposal to the list of proposals of the member that submitted it + if (!memberPatch.proposals) { + memberPatch.proposals = []; + } + memberPatch.proposals.push({id: memberPatch.address, title: memberPatch.title ? memberPatch.title : '', vote: 'owner', date: currentDate}); // Recover the config data to define a new period return await this.configRepository.find().then(async config => { // Config data let periodLength = config[0].periodLength; let gracePeriodLength = config[0].gracePeriod; - // Current date at midnight - let currentDate = new Date(); - currentDate.setHours(1, 0, 0, 0); // Check if there is a period for the current date return await this.periodRepository.find({ where: { start: { eq: currentDate } } }).then(async period => { let periodCreate: Period = new Period; @@ -154,13 +158,19 @@ export class EventController { if (period && period.length) { return await this.periodRepository.find().then(async periods => { // There can't be another period for the same date, so check what is the closest date available - let lastPeriodDate = periods[periods.length - 1].start; + let lastPeriodDate = currentDate; + periods.forEach(potentialLastPeriod => { + if (potentialLastPeriod.start.getTime() > lastPeriodDate.getTime()) { + lastPeriodDate = potentialLastPeriod.start; + } + }); periodCreate.start = new Date(lastPeriodDate.getTime() + (1000 * 60 * 60 * 24)); periodCreate.end = new Date(periodCreate.start.getTime() + (1000 * 60 * 60 * 24 * periodLength)); periodCreate.gracePeriod = new Date(periodCreate.end.getTime() + (1000 * 60 * 60 * 24 * gracePeriodLength)); // And create a period for it return await this.periodRepository.create(periodCreate).then(async newPeriod => { memberPatch.period = newPeriod.id; // Assign it to the member + memberPatch.status = 'pending'; // And update the member return await this.memberRepository.updateById(memberPatch.address, memberPatch).then(async result => { return await this.eventRepository.create(event); @@ -174,6 +184,7 @@ export class EventController { // Create the period return await this.periodRepository.create(periodCreate).then(async newPeriod => { memberPatch.period = newPeriod.id; // Assign it to the member + memberPatch.status = 'inprogress'; // And create the member return await this.memberRepository.updateById(memberPatch.address, memberPatch).then(async result => { return await this.eventRepository.create(event); @@ -184,9 +195,10 @@ export class EventController { }); case 'Project proposal': // Project data - let projectCreate = event.payload as Project; + let receivedData = event.payload as any; + let projectCreate = receivedData.project as Project; + let ownerAddress = receivedData.owner as string; projectCreate.id = (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4()); - projectCreate.status = 'pending'; // Recover the config data to define a new period return await this.configRepository.find().then(async config => { // Config data @@ -205,15 +217,31 @@ export class EventController { return await this.periodRepository.find().then(async periods => { // There can't be another period for the same date, so check what is the closest date available let lastPeriodDate = periods[periods.length - 1].start; + periods.forEach(potentialLastPeriod => { + if (potentialLastPeriod.start.getTime() > lastPeriodDate.getTime()) { + lastPeriodDate = potentialLastPeriod.start; + } + }); periodCreate.start = new Date(lastPeriodDate.getTime() + (1000 * 60 * 60 * 24)); periodCreate.end = new Date(periodCreate.start.getTime() + (1000 * 60 * 60 * 24 * periodLength)); periodCreate.gracePeriod = new Date(periodCreate.end.getTime() + (1000 * 60 * 60 * 24 * gracePeriodLength)); // And create a period for it return await this.periodRepository.create(periodCreate).then(async newPeriod => { projectCreate.period = newPeriod.id; // Assign it to the project + projectCreate.status = 'pending'; // And create the project - return await this.projectRepository.create(projectCreate).then(async result => { - return await this.eventRepository.create(event); + return await this.projectRepository.create(projectCreate).then(async project => { + // Get the member that submitted the project + return await this.memberRepository.findById(ownerAddress).then(async matchingMember => { + // And add the new proposal that they have submitted to their list of proposals + if (!matchingMember.proposals) { + matchingMember.proposals = []; + } + matchingMember.proposals.push({id: projectCreate.id, title: projectCreate.title, vote: 'owner', date: currentDate}); + return await this.memberRepository.updateById(matchingMember.address, matchingMember).then(async result => { + return await this.eventRepository.create(event); + }); + }); }); }); }); @@ -226,7 +254,17 @@ export class EventController { projectCreate.period = newPeriod.id; // Assign it to the project // And create the project return await this.projectRepository.create(projectCreate).then(async result => { - return await this.eventRepository.create(event); + // Get the member that submitted the project + return await this.memberRepository.findById(ownerAddress).then(async matchingMember => { + // And add the new proposal that they have submitted to their list of proposals + if (!matchingMember.proposals) { + matchingMember.proposals = []; + } + matchingMember.proposals.push({id: projectCreate.id, title: projectCreate.title, vote: 'owner', date: currentDate}); + return await this.memberRepository.updateById(matchingMember.address, matchingMember).then(async result => { + return await this.eventRepository.create(event); + }); + }); }); }); } diff --git a/packages/moloch-backend/src/controllers/member.controller.ts b/packages/moloch-backend/src/controllers/member.controller.ts index afe812d0..ce264216 100644 --- a/packages/moloch-backend/src/controllers/member.controller.ts +++ b/packages/moloch-backend/src/controllers/member.controller.ts @@ -47,15 +47,27 @@ export class MemberController { }, }) async findById(@param.path.string('id') id: string): Promise { + // Get all the users to calculate the total shares of the system return await this.memberRepository.find().then(async members => { let totalShares = 0; - members.forEach(member => { totalShares = totalShares + (member.shares ? member.shares : 0) }); - return await this.memberRepository.findById(id).then(async matchingMember => { - let result = { - member: matchingMember, - totalShares: totalShares + // Only add the shares of the members + members.forEach(member => { + if (member.status === 'active' || member.status === 'founder') { + totalShares = totalShares + (member.shares ? member.shares : 0) } - return result; + }); + // Get the user that has been requested + return await this.memberRepository.findById(id).then(async matchingMember => { + // Modify the nonce of the user + matchingMember.nonce = Math.floor(Math.random() * 1000000); + return await this.memberRepository.updateById(matchingMember.address, matchingMember).then(async modifiedMember => { + // Return the user with the new nonce + let result = { + member: matchingMember, + totalShares: totalShares + } + return result; + }); }); }); }