0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-10 08:50:57 -05:00

Add projects with multiple users to fixtures.

This commit is contained in:
Andrey Antukh 2019-12-19 13:10:19 +01:00
parent e0bd1098eb
commit 34291fc4b4

View file

@ -43,6 +43,22 @@
photo ""]
(db/query-one conn [sql id fullname username email password photo])))
;; --- Project User Relation Creation
(def create-project-user-sql
"insert into project_users (project_id, user_id, can_edit)
values ($1, $2, true)
returning *")
(defn create-additional-project-user
[conn [project-index user-index]]
(log/info "create project user" user-index project-index)
(let [sql create-project-user-sql
project-id (mk-uuid "project" project-index user-index)
user-id (mk-uuid "user" (dec user-index))]
(println sql project-id user-id)
(db/query-one conn [sql project-id user-id])))
;; --- Projects creation
(def create-project-sql
@ -56,8 +72,13 @@
(let [sql create-project-sql
id (mk-uuid "project" project-index user-index)
user-id (mk-uuid "user" user-index)
name (str "sample project " project-index)]
(db/query-one conn [sql id user-id name])))
name (str "project " project-index "," user-index)]
(p/do! (db/query-one conn [sql id user-id name])
(when (and (= project-index 0)
(> user-index 0))
(create-additional-project-user conn [project-index user-index])))))
;; --- Create Page Files
@ -72,7 +93,7 @@
id (mk-uuid "page-file" file-index project-index user-index)
user-id (mk-uuid "user" user-index)
project-id (mk-uuid "project" project-index user-index)
name (str "Sample file " file-index)]
name (str "file " file-index "," project-index "," user-index)]
(db/query-one conn [sql id user-id project-id name])))
;; --- Create Pages