CSE 340: Web Backend Development

W02 Team Activity: Database Entities for Service Projects

Overview

For this team activity, you will meet for a 1-hour synchronous team meeting using Microsoft Teams video sharing.

Please make every effort to attend this meeting. If you cannot attend, you must complete the Absent from Meeting Checklist.

In this activity, you will work with your team to add Service Projects to your individual projects, including from the database all the way through display in an EJS page.

Activity Instructions

Before the Meeting

Before the meeting begins, each person should individually do the following:

For the meeting, follow these steps.

Determine the Leader for the Meeting

Choose one person that will be the leader for this meeting. Their role will be to help guide the rest of the team through the steps of the meeting. Try to rotate so that each person gets a chance to be the leader of at least one meeting.

Group Discussion

Throughout this activity, you will see group discussion question boxes like this one. The leader for the meeting should ask these questions, and you should discuss them as a group. After the activity, there will be a quiz question very similar to each discussion question.

Begin with Prayer

One person on the team should begin the meeting with a prayer.

Code Review (10 minutes)

Select one person to share their screen and share some of their code from the last week. (Try to rotate so that each person gets a chance to share at least once during the course.)

Understand the Requirements

In the learning activities, you added Organizations to your application. For this activity, you will add Service Projects according to the following specifications:

Add service projects to the database

The first step is to design your table(s) and add it to the database.

Questions to discuss:

  1. What table(s) do you need to create?
  2. What columns should be in each table?
  3. What data types should each column be?
  4. What constraints should you add to each column?

Once you have discussed and agreed on the design, each person should complete the following steps (it may be helpful for one person to share their screen):

  1. Create the table(s) in the database.
  2. Insert at least 5 sample service projects for each organization in your database (assuming you have at least 3 organizations, that is at least 15 projects).
  3. Remember: AI can be helpful

    Remember that AI can be very helpful in generating SQL for both the Create Table scripts as well as the scripts to insert the data.

    If you have AI generate SQL for you, make sure to carefully review each line to ensure that you understand everything in your commands. If there is something in the SQL that you don't understand, ask AI to explain it.

  4. Verify that the data has been inserted correctly by running a SELECT statement on the table.
  5. Add your SQL commands to your setup.sql file so that you can re-create your database in the future.

Group Discussion

Update the Application Code

Update your Node.js application code to retrieve and display the service projects. You will need to complete the following:

  1. Create a file src/models/projects.js and add a function to get all projects along with their organization names (this will require a join).
  2. Hint: Make sure to follow the example of src/models/organizations.js that you completed in a learning activity.

  3. Add a call to that function in server.js and display the results to the console to verify it is working.

Group Discussion

Add a Service Projects EJS page

Create a new EJS page to display the service projects along with their organization names.

  1. Update the route in server.js to call the getAllProjects() to get the Service Project and send it to the rendering of the EJS page.
  2. Update the EJS page views/projects.ejs to display the projects along with the organizations.
  3. On the EJS page, iterate through the list of projects and for each one, display the project title and the organization name in the format: Date: Project Title (Organization Name).
    • Make sure to format the date in a user-friendly way.

Group Discussion

Deploy and Test

Once you have everything working, deploy your code to your hosting server and verify that it works there.

Submission

Once you have finished this activity, return to Canvas to submit a quiz.

Other Links: