diff --git a/cmd/main.go b/cmd/main.go index 00ff1ee..17ed12f 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -6,18 +6,27 @@ import ( "devtasker/internal/utils" "fmt" "os" + "sync" ) func main() { + var wg sync.WaitGroup + db := utils.ConnectDb() utils.MigrateDb(db) if os.Getenv("APP_ENV") != "production" { - utils.SeedTasks(db) + wg.Add(1) + go func() { + defer wg.Done() + utils.SeedTasks(db) + }() } app := internal.App(db) app.Listen(":3000") fmt.Println("App listen to port 3000!") + + wg.Wait() } diff --git a/internal/data/task.json b/internal/data/task.json new file mode 100644 index 0000000..571ecec --- /dev/null +++ b/internal/data/task.json @@ -0,0 +1,902 @@ +[ + { + "id": "b43c47f6-f5c0-4281-b8d4-06b5b87bee6f", + "title": "Task #1 - Add UI", + "description": "This is the description for task #1.", + "status": "in-progress", + "created_at": "2025-07-04T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "alice123" + }, + { + "id": "820aa183-a0b1-4d65-a74c-9efb5c893413", + "title": "Task #2 - Update logic", + "description": "This is the description for task #2.", + "status": "in-progress", + "created_at": "2025-07-06T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "eveb" + }, + { + "id": "61573ddc-e24b-4960-bc05-05363808dccc", + "title": "Task #3 - Remove tests", + "description": "This is the description for task #3.", + "status": "deleted", + "created_at": "2025-07-05T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "carolw" + }, + { + "id": "bc0168f2-fb6a-4e51-921b-211b380de061", + "title": "Task #4 - Refactor UI", + "description": "This is the description for task #4.", + "status": "pending", + "created_at": "2025-07-11T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "jackw" + }, + { + "id": "c68631a7-866d-43b3-926d-b1032dffbac6", + "title": "Task #5 - Fix tests", + "description": "This is the description for task #5.", + "status": "archived", + "created_at": "2025-07-03T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "frankg" + }, + { + "id": "a8b394c7-2f72-4a84-b849-b960eb164b01", + "title": "Task #6 - Add tests", + "description": "This is the description for task #6.", + "status": "archived", + "created_at": "2025-07-09T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "alice123" + }, + { + "id": "043f84a8-f7ff-419e-afa2-64e07a4dc209", + "title": "Task #7 - Fix tests", + "description": "This is the description for task #7.", + "status": "completed", + "created_at": "2025-07-11T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "alice123" + }, + { + "id": "8ca2decf-a007-4f36-a610-9bfe0647f243", + "title": "Task #8 - Fix endpoint", + "description": "This is the description for task #8.", + "status": "in-progress", + "created_at": "2025-07-06T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "gracelee" + }, + { + "id": "57e7c1d9-20dc-4e1f-8170-a30af0587131", + "title": "Task #9 - Update tests", + "description": "This is the description for task #9.", + "status": "deleted", + "created_at": "2025-07-01T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "jackw" + }, + { + "id": "89804f66-468d-46d9-8946-90c506861388", + "title": "Task #10 - Fix UI", + "description": "This is the description for task #10.", + "status": "in-progress", + "created_at": "2025-07-01T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "jackw" + }, + { + "id": "85085892-81b3-420d-8176-24c703bc9de7", + "title": "Task #11 - Remove UI", + "description": "This is the description for task #11.", + "status": "completed", + "created_at": "2025-07-05T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "carolw" + }, + { + "id": "5aa5df36-6581-4e34-9749-942012a2fdc7", + "title": "Task #12 - Add UI", + "description": "This is the description for task #12.", + "status": "completed", + "created_at": "2025-07-05T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "carolw" + }, + { + "id": "b3805a21-d8a5-4828-84a8-f3a133b2a18c", + "title": "Task #13 - Remove logic", + "description": "This is the description for task #13.", + "status": "in-progress", + "created_at": "2025-07-01T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "dave_b" + }, + { + "id": "2a5d984b-6343-4762-969f-0165fc0546d1", + "title": "Task #14 - Remove service", + "description": "This is the description for task #14.", + "status": "archived", + "created_at": "2025-07-07T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "henryk" + }, + { + "id": "02f6e531-16fa-45fc-ad99-188502ce5b6e", + "title": "Task #15 - Add UI", + "description": "This is the description for task #15.", + "status": "in-progress", + "created_at": "2025-07-07T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "ivya" + }, + { + "id": "46c15135-a7cd-4d8f-808d-d3a1eddff193", + "title": "Task #16 - Update service", + "description": "This is the description for task #16.", + "status": "archived", + "created_at": "2025-07-01T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "carolw" + }, + { + "id": "beb087b4-b144-45cc-891c-9a4ad20a16c6", + "title": "Task #17 - Update service", + "description": "This is the description for task #17.", + "status": "deleted", + "created_at": "2025-07-11T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "eveb" + }, + { + "id": "f26ced07-c5ba-4a47-9bb9-3ae88cf24a70", + "title": "Task #18 - Update logic", + "description": "This is the description for task #18.", + "status": "archived", + "created_at": "2025-07-11T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "henryk" + }, + { + "id": "1631e3ee-bdee-4853-b9da-c76b68efa32b", + "title": "Task #19 - Add endpoint", + "description": "This is the description for task #19.", + "status": "deleted", + "created_at": "2025-07-09T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "gracelee" + }, + { + "id": "e25cb20e-2796-4b9b-aae3-bf74c87d71a2", + "title": "Task #20 - Remove logic", + "description": "This is the description for task #20.", + "status": "archived", + "created_at": "2025-07-08T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "henryk" + }, + { + "id": "191e4389-aa62-4ec9-9ba0-a3a99fa38aa8", + "title": "Task #21 - Update service", + "description": "This is the description for task #21.", + "status": "archived", + "created_at": "2025-07-01T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "jackw" + }, + { + "id": "55e92ba4-79ee-44a2-aa35-7fbb61a06db8", + "title": "Task #22 - Update UI", + "description": "This is the description for task #22.", + "status": "archived", + "created_at": "2025-07-09T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "carolw" + }, + { + "id": "d210599a-ba60-4118-8020-3aaafdbc7c25", + "title": "Task #23 - Refactor endpoint", + "description": "This is the description for task #23.", + "status": "deleted", + "created_at": "2025-07-05T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "bob_smith" + }, + { + "id": "6509d08e-58a6-4d8a-8f84-456413d100b8", + "title": "Task #24 - Remove service", + "description": "This is the description for task #24.", + "status": "pending", + "created_at": "2025-07-01T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "alice123" + }, + { + "id": "41801690-c013-4f95-9254-ad2e6013dc10", + "title": "Task #25 - Refactor logic", + "description": "This is the description for task #25.", + "status": "completed", + "created_at": "2025-07-06T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "jackw" + }, + { + "id": "b0160968-f194-4744-bd72-6a686e3c99d8", + "title": "Task #26 - Add logic", + "description": "This is the description for task #26.", + "status": "completed", + "created_at": "2025-07-02T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "frankg" + }, + { + "id": "a2cf1c31-9204-46b9-8f4f-d52e24e189dd", + "title": "Task #27 - Refactor UI", + "description": "This is the description for task #27.", + "status": "pending", + "created_at": "2025-07-09T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "bob_smith" + }, + { + "id": "263763e9-7105-4cdd-9184-8e0d55f04504", + "title": "Task #28 - Update tests", + "description": "This is the description for task #28.", + "status": "archived", + "created_at": "2025-07-06T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "carolw" + }, + { + "id": "42a2d0ff-84e1-4721-a089-8301b5e2fe9b", + "title": "Task #29 - Update endpoint", + "description": "This is the description for task #29.", + "status": "deleted", + "created_at": "2025-07-08T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "frankg" + }, + { + "id": "5378fcd5-3bec-49e8-8663-321b0ab37d35", + "title": "Task #30 - Fix tests", + "description": "This is the description for task #30.", + "status": "deleted", + "created_at": "2025-07-11T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "ivya" + }, + { + "id": "23e05ac4-1a7d-4757-bcc4-dc22d60cce3b", + "title": "Task #31 - Remove tests", + "description": "This is the description for task #31.", + "status": "in-progress", + "created_at": "2025-07-10T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "gracelee" + }, + { + "id": "3b0dcec9-66a3-4d89-bc21-4a95fa39e017", + "title": "Task #32 - Add tests", + "description": "This is the description for task #32.", + "status": "pending", + "created_at": "2025-07-02T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "ivya" + }, + { + "id": "e6be933e-5bf7-47d6-b255-637f729f3ae0", + "title": "Task #33 - Fix logic", + "description": "This is the description for task #33.", + "status": "completed", + "created_at": "2025-07-02T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "frankg" + }, + { + "id": "256d33cf-e1ed-4514-b96f-6467c5a31ed6", + "title": "Task #34 - Update tests", + "description": "This is the description for task #34.", + "status": "archived", + "created_at": "2025-07-04T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "carolw" + }, + { + "id": "1bd576a3-a1b4-409d-a7a8-2b45636c766a", + "title": "Task #35 - Fix UI", + "description": "This is the description for task #35.", + "status": "completed", + "created_at": "2025-07-08T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "alice123" + }, + { + "id": "aad94124-47f0-4af2-af7e-c8bd075e1658", + "title": "Task #36 - Remove endpoint", + "description": "This is the description for task #36.", + "status": "in-progress", + "created_at": "2025-07-11T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "ivya" + }, + { + "id": "2c6e2286-11b1-4b7b-bfe0-8e10be1332a9", + "title": "Task #37 - Update tests", + "description": "This is the description for task #37.", + "status": "pending", + "created_at": "2025-07-11T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "jackw" + }, + { + "id": "dea14d3c-6268-4dcf-9952-0dac65b7b3a3", + "title": "Task #38 - Fix tests", + "description": "This is the description for task #38.", + "status": "pending", + "created_at": "2025-07-03T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "gracelee" + }, + { + "id": "7d9276bc-551e-4d07-86b0-5cb1e45c1d16", + "title": "Task #39 - Fix tests", + "description": "This is the description for task #39.", + "status": "pending", + "created_at": "2025-07-10T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "dave_b" + }, + { + "id": "f11f1dc6-b440-4266-9b86-7bc84f5473f1", + "title": "Task #40 - Update logic", + "description": "This is the description for task #40.", + "status": "archived", + "created_at": "2025-07-11T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "henryk" + }, + { + "id": "3737b5e8-4741-47d4-a043-dfd7d4f8b963", + "title": "Task #41 - Add endpoint", + "description": "This is the description for task #41.", + "status": "archived", + "created_at": "2025-07-07T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "bob_smith" + }, + { + "id": "415f0d10-a7e6-4170-b53b-16c4636d8587", + "title": "Task #42 - Fix UI", + "description": "This is the description for task #42.", + "status": "deleted", + "created_at": "2025-07-09T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "bob_smith" + }, + { + "id": "10bf0e9c-1d1d-4739-a2bb-b68e6cc2468c", + "title": "Task #43 - Refactor UI", + "description": "This is the description for task #43.", + "status": "completed", + "created_at": "2025-07-06T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "jackw" + }, + { + "id": "b2d4b127-c9f1-4337-a336-ea62c5047a9a", + "title": "Task #44 - Update tests", + "description": "This is the description for task #44.", + "status": "archived", + "created_at": "2025-07-07T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "jackw" + }, + { + "id": "7bcb01a2-b2c3-403d-be82-d9e2eb6d7e49", + "title": "Task #45 - Update tests", + "description": "This is the description for task #45.", + "status": "deleted", + "created_at": "2025-07-08T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "gracelee" + }, + { + "id": "7217c290-2313-4271-8067-eb9cef95ccbe", + "title": "Task #46 - Fix UI", + "description": "This is the description for task #46.", + "status": "deleted", + "created_at": "2025-07-07T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "henryk" + }, + { + "id": "b75e8640-83be-4468-b76d-1b015dcae0e7", + "title": "Task #47 - Remove endpoint", + "description": "This is the description for task #47.", + "status": "completed", + "created_at": "2025-07-09T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "henryk" + }, + { + "id": "1eea3d3a-8dfa-45e2-befd-32c236172218", + "title": "Task #48 - Update UI", + "description": "This is the description for task #48.", + "status": "in-progress", + "created_at": "2025-07-02T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "henryk" + }, + { + "id": "0dcac5fe-4f98-4848-9db7-cfc5fc85769e", + "title": "Task #49 - Refactor service", + "description": "This is the description for task #49.", + "status": "archived", + "created_at": "2025-07-04T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "alice123" + }, + { + "id": "ee151baf-d5df-4401-a1b8-9c9cc6c98308", + "title": "Task #50 - Add tests", + "description": "This is the description for task #50.", + "status": "completed", + "created_at": "2025-07-07T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "frankg" + }, + { + "id": "d21e2dff-49a0-4acf-aa05-c6e14da50582", + "title": "Task #51 - Update logic", + "description": "This is the description for task #51.", + "status": "deleted", + "created_at": "2025-07-02T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "ivya" + }, + { + "id": "31f4d32c-65fa-42f0-8ac3-7b866350f6d9", + "title": "Task #52 - Add UI", + "description": "This is the description for task #52.", + "status": "in-progress", + "created_at": "2025-07-10T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "jackw" + }, + { + "id": "7fb6b9d2-7ba2-4b15-bbbc-a01b1150b8d8", + "title": "Task #53 - Fix service", + "description": "This is the description for task #53.", + "status": "pending", + "created_at": "2025-07-09T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "eveb" + }, + { + "id": "7e9abed2-d6b9-4b50-ba50-237065ea610c", + "title": "Task #54 - Fix logic", + "description": "This is the description for task #54.", + "status": "completed", + "created_at": "2025-07-09T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "ivya" + }, + { + "id": "a9b3fe55-e6cc-4264-8e56-8dbb58cbac7c", + "title": "Task #55 - Remove UI", + "description": "This is the description for task #55.", + "status": "archived", + "created_at": "2025-07-03T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "ivya" + }, + { + "id": "13ae14e7-08af-420d-92eb-3cb05738a3d0", + "title": "Task #56 - Refactor service", + "description": "This is the description for task #56.", + "status": "completed", + "created_at": "2025-07-01T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "frankg" + }, + { + "id": "9e528ffc-061a-47e9-bf12-ea4b70298db5", + "title": "Task #57 - Update endpoint", + "description": "This is the description for task #57.", + "status": "in-progress", + "created_at": "2025-07-10T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "henryk" + }, + { + "id": "9c922e9f-27ac-4417-be64-84f747870617", + "title": "Task #58 - Refactor service", + "description": "This is the description for task #58.", + "status": "in-progress", + "created_at": "2025-07-11T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "gracelee" + }, + { + "id": "18d2ded2-532f-46b2-9abc-c2c7115c9747", + "title": "Task #59 - Fix service", + "description": "This is the description for task #59.", + "status": "completed", + "created_at": "2025-07-08T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "henryk" + }, + { + "id": "142d7fda-c613-4edf-adb3-aeacd5cbcb2d", + "title": "Task #60 - Add UI", + "description": "This is the description for task #60.", + "status": "archived", + "created_at": "2025-07-01T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "frankg" + }, + { + "id": "783286df-3639-40c4-bd93-ad0088a3737d", + "title": "Task #61 - Fix UI", + "description": "This is the description for task #61.", + "status": "completed", + "created_at": "2025-07-02T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "jackw" + }, + { + "id": "4dda3388-d8c8-4191-9005-fe9d793a0062", + "title": "Task #62 - Fix endpoint", + "description": "This is the description for task #62.", + "status": "deleted", + "created_at": "2025-07-07T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "henryk" + }, + { + "id": "e6422225-ca69-44e6-b2e3-f03faacfda9b", + "title": "Task #63 - Update logic", + "description": "This is the description for task #63.", + "status": "deleted", + "created_at": "2025-07-09T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "bob_smith" + }, + { + "id": "98c23efe-fd38-4b3a-a677-21373afc45ee", + "title": "Task #64 - Refactor endpoint", + "description": "This is the description for task #64.", + "status": "completed", + "created_at": "2025-07-02T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "carolw" + }, + { + "id": "614d7588-1fa0-4c4e-998e-e227980174a7", + "title": "Task #65 - Fix service", + "description": "This is the description for task #65.", + "status": "deleted", + "created_at": "2025-07-08T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "gracelee" + }, + { + "id": "09ba25fb-9372-4db8-82f6-2d93feacfa70", + "title": "Task #66 - Add UI", + "description": "This is the description for task #66.", + "status": "completed", + "created_at": "2025-07-10T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "eveb" + }, + { + "id": "3f0b13b5-f8b9-409a-97dd-79c29db6c893", + "title": "Task #67 - Fix UI", + "description": "This is the description for task #67.", + "status": "completed", + "created_at": "2025-07-01T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "alice123" + }, + { + "id": "ce4fb47c-f544-4cbe-99ec-275b8f8dbe08", + "title": "Task #68 - Update UI", + "description": "This is the description for task #68.", + "status": "in-progress", + "created_at": "2025-07-04T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "henryk" + }, + { + "id": "8d40644f-6846-4af6-9aaa-5c4e469f023b", + "title": "Task #69 - Add service", + "description": "This is the description for task #69.", + "status": "archived", + "created_at": "2025-07-09T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "ivya" + }, + { + "id": "db7c2ae1-62bb-431a-b0d8-32388c77cc5c", + "title": "Task #70 - Add endpoint", + "description": "This is the description for task #70.", + "status": "archived", + "created_at": "2025-07-03T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "jackw" + }, + { + "id": "5530901e-6987-4972-b3ca-45c2722a9721", + "title": "Task #71 - Fix endpoint", + "description": "This is the description for task #71.", + "status": "completed", + "created_at": "2025-07-07T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "eveb" + }, + { + "id": "45488f0f-0e7d-4b2b-8377-39bcaeaefc33", + "title": "Task #72 - Refactor UI", + "description": "This is the description for task #72.", + "status": "pending", + "created_at": "2025-07-01T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "carolw" + }, + { + "id": "cc4d453f-e0df-49ff-a607-a532e65b4684", + "title": "Task #73 - Update tests", + "description": "This is the description for task #73.", + "status": "completed", + "created_at": "2025-07-06T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "ivya" + }, + { + "id": "0383a7a7-ae83-40cf-a8b1-8ab490a4cd30", + "title": "Task #74 - Update UI", + "description": "This is the description for task #74.", + "status": "in-progress", + "created_at": "2025-07-11T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "jackw" + }, + { + "id": "87a7881d-c27d-46e9-b086-6aa7e75945c7", + "title": "Task #75 - Fix logic", + "description": "This is the description for task #75.", + "status": "archived", + "created_at": "2025-07-06T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "bob_smith" + }, + { + "id": "4b53bd27-d9e4-4538-a7d9-86d33d1ff076", + "title": "Task #76 - Update service", + "description": "This is the description for task #76.", + "status": "completed", + "created_at": "2025-07-04T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "gracelee" + }, + { + "id": "49614892-dcb3-4f38-9e06-c2fa5ec09f9d", + "title": "Task #77 - Remove service", + "description": "This is the description for task #77.", + "status": "completed", + "created_at": "2025-07-10T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "frankg" + }, + { + "id": "2a07d138-3568-4932-9e4a-2664666c557d", + "title": "Task #78 - Refactor service", + "description": "This is the description for task #78.", + "status": "pending", + "created_at": "2025-07-11T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "ivya" + }, + { + "id": "6cfe75d4-bd33-470c-9094-a6b8bb287b01", + "title": "Task #79 - Remove tests", + "description": "This is the description for task #79.", + "status": "completed", + "created_at": "2025-07-11T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "dave_b" + }, + { + "id": "5f96791d-4398-49a0-b826-187f968b40c6", + "title": "Task #80 - Add UI", + "description": "This is the description for task #80.", + "status": "pending", + "created_at": "2025-07-03T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "carolw" + }, + { + "id": "83603331-3fc1-4356-a24c-5ed5088db43f", + "title": "Task #81 - Update tests", + "description": "This is the description for task #81.", + "status": "pending", + "created_at": "2025-07-10T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "ivya" + }, + { + "id": "172e7bf4-51fd-4241-8f1a-099953165dc3", + "title": "Task #82 - Update service", + "description": "This is the description for task #82.", + "status": "completed", + "created_at": "2025-07-03T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "eveb" + }, + { + "id": "eb3ec3bc-6145-4fa4-918d-e681a274c594", + "title": "Task #83 - Update logic", + "description": "This is the description for task #83.", + "status": "pending", + "created_at": "2025-07-04T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "eveb" + }, + { + "id": "82701430-9bbd-4170-a1fa-5589acf0dab8", + "title": "Task #84 - Update tests", + "description": "This is the description for task #84.", + "status": "completed", + "created_at": "2025-07-02T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "alice123" + }, + { + "id": "d014d0ce-c9a2-4910-ba02-f43b2a251f61", + "title": "Task #85 - Fix UI", + "description": "This is the description for task #85.", + "status": "completed", + "created_at": "2025-07-03T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "gracelee" + }, + { + "id": "b30df020-0d66-41c6-8629-b78365be50cd", + "title": "Task #86 - Update service", + "description": "This is the description for task #86.", + "status": "deleted", + "created_at": "2025-07-01T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "bob_smith" + }, + { + "id": "61f077c4-ac45-4876-86b6-50cf18794fb0", + "title": "Task #87 - Add logic", + "description": "This is the description for task #87.", + "status": "completed", + "created_at": "2025-07-08T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "gracelee" + }, + { + "id": "6ee094d0-33f8-4152-a842-f277a03f262a", + "title": "Task #88 - Add UI", + "description": "This is the description for task #88.", + "status": "deleted", + "created_at": "2025-07-06T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "alice123" + }, + { + "id": "9f9cd7bc-7158-43ca-a002-706292a5fee6", + "title": "Task #89 - Add tests", + "description": "This is the description for task #89.", + "status": "pending", + "created_at": "2025-07-07T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "dave_b" + }, + { + "id": "86c883bd-81c6-49e5-bf9c-504db790b7dd", + "title": "Task #90 - Fix service", + "description": "This is the description for task #90.", + "status": "completed", + "created_at": "2025-07-08T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "frankg" + }, + { + "id": "99c5e0bb-2cb5-4a9f-b33f-5cd21e02d282", + "title": "Task #91 - Remove UI", + "description": "This is the description for task #91.", + "status": "in-progress", + "created_at": "2025-07-02T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "gracelee" + }, + { + "id": "e63f5495-f0e9-494f-ac4b-f87c440141a3", + "title": "Task #92 - Add service", + "description": "This is the description for task #92.", + "status": "completed", + "created_at": "2025-07-08T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "alice123" + }, + { + "id": "6c063041-bb73-4fbd-983a-46c2b26ab787", + "title": "Task #93 - Refactor logic", + "description": "This is the description for task #93.", + "status": "completed", + "created_at": "2025-07-10T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "alice123" + }, + { + "id": "c6f40290-9b28-4de7-b807-3400e2ca63c2", + "title": "Task #94 - Refactor tests", + "description": "This is the description for task #94.", + "status": "archived", + "created_at": "2025-07-03T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "gracelee" + }, + { + "id": "c24bead5-b506-4836-a404-4c11ebf96b29", + "title": "Task #95 - Fix service", + "description": "This is the description for task #95.", + "status": "pending", + "created_at": "2025-07-10T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "gracelee" + }, + { + "id": "2b0dba7f-83a6-44d3-b5fc-ef7ae866d174", + "title": "Task #96 - Remove tests", + "description": "This is the description for task #96.", + "status": "deleted", + "created_at": "2025-07-11T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "dave_b" + }, + { + "id": "4b7b6465-e4d0-41c6-93b0-57f7c15f2ca7", + "title": "Task #97 - Remove UI", + "description": "This is the description for task #97.", + "status": "pending", + "created_at": "2025-07-05T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "ivya" + }, + { + "id": "7d7a5de9-612e-4aae-bdf9-69e8612046b1", + "title": "Task #98 - Update logic", + "description": "This is the description for task #98.", + "status": "pending", + "created_at": "2025-07-03T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "jackw" + }, + { + "id": "79a73706-7ba2-4700-b4bd-1e02f0e1e2c8", + "title": "Task #99 - Fix logic", + "description": "This is the description for task #99.", + "status": "archived", + "created_at": "2025-07-06T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "alice123" + }, + { + "id": "26248e4a-3d49-4d67-b9ba-8b4ff00f65e5", + "title": "Task #100 - Update tests", + "description": "This is the description for task #100.", + "status": "in-progress", + "created_at": "2025-07-08T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z", + "user_username": "bob_smith" + } +] \ No newline at end of file diff --git a/internal/data/user.json b/internal/data/user.json new file mode 100644 index 0000000..eb838ca --- /dev/null +++ b/internal/data/user.json @@ -0,0 +1,82 @@ +[ + { + "id": "ecd1993c-c0ee-4f94-8de3-6c204a1491bf", + "name": "Alice123", + "username": "alice123", + "password": "hashed_password_1", + "created_at": "2025-07-02T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z" + }, + { + "id": "b500f263-3ce0-4002-bccb-28df4d4956a8", + "name": "Bob smith", + "username": "bob_smith", + "password": "hashed_password_2", + "created_at": "2025-07-03T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z" + }, + { + "id": "f6960e96-5345-4960-a335-32495fee5747", + "name": "Carolw", + "username": "carolw", + "password": "hashed_password_3", + "created_at": "2025-07-04T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z" + }, + { + "id": "3310dffc-0da5-4592-b830-6c37fbdf0d10", + "name": "Dave b", + "username": "dave_b", + "password": "hashed_password_4", + "created_at": "2025-07-05T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z" + }, + { + "id": "a617b868-b475-4c2a-8053-897054b3cb7b", + "name": "Eveb", + "username": "eveb", + "password": "hashed_password_5", + "created_at": "2025-07-06T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z" + }, + { + "id": "d029077b-58a2-448e-9ee3-51d6062816ef", + "name": "Frankg", + "username": "frankg", + "password": "hashed_password_6", + "created_at": "2025-07-07T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z" + }, + { + "id": "a15bb63d-b6ed-47b8-a074-53bb10288956", + "name": "Gracelee", + "username": "gracelee", + "password": "hashed_password_7", + "created_at": "2025-07-08T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z" + }, + { + "id": "32fe3c3c-7fe2-4f18-9493-215a86d19071", + "name": "Henryk", + "username": "henryk", + "password": "hashed_password_8", + "created_at": "2025-07-09T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z" + }, + { + "id": "a36d15ea-af36-4672-8c39-e8956ab6d6c2", + "name": "Ivya", + "username": "ivya", + "password": "hashed_password_9", + "created_at": "2025-07-10T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z" + }, + { + "id": "49c79996-4148-4694-8f11-d874bae75739", + "name": "Jackw", + "username": "jackw", + "password": "hashed_password_10", + "created_at": "2025-07-11T08:00:00Z", + "updated_at": "2025-07-10T08:00:00Z" + } +] \ No newline at end of file diff --git a/internal/utils/data.json b/internal/utils/data.json deleted file mode 100644 index d1c354e..0000000 --- a/internal/utils/data.json +++ /dev/null @@ -1,17 +0,0 @@ -[ - { - "title": "Write project proposal", - "description": "Draft the initial proposal for the DevTasker project.", - "status": "pending" - }, - { - "title": "Implement task queue", - "description": "Develop the job queue and worker pool system in Go.", - "status": "in-progress" - }, - { - "title": "Create README", - "description": "Write a comprehensive README for the GitHub repository.", - "status": "completed" - } -] diff --git a/internal/utils/seeder.go b/internal/utils/seeder.go index 833ecb3..4d3541b 100644 --- a/internal/utils/seeder.go +++ b/internal/utils/seeder.go @@ -10,9 +10,14 @@ import ( "gorm.io/gorm" ) -func readFile() []byte { +const ( + UserDataPath string = "user.json" + TaskDataPath string = "task.json" +) + +func readFile(fname string) []byte { dir, _ := os.Getwd() - fpath := fmt.Sprintf("%s/internal/utils/data.json", dir) + fpath := fmt.Sprintf("%s/internal/data/%s", dir, fname) jsonFile, err := os.Open(fpath) if err != nil { fmt.Println("Failed to read data.json", err) @@ -23,14 +28,16 @@ func readFile() []byte { return byteVal } -func getDummyData() []*model.Task { - var tasks []*model.Task - byteVal := readFile() - json.Unmarshal(byteVal, &tasks) - return tasks +func getDummyData[T any](fname string) []T { + var data []T + byteVal := readFile(fname) + json.Unmarshal(byteVal, &data) + return data } func SeedTasks(db *gorm.DB) { - data := getDummyData() - db.Save(data) + tasks := getDummyData[model.Task](TaskDataPath) + db.Save(tasks) + users := getDummyData[model.User](UserDataPath) + db.Save(users) }