HashtagSell / posting-api

API for storage and retrieval of posting details for Hashtagsell
0 stars 0 forks source link

Include sellers username in the offer and question objects. #12

Closed that1guy closed 9 years ago

that1guy commented 9 years ago
GET ---> /v1/postings/{postingId}/offers/{offerId}

Who is the owner of this postingId? I know "this1guy" sent the offer but I don't know which owner/seller to notify. Today I'm having to lookup the postingId to get the owner.

{
  "offerId" : "c35b389b79a545f0a79944c6d6124562",
  "postingId" : "d15a289f78a545f0a79944c6d6126961",
  "proposedTimes" : [{
    "acceptedAt" : "2015-01-31T14:37:00Z",
    "when" : "2015-02-01T10:00:00Z",
    "where" : "San Francisco Library"
  }, {
    "when" : "2015-02-02T10:00:00Z",
    "where" : "San Francisco Library"
  }, {
    "when" : "2015-02-03T10:00:00Z",
    "where" : "San Francisco Library"
  }],
  "username" : "this1guy",
  "createdAt" : "2015-02-01T03:33:18Z",
  "modifiedAt" : "2015-02-01T03:33:18Z"
}
that1guy commented 9 years ago

Is there a better way to find the postingId owner's username? Would be great if the entire post (or at least the owner's username) were also included in this emitted object.

https://github.com/HashtagSell/posting-api/blob/develop/lib/models/questions.js#L136

                        services.realtime.emit(
                            SOCKET_CHANNEL,
                            SOCKET_EVENT_QUESTION,
                            {
                                postingId : newQuestion.postingId,
                                                                postingOwner: post.username
                                question : newQuestion,
                                username : newQuestion.username,
                                timestamp : new Date()
                            });
that1guy commented 9 years ago

Think this request should have been opened under realtime-svc repository. https://github.com/HashtagSell/realtime-svc/issues/1