-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Durable users - WIP / for discussion #78
Draft
devth
wants to merge
8
commits into
master
Choose a base branch
from
durable-users
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
bb50420
Add in initial users db
devth 1afd3c5
Add chat-source-adapter to user table
devth be099cf
Avoid taking existing column name `id` and use hyphen instead of unde…
devth 5bbebe3
Stub out some ideas for resolving users
devth 3488e4f
Fix let
devth 24e00b9
Add hint on where to call resolve users from Slack
devth 94186a3
Fix spelling
devth 72cea7f
Edit TODO
devth File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,7 +22,8 @@ | |
;; evaluation of piped expressions (i.e. %s instead of $s) | ||
expr (binding [*subst-prefix* method-like-replacement-prefix] | ||
(str command/config-prefix (pseudo-format-n cmd args))) | ||
results (record-and-run-raw expr user yetibot-user | ||
resolved-users nil ;; TODO | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure aliases would ever mention users. Either way, we can defer this to a later PR if we want. |
||
results (record-and-run-raw expr user resolved-users yetibot-user | ||
;; avoid double recording the yetibot | ||
;; response since the parent command | ||
;; execution that evaluated the alias | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -103,8 +103,9 @@ | |
;; username and channel name with no explicit | ||
;; piping behavior | ||
rendered-cmd)) | ||
resolved-users nil ;; TODO | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can defer. |
||
[{:keys [error? timeout? result] :as expr-result}] | ||
(record-and-run-raw expr user yetibot-user)] | ||
(record-and-run-raw expr user resolved-users yetibot-user)] | ||
(if (and result (not error?) (not timeout?)) | ||
(chat-data-structure result) | ||
(info "Skipping observer because it errored or timed out" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
(ns yetibot.core.db.user | ||
(:require | ||
[yetibot.core.db.util :as db.util])) | ||
|
||
(def schema {:schema/table "user" | ||
:schema/specs | ||
(into [[:chat-source-adapter :text] | ||
[:user-id :text "NOT NULL"] | ||
[:username :text "NOT NULL"] | ||
[:display-name :text "NOT NULL"] | ||
;; should we attempt to keep track of which channels the | ||
;; user is in? 🤔 | ||
;; if we wanted to store it as a column here it's have to be | ||
;; some serialized form of a Clojure collection | ||
] | ||
(db.util/default-fields))}) | ||
|
||
(def create (partial db.util/create (:schema/table schema))) | ||
|
||
(def query (partial db.util/query (:schema/table schema))) | ||
|
||
(def delete (partial db.util/delete (:schema/table schema))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a potential starting place.
a/resolve-users
function(a/resolve-users adapter event)
a/resolve-users
log theevent
and start looking at how we can pull users out of it and turn them into canonical persistent records