Resolve channels #150

Merged
bones7242 merged 23 commits from resolve-channels into master 2017-08-25 18:35:40 +02:00
bones7242 commented 2017-08-25 18:35:30 +02:00 (Migrated from github.com)

added support for channel resolutions

  • resolves to a list of the channels assets:
    • spee.ch/@channel
    • spee.ch/@channel:shortid
    • spee.ch/@channel:longclaimid
  • resolves to a specific asset (show)
    • spee.ch/@channel/name
    • spee.ch/@channel:shortid/name
    • spee.ch/@channel:longclaimid/name
  • serves an asset
    • spee.ch/@channel/name.ext
    • spee.ch/@channel:shortid/name.ext
    • spee.ch/@channel:longclaimid/name.ext

reorganized router functions

still to do: (will be a separate pr): add channel information to the asset's info page

added support for channel resolutions - resolves to a list of the channels assets: - spee.ch/@channel - spee.ch/@channel:shortid - spee.ch/@channel:longclaimid - resolves to a specific asset (show) - spee.ch/@channel/name - spee.ch/@channel:shortid/name - spee.ch/@channel:longclaimid/name - serves an asset - spee.ch/@channel/name.ext - spee.ch/@channel:shortid/name.ext - spee.ch/@channel:longclaimid/name.ext reorganized router functions still to do: (will be a separate pr): add channel information to the asset's info page
kauffj (Migrated from github.com) reviewed 2017-08-25 19:35:21 +02:00
kauffj (Migrated from github.com) left a comment

Some clean-up would be good here.

Some clean-up would be good here.
@ -3,2 +3,3 @@
const logger = require('winston');
const { getTopFreeClaim, getFullClaimIdFromShortId, resolveAgainstClaimTable } = require('../helpers/serveHelpers.js');
const { resolveAgainstClaimTable, serveFile, showFile, showFileLite, getShortClaimIdFromLongClaimId, getClaimIdByLongChannelId, getAllChannelClaims, getLongChannelId, getShortChannelIdFromLongChannelId, getLongClaimId } = require('../helpers/serveHelpers.js');
const { postToStats, sendGoogleAnalytics } = require('../controllers/statsController.js');
kauffj (Migrated from github.com) commented 2017-08-25 19:21:21 +02:00

This looks like it could use better organization. I'd be inclined to put a lot of these inside of the modal folder, but I'd suggest looking at what other conventions are used in this framework before doing that.

This looks like it could use better organization. I'd be inclined to put a lot of these inside of the `modal` folder, but I'd suggest looking at what other conventions are used in this framework before doing that.
kauffj (Migrated from github.com) commented 2017-08-25 19:23:53 +02:00

This is shared across all 3 cases and could be pulled above/out.

