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:
parent
e0bd1098eb
commit
34291fc4b4
1 changed files with 24 additions and 3 deletions
|
@ -43,6 +43,22 @@
|
||||||
photo ""]
|
photo ""]
|
||||||
(db/query-one conn [sql id fullname username email password 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
|
;; --- Projects creation
|
||||||
|
|
||||||
(def create-project-sql
|
(def create-project-sql
|
||||||
|
@ -56,8 +72,13 @@
|
||||||
(let [sql create-project-sql
|
(let [sql create-project-sql
|
||||||
id (mk-uuid "project" project-index user-index)
|
id (mk-uuid "project" project-index user-index)
|
||||||
user-id (mk-uuid "user" user-index)
|
user-id (mk-uuid "user" user-index)
|
||||||
name (str "sample project " project-index)]
|
name (str "project " project-index "," user-index)]
|
||||||
(db/query-one conn [sql id user-id name])))
|
(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
|
;; --- Create Page Files
|
||||||
|
|
||||||
|
@ -72,7 +93,7 @@
|
||||||
id (mk-uuid "page-file" file-index project-index user-index)
|
id (mk-uuid "page-file" file-index project-index user-index)
|
||||||
user-id (mk-uuid "user" user-index)
|
user-id (mk-uuid "user" user-index)
|
||||||
project-id (mk-uuid "project" project-index 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])))
|
(db/query-one conn [sql id user-id project-id name])))
|
||||||
|
|
||||||
;; --- Create Pages
|
;; --- Create Pages
|
||||||
|
|
Loading…
Reference in a new issue