diff --git a/bruno/Common Cents/Categories/LOC DELETE Category.bru b/bruno/Common Cents/Categories/LOC DELETE Category.bru new file mode 100644 index 0000000..9f4a425 --- /dev/null +++ b/bruno/Common Cents/Categories/LOC DELETE Category.bru @@ -0,0 +1,15 @@ +meta { + name: LOC DELETE Category + type: http + seq: 5 +} + +delete { + url: {{localBaseUrl}}/{{resourcePath}}/{{resourceId}} + body: none + auth: inherit +} + +vars:pre-request { + resourceId: cbf30070-9ff7-419f-a567-f7d145be445b +} diff --git a/bruno/Common Cents/Categories/LOC GET Categories.bru b/bruno/Common Cents/Categories/LOC GET Categories.bru new file mode 100644 index 0000000..8d46826 --- /dev/null +++ b/bruno/Common Cents/Categories/LOC GET Categories.bru @@ -0,0 +1,11 @@ +meta { + name: LOC GET Categories + type: http + seq: 1 +} + +get { + url: {{localBaseUrl}}/{{resourcePath}} + body: none + auth: inherit +} diff --git a/bruno/Common Cents/Categories/LOC GET Category By ID.bru b/bruno/Common Cents/Categories/LOC GET Category By ID.bru new file mode 100644 index 0000000..76e9ed0 --- /dev/null +++ b/bruno/Common Cents/Categories/LOC GET Category By ID.bru @@ -0,0 +1,15 @@ +meta { + name: LOC GET Category By ID + type: http + seq: 2 +} + +get { + url: {{localBaseUrl}}/{{resourcePath}}/{{resourceId}} + body: none + auth: inherit +} + +vars:pre-request { + resourceId: 1d6d2842-b271-489b-bd93-e3ceaee5a139 +} diff --git a/bruno/Common Cents/Categories/LOC POST Category.bru b/bruno/Common Cents/Categories/LOC POST Category.bru new file mode 100644 index 0000000..9168b98 --- /dev/null +++ b/bruno/Common Cents/Categories/LOC POST Category.bru @@ -0,0 +1,17 @@ +meta { + name: LOC POST Category + type: http + seq: 3 +} + +post { + url: {{localBaseUrl}}/{{resourcePath}} + body: json + auth: inherit +} + +body:json { + { + "name": "Category Three" + } +} diff --git a/bruno/Common Cents/Categories/LOC PUT Category.bru b/bruno/Common Cents/Categories/LOC PUT Category.bru new file mode 100644 index 0000000..f76470f --- /dev/null +++ b/bruno/Common Cents/Categories/LOC PUT Category.bru @@ -0,0 +1,18 @@ +meta { + name: LOC PUT Category + type: http + seq: 4 +} + +put { + url: {{localBaseUrl}}/{{resourcePath}} + body: json + auth: inherit +} + +body:json { + { + "id": "1d6d2842-b271-489b-bd93-e3ceaee5a139", + "name": "Merchant One" + } +} diff --git a/bruno/Common Cents/Categories/folder.bru b/bruno/Common Cents/Categories/folder.bru new file mode 100644 index 0000000..c32401e --- /dev/null +++ b/bruno/Common Cents/Categories/folder.bru @@ -0,0 +1,11 @@ +meta { + name: Categories +} + +auth { + mode: inherit +} + +vars:pre-request { + resourcePath: categories +} diff --git a/bruno/Common Cents/Expenses/folder.bru b/bruno/Common Cents/Expenses/folder.bru index a577d38..9a3fbf0 100644 --- a/bruno/Common Cents/Expenses/folder.bru +++ b/bruno/Common Cents/Expenses/folder.bru @@ -1,3 +1,4 @@ meta { name: Expenses + seq: 2 } diff --git a/bruno/Common Cents/Merchants/LOC DELETE Merchant.bru b/bruno/Common Cents/Merchants/LOC DELETE Merchant.bru index cc0158a..2ae38e1 100644 --- a/bruno/Common Cents/Merchants/LOC DELETE Merchant.bru +++ b/bruno/Common Cents/Merchants/LOC DELETE Merchant.bru @@ -5,7 +5,11 @@ meta { } delete { - url: {{localBaseUrl}}/merchants/cbf30070-9ff7-419f-a567-f7d145be445b + url: {{localBaseUrl}}/{{resourcePath}}/{{resourceId}} body: none auth: inherit } + +vars:pre-request { + resourceId: cbf30070-9ff7-419f-a567-f7d145be445b +} diff --git a/bruno/Common Cents/Merchants/LOC GET Merchant By ID.bru b/bruno/Common Cents/Merchants/LOC GET Merchant By ID.bru index 55caec8..16281af 100644 --- a/bruno/Common Cents/Merchants/LOC GET Merchant By ID.bru +++ b/bruno/Common Cents/Merchants/LOC GET Merchant By ID.bru @@ -5,11 +5,11 @@ meta { } get { - url: {{localBaseUrl}}/merchants/{{merchantId}} + url: {{localBaseUrl}}/{{resourcePath}}/{{resourceId}} body: none auth: inherit } vars:pre-request { - merchantId: 1d6d2842-b271-489b-bd93-e3ceaee5a139 + resourceId: 1d6d2842-b271-489b-bd93-e3ceaee5a139 } diff --git a/bruno/Common Cents/Merchants/LOC GET Merchants.bru b/bruno/Common Cents/Merchants/LOC GET Merchants.bru index 35da33e..5ba79b7 100644 --- a/bruno/Common Cents/Merchants/LOC GET Merchants.bru +++ b/bruno/Common Cents/Merchants/LOC GET Merchants.bru @@ -5,7 +5,7 @@ meta { } get { - url: {{localBaseUrl}}/merchants + url: {{localBaseUrl}}/{{resourcePath}} body: none auth: inherit } diff --git a/bruno/Common Cents/Merchants/LOC POST Merchant.bru b/bruno/Common Cents/Merchants/LOC POST Merchant.bru index e78d086..60e5466 100644 --- a/bruno/Common Cents/Merchants/LOC POST Merchant.bru +++ b/bruno/Common Cents/Merchants/LOC POST Merchant.bru @@ -5,13 +5,13 @@ meta { } post { - url: {{localBaseUrl}}/merchants + url: {{localBaseUrl}}/{{resourcePath}} body: json auth: inherit } body:json { { - "name": "Walmart" + "name": "Merchant Three" } } diff --git a/bruno/Common Cents/Merchants/LOC PUT Merchant.bru b/bruno/Common Cents/Merchants/LOC PUT Merchant.bru index e91a0e8..80247ed 100644 --- a/bruno/Common Cents/Merchants/LOC PUT Merchant.bru +++ b/bruno/Common Cents/Merchants/LOC PUT Merchant.bru @@ -5,7 +5,7 @@ meta { } put { - url: {{localBaseUrl}}/merchants + url: {{localBaseUrl}}/{{resourcePath}} body: json auth: inherit } @@ -13,6 +13,6 @@ put { body:json { { "id": "1d6d2842-b271-489b-bd93-e3ceaee5a139", - "name": "Walmart" + "name": "Merchant One" } } diff --git a/bruno/Common Cents/Merchants/folder.bru b/bruno/Common Cents/Merchants/folder.bru index caac236..2ffb460 100644 --- a/bruno/Common Cents/Merchants/folder.bru +++ b/bruno/Common Cents/Merchants/folder.bru @@ -1,8 +1,11 @@ meta { name: Merchants - seq: 3 } auth { mode: inherit } + +vars:pre-request { + resourcePath: merchants +} diff --git a/bruno/Common Cents/Sub-categories/LOC DELETE Sub-category.bru b/bruno/Common Cents/Sub-categories/LOC DELETE Sub-category.bru new file mode 100644 index 0000000..c10a511 --- /dev/null +++ b/bruno/Common Cents/Sub-categories/LOC DELETE Sub-category.bru @@ -0,0 +1,15 @@ +meta { + name: LOC DELETE Sub-category + type: http + seq: 5 +} + +delete { + url: {{localBaseUrl}}/{{resourcePath}}/{{resourceId}} + body: none + auth: inherit +} + +vars:pre-request { + resourceId: cbf30070-9ff7-419f-a567-f7d145be445b +} diff --git a/bruno/Common Cents/Sub-categories/LOC GET Sub-categories.bru b/bruno/Common Cents/Sub-categories/LOC GET Sub-categories.bru new file mode 100644 index 0000000..e2eb171 --- /dev/null +++ b/bruno/Common Cents/Sub-categories/LOC GET Sub-categories.bru @@ -0,0 +1,11 @@ +meta { + name: LOC GET Sub-categories + type: http + seq: 1 +} + +get { + url: {{localBaseUrl}}/{{resourcePath}} + body: none + auth: inherit +} diff --git a/bruno/Common Cents/Sub-categories/LOC GET Sub-category By ID.bru b/bruno/Common Cents/Sub-categories/LOC GET Sub-category By ID.bru new file mode 100644 index 0000000..6703655 --- /dev/null +++ b/bruno/Common Cents/Sub-categories/LOC GET Sub-category By ID.bru @@ -0,0 +1,15 @@ +meta { + name: LOC GET Sub-category By ID + type: http + seq: 2 +} + +get { + url: {{localBaseUrl}}/{{resourcePath}}/{{resourceId}} + body: none + auth: inherit +} + +vars:pre-request { + resourceId: 1d6d2842-b271-489b-bd93-e3ceaee5a139 +} diff --git a/bruno/Common Cents/Sub-categories/LOC POST Sub-category.bru b/bruno/Common Cents/Sub-categories/LOC POST Sub-category.bru new file mode 100644 index 0000000..2d221f4 --- /dev/null +++ b/bruno/Common Cents/Sub-categories/LOC POST Sub-category.bru @@ -0,0 +1,17 @@ +meta { + name: LOC POST Sub-category + type: http + seq: 3 +} + +post { + url: {{localBaseUrl}}/{{resourcePath}} + body: json + auth: inherit +} + +body:json { + { + "name": "Sub-category Three" + } +} diff --git a/bruno/Common Cents/Sub-categories/LOC PUT Sub-category.bru b/bruno/Common Cents/Sub-categories/LOC PUT Sub-category.bru new file mode 100644 index 0000000..060a9b0 --- /dev/null +++ b/bruno/Common Cents/Sub-categories/LOC PUT Sub-category.bru @@ -0,0 +1,18 @@ +meta { + name: LOC PUT Sub-category + type: http + seq: 4 +} + +put { + url: {{localBaseUrl}}/{{resourcePath}} + body: json + auth: inherit +} + +body:json { + { + "id": "1d6d2842-b271-489b-bd93-e3ceaee5a139", + "name": "Merchant One" + } +} diff --git a/bruno/Common Cents/Sub-categories/folder.bru b/bruno/Common Cents/Sub-categories/folder.bru new file mode 100644 index 0000000..a7f720c --- /dev/null +++ b/bruno/Common Cents/Sub-categories/folder.bru @@ -0,0 +1,11 @@ +meta { + name: Sub-categories +} + +auth { + mode: inherit +} + +vars:pre-request { + resourcePath: sub-categories +} diff --git a/bruno/Common Cents/Tags/LOC DELETE Tag.bru b/bruno/Common Cents/Tags/LOC DELETE Tag.bru new file mode 100644 index 0000000..05f60dd --- /dev/null +++ b/bruno/Common Cents/Tags/LOC DELETE Tag.bru @@ -0,0 +1,15 @@ +meta { + name: LOC DELETE Tag + type: http + seq: 5 +} + +delete { + url: {{localBaseUrl}}/{{resourcePath}}/{{resourceId}} + body: none + auth: inherit +} + +vars:pre-request { + resourceId: cbf30070-9ff7-419f-a567-f7d145be445b +} diff --git a/bruno/Common Cents/Tags/LOC GET Tag By ID.bru b/bruno/Common Cents/Tags/LOC GET Tag By ID.bru new file mode 100644 index 0000000..8abbecb --- /dev/null +++ b/bruno/Common Cents/Tags/LOC GET Tag By ID.bru @@ -0,0 +1,15 @@ +meta { + name: LOC GET Tag By ID + type: http + seq: 2 +} + +get { + url: {{localBaseUrl}}/{{resourcePath}}/{{resourceId}} + body: none + auth: inherit +} + +vars:pre-request { + resourceId: 1d6d2842-b271-489b-bd93-e3ceaee5a139 +} diff --git a/bruno/Common Cents/Tags/LOC GET Tags.bru b/bruno/Common Cents/Tags/LOC GET Tags.bru new file mode 100644 index 0000000..dc19694 --- /dev/null +++ b/bruno/Common Cents/Tags/LOC GET Tags.bru @@ -0,0 +1,11 @@ +meta { + name: LOC GET Tags + type: http + seq: 1 +} + +get { + url: {{localBaseUrl}}/{{resourcePath}} + body: none + auth: inherit +} diff --git a/bruno/Common Cents/Tags/LOC POST Tag.bru b/bruno/Common Cents/Tags/LOC POST Tag.bru new file mode 100644 index 0000000..565a854 --- /dev/null +++ b/bruno/Common Cents/Tags/LOC POST Tag.bru @@ -0,0 +1,17 @@ +meta { + name: LOC POST Tag + type: http + seq: 3 +} + +post { + url: {{localBaseUrl}}/{{resourcePath}} + body: json + auth: inherit +} + +body:json { + { + "name": "Tag Three" + } +} diff --git a/bruno/Common Cents/Tags/LOC PUT Tag.bru b/bruno/Common Cents/Tags/LOC PUT Tag.bru new file mode 100644 index 0000000..ac4b434 --- /dev/null +++ b/bruno/Common Cents/Tags/LOC PUT Tag.bru @@ -0,0 +1,18 @@ +meta { + name: LOC PUT Tag + type: http + seq: 4 +} + +put { + url: {{localBaseUrl}}/{{resourcePath}} + body: json + auth: inherit +} + +body:json { + { + "id": "1d6d2842-b271-489b-bd93-e3ceaee5a139", + "name": "Merchant One" + } +} diff --git a/bruno/Common Cents/Tags/folder.bru b/bruno/Common Cents/Tags/folder.bru new file mode 100644 index 0000000..aa07bea --- /dev/null +++ b/bruno/Common Cents/Tags/folder.bru @@ -0,0 +1,11 @@ +meta { + name: Tags +} + +auth { + mode: inherit +} + +vars:pre-request { + resourcePath: tags +} diff --git a/common-cents.db b/common-cents.db index 448549d..656df02 100644 Binary files a/common-cents.db and b/common-cents.db differ diff --git a/src/categories/categories.controller.ts b/src/categories/categories.controller.ts index 2e56113..878f76c 100644 --- a/src/categories/categories.controller.ts +++ b/src/categories/categories.controller.ts @@ -50,7 +50,7 @@ export class CategoriesController { } try { - return this.categoriesService.create(category); + return await this.categoriesService.create(category); } catch (error) { throw new InternalServerErrorException(error); diff --git a/src/categories/entities/category.entity.ts b/src/categories/entities/category.entity.ts index 6f4fd52..25ee60c 100644 --- a/src/categories/entities/category.entity.ts +++ b/src/categories/entities/category.entity.ts @@ -1 +1,10 @@ -export class Category {} +import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; + +@Entity() +export class Category { + @PrimaryGeneratedColumn('uuid') + id: string; + + @Column() + name: string; +} diff --git a/src/sub-categories/entities/sub-category.entity.ts b/src/sub-categories/entities/sub-category.entity.ts index a83bdfe..87f85ae 100644 --- a/src/sub-categories/entities/sub-category.entity.ts +++ b/src/sub-categories/entities/sub-category.entity.ts @@ -2,7 +2,7 @@ import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm'; @Entity() export class SubCategory { - @PrimaryGeneratedColumn() + @PrimaryGeneratedColumn('uuid') id: string; @Column() diff --git a/src/sub-categories/sub-categories.controller.ts b/src/sub-categories/sub-categories.controller.ts index a39b1e7..9277087 100644 --- a/src/sub-categories/sub-categories.controller.ts +++ b/src/sub-categories/sub-categories.controller.ts @@ -50,7 +50,7 @@ export class SubCategoriesController { } try { - return this.subCategoriesService.create(subCategory); + return await this.subCategoriesService.create(subCategory); } catch (error) { throw new InternalServerErrorException(error); diff --git a/src/tags/tags.controller.ts b/src/tags/tags.controller.ts index d27412e..d627f8e 100644 --- a/src/tags/tags.controller.ts +++ b/src/tags/tags.controller.ts @@ -50,7 +50,7 @@ export class TagsController { } try { - return this.tagsService.create(tag); + return await this.tagsService.create(tag); } catch (error) { throw new InternalServerErrorException(error);