|
50 | 50 |
|
51 | 51 | (defn insert-profile [profile] |
52 | 52 | (m/assert Profile profile) |
53 | | - (let [{:keys [id file_path profile_type sample_count owner upload_ts |
| 53 | + (let [{:keys [id file_path profile_type kind sample_count owner upload_ts |
54 | 54 | edit_token config is_public]} profile] |
55 | 55 | (log/infof "Inserting profile %s from %s" id owner) |
56 | 56 | (with-locking (:lock @db) |
|
59 | 59 | {:id id |
60 | 60 | :file_path file_path |
61 | 61 | :profile_type (name profile_type) |
| 62 | + :kind (name kind) |
62 | 63 | :upload_ts (str upload_ts) |
63 | 64 | :sample_count sample_count |
64 | 65 | :is_public is_public |
|
74 | 75 |
|
75 | 76 | (defn list-profiles [] |
76 | 77 | (with-locking (:lock @db) |
77 | | - (->> (jdbc/execute! @db ["SELECT id, file_path, profile_type, sample_count, owner, config, upload_ts, is_public FROM profile"]) |
| 78 | + (->> (jdbc/execute! @db ["SELECT id, file_path, profile_type, kind, sample_count, owner, config, upload_ts, is_public FROM profile"]) |
78 | 79 | (mapv #(-> (unqualify-keys %) |
79 | 80 | (assoc :edit_token nil) |
80 | 81 | (coerce Profile)))))) |
81 | 82 |
|
82 | 83 | (defn list-public-profiles [n] |
83 | 84 | (with-locking (:lock @db) |
84 | | - (->> (jdbc/execute! @db ["SELECT id, file_path, profile_type, sample_count, owner, config, upload_ts, is_public, edit_token FROM profile |
| 85 | + (->> (jdbc/execute! @db ["SELECT id, file_path, profile_type, kind, sample_count, owner, config, upload_ts, is_public, edit_token FROM profile |
85 | 86 | WHERE is_public = 1 ORDER BY upload_ts DESC LIMIT ?" n]) |
86 | 87 | (mapv #(-> (unqualify-keys %) |
87 | 88 | (coerce Profile)))))) |
88 | 89 |
|
89 | 90 | (defn get-profile [profile-id] |
90 | 91 | (with-locking (:lock @db) |
91 | | - (let [q ["SELECT id, file_path, profile_type, sample_count, owner, config, upload_ts, edit_token, is_public FROM profile WHERE id = ?" profile-id] |
| 92 | + (let [q ["SELECT id, file_path, profile_type, kind, sample_count, owner, config, upload_ts, edit_token, is_public FROM profile WHERE id = ?" profile-id] |
92 | 93 | row (some-> (jdbc/execute-one! @db q) |
93 | 94 | unqualify-keys |
94 | 95 | (coerce Profile))] |
|
0 commit comments