-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: added description and comment columns in all existing tables and apis #284
base: main
Are you sure you want to change the base?
Conversation
e80798d
to
8f36918
Compare
@@ -0,0 +1,19 @@ | |||
-- This file should undo anything in `up.sql` | |||
-- contexts table |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No , I will remove it
a37e9b2
to
dfc8172
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets make the fields non-nullable, as per the discussion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Description should be mandatory. I think comment too but we can discuss this
@@ -378,9 +378,21 @@ fn construct_new_payload( | |||
}, | |||
)?; | |||
|
|||
let description = res | |||
.get("description") | |||
.and_then(|val| val.as_str()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This returns result right? We should handle that
let description = res | ||
.get("description") | ||
.and_then(|val| val.as_str()) | ||
.map(|s| s.to_string()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do this inside and_then
pub description: Option<String>, | ||
pub comment: Option<String>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This two should be mandatory in this case, the frontend should just send ""
c3b2999
to
0dd0666
Compare
0dd0666
to
0cd3db1
Compare
.get("description") | ||
.expect("Description not present") | ||
.as_str() | ||
.expect("Description is not a string") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of expect , can we return error
@@ -81,11 +84,13 @@ async fn create( | |||
function_name: fun_name.clone(), | |||
last_modified_at: Utc::now().naive_utc(), | |||
last_modified_by: user.get_email(), | |||
comment: create_req.comment.into(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
into() is not needed here
ALTER TABLE public.type_templates ADD COLUMN IF NOT EXISTS description TEXT DEFAULT '' NOT NULL; | ||
ALTER TABLE public.type_templates ADD COLUMN IF NOT EXISTS comment TEXT DEFAULT '' NOT NULL; | ||
|
||
ALTER TABLE public.functions RENAME COLUMN function_description TO description; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why function does not have comment
Problem
Added description and comment columns in all existing tables and apis
Solution
Provide a brief summary of your solution so that reviewers can understand your code
Environment variable changes
What ENVs need to be added or changed
Pre-deployment activity
Things needed to be done before deploying this change (if any)
Post-deployment activity
Things needed to be done after deploying this change (if any)
API changes