team02 : Team Project: Spring Boot Backend, part 2 (authenticated CRUD)

num ready? description assigned MW lect due MW lect assigned TR lect due TR lect
team02 true Team Project: Spring Boot Backend, part 2 (authenticated CRUD) Mon 01/31 12:30PM Tue 02/08 11:59PM

In this team project, our starter code has a full frontend and backend, however we are still focusing only on the backend part, learning these new concepts:

In addition, we’ll practice further with a few concepts that we touched on in jpa03, but may not have fully fleshed out:

Finally, we’ll start practicing with a Kanban Board, which is a basic tool used by many software development organizations.

What you’ll do: Process

From a process standpoint, you are working with a Kanban board.

Here’s how that will play out in detail:

  1. You’ll start by claming your team’s team02-teamname repo, and setting up a Kanban board for it.
  2. Next, you’ll create a Kanban board with columns: Todo, In Progress, In Review, Done
  3. You’ll then populate the Todo column with a set of tasks, which are called Issues in the GitHub implementation of Kanban.
  4. You’ll then assign those tasks to members of the team, moving them into the “In Progress” as each task is assigned.
    • You may assign tasks either to individuals, pairs, or even larger groups (so-called “mobs”, as in Mob Programming)
    • But be sure that if you assign a task to more than one person, that each member of the pair or mob is legitimately committed to contributing to working on the task, and committed to getting it finished.
  5. Once a pull request is complete for a given task, you move it into the In Review column
    • At this stage, you seek a code review from a member of the team that was not involved in the coding.
    • If it was a true “all-team mob”, than it’s fine to get a code review from someone that participated, but this is rare.
    • Also, at this stage, if the PR is not “green on CI”, meaning that all of the GitHub actions scripts show green checks, this is when you should address that, before merging the pull request.
  6. Only when the PR is merged does the issue get moved into the done column.

What you’ll do: Content/Product

From a high-level standpoint, you’ll be doing these things:

Set up Tasks:

Coding Tasks:

In the next assignment, we’ll turn to the front end, and put a front end for CRUD operations on all three of those tables.

Getting started

To get started:

Then, you’ll manually run a GitHub workflow to populate a Kanban board with issues. Here’s what that looks like.

First, you need to go to the Actions tab:

Click the button to enable actions.

Next you’ll see this list of actions. You want to select “Create Issue from File”

You’ll then see that this action can be triggered manually. Click Run Workflow to trigger the action:

You’ll see that the workflow is running:

As it runs, issues will appear under the issues tab, and a project will appear under the project tab. When completed, you should have 1 Project (i.e. a Kanban board), and 18 issues:

Next, go to the Projects tab, and view your Kanban board; to find it you’ll need to bypass the new Projects Beta, and go to the old Projects interface. It’s the place that says “Projects 1” in the left navigation:

There you should see a project called Team02. Click on that:

This, finally is your Kanban board:

Click to add three new columns. The first is called “In Progress”

Then, add columns for “In Review” and “Done” to the right:

Four columns

Implement CRUD operations for a database table

We’ll start with the example of adding a table for University Subreddits

In team01, one of the endpoints served up an API for looking up a list of University Subreddits by reading a CSV file from a GitHub repo on the web, parsing it, and serving it up in JSON.

It used the code in the java file CollegeSubredditQueryService to accomplish this.

However, the implementation of this service, while relatively simple, uses a rather inefficient appraoch. In particular, each call to this service:

Given how slowly this data changes, it seems more effici`ent to load this data once, and then serve it up on subsequent requests.

For this, we can use an SQL database table.

If you haven’t worked with SQL database tables before, think of each database table as if it is a spreadsheet with rows and columns.

So, for example, the table might look like this:

id name location subreddit
1 Aberystwyth University Aberystwyth, Wales, United Kingdom Aberystwyth
2 Acadia University Wolfville, Nova Scotia, Canada AcadiaU
3 Algonquin College Ottawa, Ontario, Canada Algonquin_College
4 Amarillo College Amarillo, Texas, United States amarillocollege

Note that while the id values start out from 1 and are consecutive integers, if we were to delete row 2 and then readd it to the table, the resulting table would look like this; numbers typically don’t get reused.

id name location subreddit
1 Aberystwyth University Aberystwyth, Wales, United Kingdom Aberystwyth
3 Algonquin College Ottawa, Ontario, Canada Algonquin_College
4 Amarillo College Amarillo, Texas, United States amarillocollege
5 Acadia University Wolfville, Nova Scotia, Canada AcadiaU

As an aside: you may wonder what happens when we run out of numbers. Since these id numbers are typically stored in a 64-bit Java Long, the maximum number is: 9,223,372,036,854,775,807L.

To add an SQL database table in Spring Boot, you typically add two files:

There is more information in the issues on the Kanban board to guide you through the rest of the process.

More Hints

We may add more hints about working with the team02 code as we discover what problems studnets run into.

In the meantime, use the

A note about open source

Note that this assignment is open source.

The repos are public on purpose.

This isn’t hard. You all know when you are are looking at other team’s work to try to learn, versus when you are just looking at it as a shortcut to learning.

I’m trusting you to do the right thing. This is practice for when, later on, you are all working on different assignments.

Clarifications

For the issue “Set up docs”

Note that step 1 says:

Make a new branch xy-setup-docs where xy are your intials.

To clarify: that is a new branch on yoru team02 repo, not the team02-docs or team02-docs-qa repos.

The same goes for pretty much all of the instructions: you are editing the team repo.