Add endpoint to list project contributors.
[?]
Jan 2, 2021, 2:15 AM
4354Y4PECM6BOEYIKW2L6WP6ULDIQK2KMNLORWPVKHKQTHUI6CRQCDependencies
- [2]
M4PWY5RUPreliminary work to add support for Zcash payments. - [3]
HALRDT2FAdded initial auction create route. - [4]
PBD7LZYQPostgres & auth are beginning to function. - [5]
2XQD6KKKAdd invitation logic and clean up DBProg error handling. - [6]
B6HWAPDPModularize & update to recent haskoin. - [7]
EFSXYZPOAutoformat everything with brittany. - [8]
QMRKFEPGRefactor QDB to use a free monad algebra instead. - [9]
X3ES7NUAFine. I'll use ormolu. At least it doesn't break the code. - [*]
IZEVQF62Work in progress replacing sqlite with postgres. - [*]
64C6AWH6Rename Ananke -> Quixotic, project reboot. - [*]
UWMGUJOWAutoformat sources. - [*]
5OI44E4EAdd authentication to auction search. - [*]
ADMKQQGCInitial empty Snap project.
Change contents
- edit in lib/Aftok/Database/PostgreSQL/Projects.hs at line 12
listProjectContributors, - edit in lib/Aftok/Database/PostgreSQL/Projects.hs at line 45
UserName (..), - edit in lib/Aftok/Database/PostgreSQL/Projects.hs at line 151[2.51775]
contributorParser :: RowParser (UserId, UserName, C.UTCTime)contributorParser =(,,) <$> idParser UserId <*> (UserName <$> field) <*> utcParserlistProjectContributors :: ProjectId -> DBM [(UserId, UserName, C.UTCTime)]listProjectContributors pid =pquerycontributorParser[sql|SELECT DISTINCT u.id, u.handle, p.joined_atFROM users uJOIN project_companions p ON u.id = p.user_idWHERE p.project_id = ?ORDER BY p.joined_at|](Only $ pid ^. _ProjectId) - edit in lib/Aftok/Database/PostgreSQL.hs at line 62
(ListProjectContributors pid) -> Q.listProjectContributors pid - edit in lib/Aftok/Database.hs at line 72
ListProjectContributors :: ProjectId -> DBOp [(UserId, UserName, C.UTCTime)] - edit in lib/Aftok/Database.hs at line 195
listProjectContributors :: MonadDB m => ProjectId -> UserId -> m [(UserId, UserName, C.UTCTime)]listProjectContributors pid uid =withProjectAuth pid uid (ListProjectContributors pid) - file addition: list_project_contributors.sh[3.1220]
#!/bin/bashif [ -f ".env" ]; thensource .envfiif [ -z "${AFTOK_HOST}" ]; thenAFTOK_HOST="aftok.com"fiif [ -z "${USER}" ]; thenread -p "Username: " USERechofiif [ -z "${PID}" ]; thenread -p "Project UUID: " PIDechoficurl --verbose \${ALLOW_INSECURE} \--user $USER \"https://$AFTOK_HOST/api/projects/$PID/contributors" - edit in server/Aftok/Snaplet/Projects.hs at line 9
listContributorsHandler,contributorJSON, - edit in server/Aftok/Snaplet/Projects.hs at line 16
import Aftok.Json (idValue) - replacement in server/Aftok/Snaplet/Projects.hs at line 24
import Control.Lensimport Control.Lens ((^.)) - replacement in server/Aftok/Snaplet/Projects.hs at line 26
import Data.Aeson as Aimport qualified Data.Aeson as Aimport Data.Aeson ((.:), (.=), Value (..), object) - replacement in server/Aftok/Snaplet/Projects.hs at line 29
import Data.Thyme.Clock as Cimport qualified Data.Thyme.Clock as C - replacement in server/Aftok/Snaplet/Projects.hs at line 33
import Network.Mail.SMTP as SMTPimport qualified Network.Mail.SMTP as SMTP - replacement in server/Aftok/Snaplet/Projects.hs at line 40
instance FromJSON ProjectCreateRequest whereinstance A.FromJSON ProjectCreateRequest where - edit in server/Aftok/Snaplet/Projects.hs at line 65
contributorJSON :: (UserId, UserName, C.UTCTime) -> ValuecontributorJSON (uid, uname, t) =object[ "user_id" .= idValue _UserId uid,"username" .= (uname ^. _UserName),"joined_at" .= t]listContributorsHandler :: S.Handler App App [(UserId, UserName, C.UTCTime)]listContributorsHandler = douid <- requireUserIdpid <- requireProjectIdsnapEval $ listProjectContributors pid uid - replacement in server/Aftok/Snaplet/Projects.hs at line 110
(sendMailWithLogin _smtpHost)(sendMailWithLogin' _smtpHost)(SMTP.sendMailWithLogin _smtpHost)(SMTP.sendMailWithLogin' _smtpHost) - edit in server/Main.hs at line 79
listContributorsRoute =serveJSON (fmap contributorJSON) $ method GET listContributorsHandler - edit in server/Main.hs at line 137
("projects/:projectId/contributors", listContributorsRoute), -- list_project_contributors.sh