This is shared across all 3 cases and could be pulled above/out.
@ -159,0 +160,4 @@
logger.debug('retrieving most recent claims');
return new Promise((resolve, reject) => {
// get the raw requests data
db.sequelize.query(`SELECT * FROM File WHERE nsfw != 1 AND trendingEligible = 1 ORDER BY createdAt DESC LIMIT 25;`, { type: db.sequelize.QueryTypes.SELECT })
kauffj (Migrated from github.com) commented 2017-08-25 19:27:57 +02:00

Try to avoid SQL in your controllers and keep it located in the modal layer. This helps facilitates future modal refactoring/redesign and keeps controllers simpler (controllers are typically then thinnest of the 3 MVC layers).

Try to avoid SQL in your controllers and keep it located in the modal layer. This helps facilitates future modal refactoring/redesign and keeps controllers simpler (controllers are typically then thinnest of the 3 MVC layers).
@ -0,0 +1,8 @@
module.exports = {
kauffj (Migrated from github.com) commented 2017-08-25 19:33:20 +02:00

I'd be more inclined to keep these where they were, or to put them on the object/class they relate to, then to create a single constants file like this.

I'd be more inclined to keep these where they were, or to put them on the object/class they relate to, then to create a single constants file like this.
@ -21,6 +21,19 @@ module.exports = (app) => {
errorHandlers.handleRequestError(error, res);
kauffj (Migrated from github.com) commented 2017-08-25 19:34:59 +02:00

The old URL ought to be 301 redirect to the new one.

The old URL ought to be 301 redirect to the new one.
kauffj (Migrated from github.com) commented 2017-08-25 19:17:52 +02:00

Conventionally, the extension would not include the period (e.g. "gifv" not ".gifv").

Conventionally, the extension would not include the period (e.g. "gifv" not ".gifv").
bones7242 (Migrated from github.com) reviewed 2017-09-07 18:47:45 +02:00
bones7242 (Migrated from github.com) commented 2017-09-07 18:47:44 +02:00

updated in new branch 69741dfc1d

updated in new branch https://github.com/lbryio/spee.ch/commit/69741dfc1d1748cd6ed97bfaffd579a57fa54287
bones7242 (Migrated from github.com) reviewed 2017-09-07 20:52:15 +02:00
bones7242 (Migrated from github.com) commented 2017-09-07 20:52:15 +02:00
https://github.com/lbryio/spee.ch/commit/c901ced94c1d5e2212bc3e6bda25939a6269f028
bones7242 (Migrated from github.com) reviewed 2017-09-07 21:37:16 +02:00
@ -159,0 +160,4 @@
logger.debug('retrieving most recent claims');
return new Promise((resolve, reject) => {
// get the raw requests data
db.sequelize.query(`SELECT * FROM File WHERE nsfw != 1 AND trendingEligible = 1 ORDER BY createdAt DESC LIMIT 25;`, { type: db.sequelize.QueryTypes.SELECT })
bones7242 (Migrated from github.com) commented 2017-09-07 21:37:15 +02:00

moved to model 4d94acee77

moved to model https://github.com/lbryio/spee.ch/commit/4d94acee77cd90341f23ab5d39d2ba90bc7edf2c
bones7242 (Migrated from github.com) reviewed 2017-09-07 21:41:26 +02:00
@ -21,6 +21,19 @@ module.exports = (app) => {
errorHandlers.handleRequestError(error, res);
bones7242 (Migrated from github.com) commented 2017-09-07 21:41:26 +02:00

added redirect 7a81d53c35

added redirect https://github.com/lbryio/spee.ch/commit/7a81d53c3570d07e8666aee2fbfd7209e7646827
bones7242 (Migrated from github.com) reviewed 2017-09-08 00:33:43 +02:00
@ -0,0 +1,8 @@
module.exports = {
bones7242 (Migrated from github.com) commented 2017-09-08 00:33:42 +02:00

moved to their individual modules f0435be0b2

moved to their individual modules https://github.com/lbryio/spee.ch/commit/f0435be0b27d25333fbc74939f204b3bd94a444f
bones7242 (Migrated from github.com) reviewed 2017-09-08 02:27:10 +02:00
@ -3,2 +3,3 @@
const logger = require('winston');
const { getTopFreeClaim, getFullClaimIdFromShortId, resolveAgainstClaimTable } = require('../helpers/serveHelpers.js');
const { resolveAgainstClaimTable, serveFile, showFile, showFileLite, getShortClaimIdFromLongClaimId, getClaimIdByLongChannelId, getAllChannelClaims, getLongChannelId, getShortChannelIdFromLongChannelId, getLongClaimId } = require('../helpers/serveHelpers.js');
const { postToStats, sendGoogleAnalytics } = require('../controllers/statsController.js');
bones7242 (Migrated from github.com) commented 2017-09-08 02:27:09 +02:00

I get a little confused sometimes on the line between controller and model responsibilities. But, yes, after looking at it and re-reading some MVC notes, I think that all the database related functions should go in the model. I rearranged as such.
af046e9d36

I get a little confused sometimes on the line between controller and model responsibilities. But, yes, after looking at it and re-reading some MVC notes, I think that all the database related functions should go in the model. I rearranged as such. https://github.com/lbryio/spee.ch/commit/af046e9d3655a57bf9cd67d3a67a54d4d44ed802
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: LBRYCommunity/spee.ch#150
No description provided.