Repository navigation
feat(api): add donor profile, API and temporary screen - #91
Open
MarcAntoineGmd wants to merge 1 commit into
Open
MarcAntoineGmd wants to merge 1 commit into
MarcAntoineGmd wants to merge 1 commit into
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #63
Overview
The goal of this ticket is to complete the donor profile so a donor can be created, viewed and edited, with what is needed to identify them now and to issue their tax receipt later (#83, #84). It adds the profile columns, an API to create, read and update a donor, server-side validation, and a temporary profile screen in the desktop app.
donors: the table already existed (#15). It keeps
name,address(now the street address),postal_code,contact_personandcreated_at, and gets:type(varchar(20), not null):individualororganization, checked byck_donors_type. An individual and an organization are named differently on a receipt.city(varchar(100)) andprovince(varchar(50))email(varchar(254)),phone(varchar(30)) andnotes(text)business_central_code(varchar(50)): unique throughix_donors_business_central_code, and not empty when set (ck_donors_business_central_code_not_empty). Many donors can have no code. The comparison is exact, like the catalog code, soC-100andc-100are two codes.updated_at(timestamptz, stored in UTC): empty until the donor is editedRequired fields: the API requires name, type, street address, city, province and postal code. In the database only
nameandtypeare not null, so the donors that already exist and the donors brought in by the Business Central import (#78) are not blocked by a missing address.Existing donors: the migration gives them the type
organization, then removes the default, so a new donor must state its type. This step is written by hand in the migration, with an XML note to keep it if the migration is regenerated. Their city, province and other new columns stay empty, to complete by hand. In code, aDonorcreated without a type is an organization, which keeps the existing tests that create donors unchanged. The API always requires the type.API (
api/donors):api/donors/{id}api/donorsManageDonors: Supply, Supply Director, Adminapi/donors/{id}ManageDonors: Supply, Supply Director, AdminTemporary screen: the Donors page of the desktop app opens a donor by its id, creates a donor and edits it. Each message from the API is shown under its field, and 404, 409, 401 and 403 each show their own message. The desktop app does not sign in yet (#9 is not merged), so every call shows "You must be signed in to manage donors" until it is.
Changes:
Donorentity: new properties and maximum lengths, andDonorTypes(individual, organization) insrc/MoissonMontreal.Core/Entities/DonorRequestandDonorDtoinsrc/MoissonMontreal.Core/Dtos/DonorConfiguration: new columns, checks and the unique Business Central codeDonorValidatorinsrc/MoissonMontreal.Api/Donors/andDonorsController20261118185010_AddDonorProfileand the snapshotIApiClient,ApiClient,FakeApiClient,DonorResult,DonorsViewModel,DonorsView,DesignData, andMainViewModelnow passes the API client to the donors pagedocs/database/donors.md,donors.dbmlandimages/donors.pngdocs/database/sql/0007_add_donor_profile.sql, generated from the migration, without BOMschema.dbml,receipts.dbml,prices.dbmlandquality-classes.dbml, with their images re-exportedschema.md: donors section, rules and migration tableSchemaDriftTests: the "missing default" case now includes the newupdated_atline of donors, since it searches the exact text aroundcreated_atTesting:
dotnet test: 435 tests pass, 80 of them newDonorValidatorTests(43):individualororganizationis refused, includingOrganizationandINDIVIDUALDonorEndpointTests(25):DonorProfileMigrationTests(12):updated_atis saved in UTCck_donors_type,ck_donors_business_central_code_not_empty,ix_donors_business_central_codecompany, with an empty code, or with a code already used was refused by the expected ruleC-1andc-1, were accepted