4354Y4PECM6BOEYIKW2L6WP6ULDIQK2KMNLORWPVKHKQTHUI6CRQC
M4PWY5RUV72AEDCNC4O7UKBPHBIACR4354YTSC3SUZGWFV5UBJBQC
IZEVQF627FA7VV25KJAWYWGGC35LZUUBBQRPN5ZAINTQLPEDRTEAC
UWMGUJOW5X5HQTS76T2FD7MNAJF7SESPQVU5FDIZO52V75TT2X6AC
64C6AWH66FDKU6UE6Z6JPX2J2GBM2JOPTH2GL6LHKAIUBGNGDZ5AC
5OI44E4EEVYOMHDWNK2WA7K4L4JWRWCUJUNN2UAUGE5VY4W7GTNAC
X3ES7NUA42D2BF7CQDDKXM5CLMVCYA3H5YU5KXLPTGDBFPE2LNVAC
PBD7LZYQHXAA3KLH2ZUX5GW4UFML6BQ32KXZF4KZ6OYFASUYFJ5QC
EFSXYZPOGA5M4DN65IEIDO7JK6U34DMQELAPHOIL2UAT6HRC66BAC
HALRDT2F22DAQ54M334YSKD2XJCAXDXEZPDKGMOWKH7XELBAS6MAC
2XQD6KKKD6QVHFHAEMVE3XXY7X2T7BLTLL7XIILZAXNJJH2YONUQC
B6HWAPDPXIWH7CHK5VLMWLL6EQN6NOFZEFYO47BPUY2ZO4SL7VDAC
ADMKQQGCGVSHHIMVQ4XFRDCG544SBJCYALSKZV45CQQBZ4ACUH2AC
contributorParser :: RowParser (UserId, UserName, C.UTCTime)
contributorParser =
(,,) <$> idParser UserId <*> (UserName <$> field) <*> utcParser
listProjectContributors :: ProjectId -> DBM [(UserId, UserName, C.UTCTime)]
listProjectContributors pid =
pquery
contributorParser
[sql|
SELECT DISTINCT u.id, u.handle, p.joined_at
FROM users u
JOIN project_companions p ON u.id = p.user_id
WHERE p.project_id = ?
ORDER BY p.joined_at
|]
(Only $ pid ^. _ProjectId)
#!/bin/bash
if [ -f ".env" ]; then
source .env
fi
if [ -z "${AFTOK_HOST}" ]; then
AFTOK_HOST="aftok.com"
fi
if [ -z "${USER}" ]; then
read -p "Username: " USER
echo
fi
if [ -z "${PID}" ]; then
read -p "Project UUID: " PID
echo
fi
curl --verbose \
${ALLOW_INSECURE} \
--user $USER \
"https://$AFTOK_HOST/api/projects/$PID/contributors"
contributorJSON :: (UserId, UserName, C.UTCTime) -> Value
contributorJSON (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 = do
uid <- requireUserId
pid <- requireProjectId
snapEval $ listProjectContributors pid uid