Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sauraww
Copy link
Collaborator

@sauraww sauraww commented Nov 14, 2024

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

Endpoint Method Request body Response Body
API GET/POST, etc request response

@sauraww sauraww requested a review from a team as a code owner November 14, 2024 11:01
@sauraww sauraww force-pushed the feat/add-description-and-commit branch from e80798d to 8f36918 Compare November 14, 2024 11:02
@@ -0,0 +1,19 @@
-- This file should undo anything in `up.sql`
-- contexts table
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these needed?

Copy link
Collaborator Author

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

@sauraww sauraww force-pushed the feat/add-description-and-commit branch 11 times, most recently from a37e9b2 to dfc8172 Compare November 14, 2024 15:02
Copy link
Collaborator

@mahatoankitkumar mahatoankitkumar left a 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.

Copy link
Collaborator

@Datron Datron left a 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())
Copy link
Collaborator

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());
Copy link
Collaborator

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

Comment on lines 9 to 10
pub description: Option<String>,
pub comment: Option<String>,
Copy link
Collaborator

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 ""

@sauraww sauraww force-pushed the feat/add-description-and-commit branch 14 times, most recently from c3b2999 to 0dd0666 Compare November 21, 2024 12:57
@sauraww sauraww force-pushed the feat/add-description-and-commit branch from 0dd0666 to 0cd3db1 Compare November 21, 2024 13:54
.get("description")
.expect("Description not present")
.as_str()
.expect("Description is not a string")
Copy link
Collaborator

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(),
Copy link
Collaborator

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;
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants