-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #54 from agnyz/feature/user-remaining-endpoints
feat: user and profile endpoints
- Loading branch information
Showing
26 changed files
with
1,070 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
CREATE TABLE IF NOT EXISTS "user_follows" ( | ||
"user_id" integer, | ||
"follower_id" integer, | ||
"created_at" date DEFAULT CURRENT_DATE, | ||
"updated_at" date DEFAULT CURRENT_DATE, | ||
CONSTRAINT user_follows_user_id_follower_id PRIMARY KEY("user_id","follower_id") | ||
); | ||
|
||
DO $$ BEGIN | ||
ALTER TABLE "user_follows" ADD CONSTRAINT "user_follows_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "users"("id") ON DELETE no action ON UPDATE no action; | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; | ||
|
||
DO $$ BEGIN | ||
ALTER TABLE "user_follows" ADD CONSTRAINT "user_follows_follower_id_users_id_fk" FOREIGN KEY ("follower_id") REFERENCES "users"("id") ON DELETE no action ON UPDATE no action; | ||
EXCEPTION | ||
WHEN duplicate_object THEN null; | ||
END $$; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE "users" ALTER COLUMN "image" SET DEFAULT 'https://api.realworld.io/images/smiley-cyrus.jpg'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ALTER TABLE "users" ALTER COLUMN "bio" SET DEFAULT ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
ALTER TABLE "user_follows" | ||
ALTER COLUMN "user_id" | ||
SET NOT NULL; | ||
ALTER TABLE "user_follows" | ||
ALTER COLUMN "follower_id" | ||
SET NOT NULL; | ||
ALTER TABLE "user_follows" | ||
ALTER COLUMN "created_at" | ||
SET NOT NULL; | ||
ALTER TABLE "user_follows" | ||
ALTER COLUMN "updated_at" | ||
SET NOT NULL; | ||
ALTER TABLE "users" | ||
ALTER COLUMN "bio" | ||
SET NOT NULL; | ||
ALTER TABLE "users" | ||
ALTER COLUMN "image" | ||
SET NOT NULL; | ||
ALTER TABLE "users" | ||
ALTER COLUMN "created_at" | ||
SET NOT NULL; | ||
ALTER TABLE "users" | ||
ALTER COLUMN "updated_at" | ||
SET NOT NULL; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
{ | ||
"version": "5", | ||
"dialect": "pg", | ||
"id": "37bce8eb-cbc0-456a-be7c-dd4a351999b2", | ||
"prevId": "8ed456d0-e522-4f1a-a07e-a19b3cd900bc", | ||
"tables": { | ||
"user_follows": { | ||
"name": "user_follows", | ||
"schema": "", | ||
"columns": { | ||
"user_id": { | ||
"name": "user_id", | ||
"type": "integer", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"follower_id": { | ||
"name": "follower_id", | ||
"type": "integer", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"created_at": { | ||
"name": "created_at", | ||
"type": "date", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"default": "CURRENT_DATE" | ||
}, | ||
"updated_at": { | ||
"name": "updated_at", | ||
"type": "date", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"default": "CURRENT_DATE" | ||
} | ||
}, | ||
"indexes": {}, | ||
"foreignKeys": { | ||
"user_follows_user_id_users_id_fk": { | ||
"name": "user_follows_user_id_users_id_fk", | ||
"tableFrom": "user_follows", | ||
"tableTo": "users", | ||
"columnsFrom": ["user_id"], | ||
"columnsTo": ["id"], | ||
"onDelete": "no action", | ||
"onUpdate": "no action" | ||
}, | ||
"user_follows_follower_id_users_id_fk": { | ||
"name": "user_follows_follower_id_users_id_fk", | ||
"tableFrom": "user_follows", | ||
"tableTo": "users", | ||
"columnsFrom": ["follower_id"], | ||
"columnsTo": ["id"], | ||
"onDelete": "no action", | ||
"onUpdate": "no action" | ||
} | ||
}, | ||
"compositePrimaryKeys": { | ||
"user_follows_user_id_follower_id": { | ||
"name": "user_follows_user_id_follower_id", | ||
"columns": ["user_id", "follower_id"] | ||
} | ||
}, | ||
"uniqueConstraints": {} | ||
}, | ||
"users": { | ||
"name": "users", | ||
"schema": "", | ||
"columns": { | ||
"id": { | ||
"name": "id", | ||
"type": "serial", | ||
"primaryKey": true, | ||
"notNull": true | ||
}, | ||
"email": { | ||
"name": "email", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"bio": { | ||
"name": "bio", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"image": { | ||
"name": "image", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"password": { | ||
"name": "password", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"username": { | ||
"name": "username", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"created_at": { | ||
"name": "created_at", | ||
"type": "date", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"default": "CURRENT_DATE" | ||
}, | ||
"updated_at": { | ||
"name": "updated_at", | ||
"type": "date", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"default": "CURRENT_DATE" | ||
} | ||
}, | ||
"indexes": {}, | ||
"foreignKeys": {}, | ||
"compositePrimaryKeys": {}, | ||
"uniqueConstraints": { | ||
"users_email_unique": { | ||
"name": "users_email_unique", | ||
"nullsNotDistinct": false, | ||
"columns": ["email"] | ||
} | ||
} | ||
} | ||
}, | ||
"enums": {}, | ||
"schemas": {}, | ||
"_meta": { | ||
"schemas": {}, | ||
"tables": {}, | ||
"columns": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
{ | ||
"version": "5", | ||
"dialect": "pg", | ||
"id": "d3648b42-2fea-42c2-a1d8-e55af14ec90a", | ||
"prevId": "37bce8eb-cbc0-456a-be7c-dd4a351999b2", | ||
"tables": { | ||
"user_follows": { | ||
"name": "user_follows", | ||
"schema": "", | ||
"columns": { | ||
"user_id": { | ||
"name": "user_id", | ||
"type": "integer", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"follower_id": { | ||
"name": "follower_id", | ||
"type": "integer", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"created_at": { | ||
"name": "created_at", | ||
"type": "date", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"default": "CURRENT_DATE" | ||
}, | ||
"updated_at": { | ||
"name": "updated_at", | ||
"type": "date", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"default": "CURRENT_DATE" | ||
} | ||
}, | ||
"indexes": {}, | ||
"foreignKeys": { | ||
"user_follows_user_id_users_id_fk": { | ||
"name": "user_follows_user_id_users_id_fk", | ||
"tableFrom": "user_follows", | ||
"tableTo": "users", | ||
"columnsFrom": ["user_id"], | ||
"columnsTo": ["id"], | ||
"onDelete": "no action", | ||
"onUpdate": "no action" | ||
}, | ||
"user_follows_follower_id_users_id_fk": { | ||
"name": "user_follows_follower_id_users_id_fk", | ||
"tableFrom": "user_follows", | ||
"tableTo": "users", | ||
"columnsFrom": ["follower_id"], | ||
"columnsTo": ["id"], | ||
"onDelete": "no action", | ||
"onUpdate": "no action" | ||
} | ||
}, | ||
"compositePrimaryKeys": { | ||
"user_follows_user_id_follower_id": { | ||
"name": "user_follows_user_id_follower_id", | ||
"columns": ["user_id", "follower_id"] | ||
} | ||
}, | ||
"uniqueConstraints": {} | ||
}, | ||
"users": { | ||
"name": "users", | ||
"schema": "", | ||
"columns": { | ||
"id": { | ||
"name": "id", | ||
"type": "serial", | ||
"primaryKey": true, | ||
"notNull": true | ||
}, | ||
"email": { | ||
"name": "email", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"bio": { | ||
"name": "bio", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false | ||
}, | ||
"image": { | ||
"name": "image", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"default": "'https://api.realworld.io/images/smiley-cyrus.jpg'" | ||
}, | ||
"password": { | ||
"name": "password", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"username": { | ||
"name": "username", | ||
"type": "text", | ||
"primaryKey": false, | ||
"notNull": true | ||
}, | ||
"created_at": { | ||
"name": "created_at", | ||
"type": "date", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"default": "CURRENT_DATE" | ||
}, | ||
"updated_at": { | ||
"name": "updated_at", | ||
"type": "date", | ||
"primaryKey": false, | ||
"notNull": false, | ||
"default": "CURRENT_DATE" | ||
} | ||
}, | ||
"indexes": {}, | ||
"foreignKeys": {}, | ||
"compositePrimaryKeys": {}, | ||
"uniqueConstraints": { | ||
"users_email_unique": { | ||
"name": "users_email_unique", | ||
"nullsNotDistinct": false, | ||
"columns": ["email"] | ||
} | ||
} | ||
} | ||
}, | ||
"enums": {}, | ||
"schemas": {}, | ||
"_meta": { | ||
"schemas": {}, | ||
"tables": {}, | ||
"columns": {} | ||
} | ||
} |
Oops, something went wrong.