28 Commits

Author SHA1 Message Date
44f88e8e61 Update Rust crate serde to 1.0.189
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing
2023-10-14 00:06:50 +00:00
9a3914660f Update dockage/mailcatcher Docker tag to v0.9.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-11 00:26:36 +00:00
961b4b07c4 Update dependency @mui/x-data-grid to v6.13.0
All checks were successful
continuous-integration/drone/push Build is passing
2023-09-10 01:09:27 +00:00
0f6c68b1fc Update Rust crate tempfile to 3.8.0
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is failing
2023-09-10 00:27:25 +00:00
b528e6fdbb Update dependency react-easy-crop to v5.0.2
All checks were successful
continuous-integration/drone/push Build is passing
2023-09-09 01:02:50 +00:00
2018174ed5 Update dependency @mui/x-tree-view to v6.0.0-alpha.2
Some checks failed
continuous-integration/drone/pr Build is failing
continuous-integration/drone/push Build is failing
2023-09-09 00:26:01 +00:00
935deeca2c Switch tree view to its new package
All checks were successful
continuous-integration/drone/push Build is passing
2023-09-08 11:28:24 +02:00
8ac79020d6 Update Rust crate diesel to 2.1.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-08 00:31:35 +00:00
c1972c7930 Update dependency react-easy-crop to v5.0.1
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-07 00:24:24 +00:00
f686003f19 Update dependency @mui/material to v5.14.8
All checks were successful
continuous-integration/drone/push Build is passing
2023-09-06 01:20:18 +00:00
42a494a15b Update dependency @mui/lab to v5.0.0-alpha.143
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is failing
2023-09-06 00:35:11 +00:00
faa668550c Update Rust crate clap to 4.4.2
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-05 00:35:43 +00:00
cb797074cb Update Rust crate actix-web to 4.4.0
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-04 00:32:51 +00:00
ede195ce57 Update dependency filesize to v10.0.12
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-03 00:26:40 +00:00
7f0ea4f04c Update Rust crate redis to 0.23.3
All checks were successful
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is passing
2023-09-02 00:27:12 +00:00
49d27e5849 Update dependency @types/node to v16.18.46
All checks were successful
continuous-integration/drone/push Build is passing
2023-09-01 01:17:31 +00:00
03b9dfc60a Update dependency @mui/material to v5.14.7
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is failing
2023-09-01 00:35:31 +00:00
433f8384a0 Emphasis missing mother and father
All checks were successful
continuous-integration/drone/push Build is passing
2023-08-31 20:39:17 +02:00
2c0b6356b6 Fix bug 2023-08-31 20:36:33 +02:00
c6c984c34c Handle particular cases in simple family tree
All checks were successful
continuous-integration/drone/push Build is passing
2023-08-31 20:26:34 +02:00
c84fb50087 Fix type declaration issue 2023-08-31 20:14:36 +02:00
79ce616781 Show a feedback when saving couple information
All checks were successful
continuous-integration/drone/push Build is passing
2023-08-31 19:30:16 +02:00
e4a1817d7f Simplify navigation to set member photo 2023-08-31 19:27:14 +02:00
2a69c89065 Automatically trim values before saving 2023-08-31 19:23:21 +02:00
0899835fab Update dependency @mui/lab to v5.0.0-alpha.142
All checks were successful
continuous-integration/drone/push Build is passing
2023-08-31 00:58:23 +00:00
cf5848491b Update dependency @fontsource/roboto to v5.0.8
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is failing
2023-08-31 00:26:52 +00:00
33748e3233 Update Rust crate thiserror to 1.0.47
All checks were successful
continuous-integration/drone/push Build is passing
2023-08-30 00:55:47 +00:00
cc0b6a2547 Update Rust crate actix-multipart to 0.6.1
Some checks failed
continuous-integration/drone/pr Build is passing
continuous-integration/drone/push Build is failing
2023-08-30 00:26:46 +00:00
12 changed files with 3803 additions and 1347 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -13,6 +13,7 @@
"@mui/lab": "^5.0.0-alpha.140", "@mui/lab": "^5.0.0-alpha.140",
"@mui/material": "^5.14.5", "@mui/material": "^5.14.5",
"@mui/x-data-grid": "^6.9.2", "@mui/x-data-grid": "^6.9.2",
"@mui/x-tree-view": "^6.0.0-alpha.1",
"@testing-library/jest-dom": "^5.16.5", "@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^13.4.0", "@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0", "@testing-library/user-event": "^13.5.0",

View File

@@ -25,6 +25,7 @@ import { MemberInput } from "../../widgets/forms/MemberInput";
import { PropSelect } from "../../widgets/forms/PropSelect"; import { PropSelect } from "../../widgets/forms/PropSelect";
import { UploadPhotoButton } from "../../widgets/forms/UploadPhotoButton"; import { UploadPhotoButton } from "../../widgets/forms/UploadPhotoButton";
import { useQuery } from "../../hooks/useQuery"; import { useQuery } from "../../hooks/useQuery";
import { useLoadingMessage } from "../../hooks/context_providers/LoadingMessageProvider";
/** /**
* Create a new couple route * Create a new couple route
@@ -165,7 +166,8 @@ export function FamilyEditCoupleRoute(): React.ReactElement {
const cancel = () => { const cancel = () => {
setShouldQuit(true); setShouldQuit(true);
n(-1); n(family.family.coupleURL(couple!));
//n(-1);
}; };
const save = async (c: Couple) => { const save = async (c: Couple) => {
@@ -210,13 +212,14 @@ export function CouplePage(p: {
shouldAllowLeaving?: boolean; shouldAllowLeaving?: boolean;
children?: Member[]; children?: Member[];
onCancel?: () => void; onCancel?: () => void;
onSave?: (m: Couple) => void; onSave?: (m: Couple) => Promise<void>;
onRequestEdit?: () => void; onRequestEdit?: () => void;
onRequestDelete?: () => void; onRequestDelete?: () => void;
onForceReload?: () => void; onForceReload?: () => void;
}): React.ReactElement { }): React.ReactElement {
const confirm = useConfirm(); const confirm = useConfirm();
const snackbar = useSnackbar(); const snackbar = useSnackbar();
const loadingMessage = useLoadingMessage();
const family = useFamily(); const family = useFamily();
@@ -230,8 +233,12 @@ export function CouplePage(p: {
setCouple(new Couple(structuredClone(couple))); setCouple(new Couple(structuredClone(couple)));
}; };
const save = () => { const save = async () => {
p.onSave!(couple); loadingMessage.show(
"Enregistrement des informations du couple en cours..."
);
await p.onSave!(couple);
loadingMessage.hide();
}; };
const cancel = async () => { const cancel = async () => {

View File

@@ -39,6 +39,7 @@ import { UploadPhotoButton } from "../../widgets/forms/UploadPhotoButton";
import { useQuery } from "../../hooks/useQuery"; import { useQuery } from "../../hooks/useQuery";
import { mdiFamilyTree } from "@mdi/js"; import { mdiFamilyTree } from "@mdi/js";
import Icon from "@mdi/react"; import Icon from "@mdi/react";
import { useLoadingMessage } from "../../hooks/context_providers/LoadingMessageProvider";
/** /**
* Create a new member route * Create a new member route
@@ -185,8 +186,8 @@ export function FamilyEditMemberRoute(): React.ReactElement {
const cancel = () => { const cancel = () => {
setShouldQuit(true); setShouldQuit(true);
//n(family.family.URL(`member/${member!.id}`)); n(family.family.memberURL(member!));
n(-1); //n(-1);
}; };
const save = async (m: Member) => { const save = async (m: Member) => {
@@ -233,7 +234,7 @@ export function MemberPage(p: {
siblings?: Member[]; siblings?: Member[];
couples?: Couple[]; couples?: Couple[];
onCancel?: () => void; onCancel?: () => void;
onSave?: (m: Member) => void; onSave?: (m: Member) => Promise<void>;
onRequestEdit?: () => void; onRequestEdit?: () => void;
onRequestDelete?: () => void; onRequestDelete?: () => void;
onForceReload?: () => void; onForceReload?: () => void;
@@ -241,6 +242,7 @@ export function MemberPage(p: {
}): React.ReactElement { }): React.ReactElement {
const confirm = useConfirm(); const confirm = useConfirm();
const snackbar = useSnackbar(); const snackbar = useSnackbar();
const loadingMessage = useLoadingMessage();
const family = useFamily(); const family = useFamily();
@@ -254,8 +256,12 @@ export function MemberPage(p: {
setMember(new Member(structuredClone(member))); setMember(new Member(structuredClone(member)));
}; };
const save = () => { const save = async () => {
p.onSave!(member); loadingMessage.show(
"Enregistrement des informations du membre en cours..."
);
await p.onSave!(member);
loadingMessage.hide();
}; };
const cancel = async () => { const cancel = async () => {

View File

@@ -4,7 +4,7 @@ import EditIcon from "@mui/icons-material/Edit";
import FemaleIcon from "@mui/icons-material/Female"; import FemaleIcon from "@mui/icons-material/Female";
import MaleIcon from "@mui/icons-material/Male"; import MaleIcon from "@mui/icons-material/Male";
import VisibilityIcon from "@mui/icons-material/Visibility"; import VisibilityIcon from "@mui/icons-material/Visibility";
import { Button, TextField, Tooltip } from "@mui/material"; import { Button, TextField, Tooltip, Typography } from "@mui/material";
import { DataGrid, GridActionsCellItem, GridColDef } from "@mui/x-data-grid"; import { DataGrid, GridActionsCellItem, GridColDef } from "@mui/x-data-grid";
import React from "react"; import React from "react";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
@@ -165,7 +165,8 @@ function MembersTable(p: {
headerName: "Père", headerName: "Père",
flex: 5, flex: 5,
renderCell(params) { renderCell(params) {
if (!params.row.father) return <></>; if (!params.row.father)
return <Typography color="red">Non renseigné</Typography>;
return family.members.get(params.row.father)!.fullName; return family.members.get(params.row.father)!.fullName;
}, },
}, },
@@ -174,7 +175,8 @@ function MembersTable(p: {
headerName: "Mère", headerName: "Mère",
flex: 5, flex: 5,
renderCell(params) { renderCell(params) {
if (!params.row.mother) return <></>; if (!params.row.mother)
return <Typography color="red">Non renseignée</Typography>;
return family.members.get(params.row.mother)!.fullName; return family.members.get(params.row.mother)!.fullName;
}, },
}, },

View File

@@ -2,7 +2,7 @@ import { mdiBabyCarriage, mdiCross } from "@mdi/js";
import Icon from "@mdi/react"; import Icon from "@mdi/react";
import ChevronRightIcon from "@mui/icons-material/ChevronRight"; import ChevronRightIcon from "@mui/icons-material/ChevronRight";
import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
import { TreeItem, TreeView } from "@mui/lab"; import { TreeItem, TreeView } from "@mui/x-tree-view";
import React from "react"; import React from "react";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { Couple } from "../api/CoupleApi"; import { Couple } from "../api/CoupleApi";

View File

@@ -254,6 +254,7 @@ function NodeArea(p: {
let pers2 = p.node.spouse?.member; let pers2 = p.node.spouse?.member;
let didSwap = false; let didSwap = false;
// Show male of the left (all the time)
if (pers2?.sex === "M") { if (pers2?.sex === "M") {
let s = pers1; let s = pers1;
pers1 = pers2; pers1 = pers2;
@@ -293,10 +294,37 @@ function NodeArea(p: {
let childrenLinkX: number; let childrenLinkX: number;
let childrenLinkY: number; let childrenLinkY: number;
if (p.node.spouse) { // If the father is the father of all the children, while the
// mother is not the mother of any of the children
if (
pers2 &&
p.node.down.every(
(n) => n.member.father === pers1.id && n.member.mother !== pers2!.id
)
) {
childrenLinkX = parent_x_offset + Math.floor(memberCardWidth(pers1) / 2);
childrenLinkY = p.y + CARD_HEIGHT + 2;
}
// If the mother is the mother of all the children, while the
// father is not the father of any of the children
else if (
pers2 &&
p.node.down.every(
(n) => n.member.father !== pers1.id && n.member.mother === pers2!.id
)
) {
childrenLinkX = beginSecondFaceX! + Math.floor(memberCardWidth(pers2) / 2);
childrenLinkY = p.y + CARD_HEIGHT + 2;
}
// Normal couple
else if (p.node.spouse) {
childrenLinkX = Math.floor((endFirstFaceX + beginSecondFaceX!) / 2); childrenLinkX = Math.floor((endFirstFaceX + beginSecondFaceX!) / 2);
childrenLinkY = middleParentFaceY; childrenLinkY = middleParentFaceY;
} else { }
// Single person
else {
childrenLinkX = parent_x_offset + Math.floor(memberCardWidth(pers1) / 2); childrenLinkX = parent_x_offset + Math.floor(memberCardWidth(pers1) / 2);
childrenLinkY = p.y + CARD_HEIGHT + 2; childrenLinkY = p.y + CARD_HEIGHT + 2;
} }

View File

@@ -36,9 +36,9 @@ dependencies = [
[[package]] [[package]]
name = "actix-http" name = "actix-http"
version = "3.3.1" version = "3.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2079246596c18b4a33e274ae10c0e50613f4d32a4198e09c7b93771013fed74" checksum = "a92ef85799cba03f76e4f7c10f533e66d87c9a7e7055f3391f09000ad8351bc9"
dependencies = [ dependencies = [
"actix-codec", "actix-codec",
"actix-rt", "actix-rt",
@@ -46,7 +46,7 @@ dependencies = [
"actix-utils", "actix-utils",
"ahash 0.8.3", "ahash 0.8.3",
"base64 0.21.2", "base64 0.21.2",
"bitflags 1.3.2", "bitflags 2.3.3",
"brotli", "brotli",
"bytes", "bytes",
"bytestring", "bytestring",
@@ -85,9 +85,9 @@ dependencies = [
[[package]] [[package]]
name = "actix-multipart" name = "actix-multipart"
version = "0.6.0" version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dee489e3c01eae4d1c35b03c4493f71cb40d93f66b14558feb1b1a807671cc4e" checksum = "3b960e2aea75f49c8f069108063d12a48d329fc8b60b786dfc7552a9d5918d2d"
dependencies = [ dependencies = [
"actix-multipart-derive", "actix-multipart-derive",
"actix-utils", "actix-utils",
@@ -110,15 +110,15 @@ dependencies = [
[[package]] [[package]]
name = "actix-multipart-derive" name = "actix-multipart-derive"
version = "0.6.0" version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2ec592f234db8a253cf80531246a4407c8a70530423eea80688a6c5a44a110e7" checksum = "0a0a77f836d869f700e5b47ac7c3c8b9c8bc82e4aec861954c6198abee3ebd4d"
dependencies = [ dependencies = [
"darling 0.14.4", "darling",
"parse-size", "parse-size",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 1.0.109", "syn 2.0.29",
] ]
[[package]] [[package]]
@@ -168,7 +168,7 @@ dependencies = [
"futures-util", "futures-util",
"mio", "mio",
"num_cpus", "num_cpus",
"socket2", "socket2 0.4.9",
"tokio", "tokio",
"tracing", "tracing",
] ]
@@ -196,9 +196,9 @@ dependencies = [
[[package]] [[package]]
name = "actix-web" name = "actix-web"
version = "4.3.1" version = "4.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cd3cb42f9566ab176e1ef0b8b3a896529062b4efc6be0123046095914c4c1c96" checksum = "0e4a5b5e29603ca8c94a77c65cf874718ceb60292c5a5c3e5f4ace041af462b9"
dependencies = [ dependencies = [
"actix-codec", "actix-codec",
"actix-http", "actix-http",
@@ -209,7 +209,7 @@ dependencies = [
"actix-service", "actix-service",
"actix-utils", "actix-utils",
"actix-web-codegen", "actix-web-codegen",
"ahash 0.7.6", "ahash 0.8.3",
"bytes", "bytes",
"bytestring", "bytestring",
"cfg-if", "cfg-if",
@@ -218,7 +218,6 @@ dependencies = [
"encoding_rs", "encoding_rs",
"futures-core", "futures-core",
"futures-util", "futures-util",
"http",
"itoa", "itoa",
"language-tags", "language-tags",
"log", "log",
@@ -230,7 +229,7 @@ dependencies = [
"serde_json", "serde_json",
"serde_urlencoded", "serde_urlencoded",
"smallvec", "smallvec",
"socket2", "socket2 0.5.3",
"time", "time",
"url", "url",
] ]
@@ -337,16 +336,15 @@ dependencies = [
[[package]] [[package]]
name = "anstream" name = "anstream"
version = "0.3.2" version = "0.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163" checksum = "b1f58811cfac344940f1a400b6e6231ce35171f614f26439e80f8c1465c5cc0c"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"anstyle-parse", "anstyle-parse",
"anstyle-query", "anstyle-query",
"anstyle-wincon", "anstyle-wincon",
"colorchoice", "colorchoice",
"is-terminal",
"utf8parse", "utf8parse",
] ]
@@ -376,9 +374,9 @@ dependencies = [
[[package]] [[package]]
name = "anstyle-wincon" name = "anstyle-wincon"
version = "1.0.1" version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188" checksum = "58f54d10c6dfa51283a066ceab3ec1ab78d13fae00aa49243a45e4571fb79dfd"
dependencies = [ dependencies = [
"anstyle", "anstyle",
"windows-sys", "windows-sys",
@@ -651,20 +649,19 @@ dependencies = [
[[package]] [[package]]
name = "clap" name = "clap"
version = "4.3.10" version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "384e169cc618c613d5e3ca6404dda77a8685a63e08660dcc64abaf7da7cb0c7a" checksum = "6a13b88d2c62ff462f88e4a121f17a82c1af05693a2f192b5c38d14de73c19f6"
dependencies = [ dependencies = [
"clap_builder", "clap_builder",
"clap_derive", "clap_derive",
"once_cell",
] ]
[[package]] [[package]]
name = "clap_builder" name = "clap_builder"
version = "4.3.10" version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ef137bbe35aab78bdb468ccfba75a5f4d8321ae011d34063770780545176af2d" checksum = "2bb9faaa7c2ef94b2743a21f5a29e6f0010dff4caa69ac8e9d6cf8b6fa74da08"
dependencies = [ dependencies = [
"anstream", "anstream",
"anstyle", "anstyle",
@@ -674,9 +671,9 @@ dependencies = [
[[package]] [[package]]
name = "clap_derive" name = "clap_derive"
version = "4.3.2" version = "4.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8cd2b2a819ad6eec39e8f1d6b53001af1e5469f8c177579cdaeb313115b825f" checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873"
dependencies = [ dependencies = [
"heck", "heck",
"proc-macro2", "proc-macro2",
@@ -849,38 +846,14 @@ dependencies = [
"memchr", "memchr",
] ]
[[package]]
name = "darling"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b750cb3417fd1b327431a470f388520309479ab0bf5e323505daf0290cd3850"
dependencies = [
"darling_core 0.14.4",
"darling_macro 0.14.4",
]
[[package]] [[package]]
name = "darling" name = "darling"
version = "0.20.3" version = "0.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e" checksum = "0209d94da627ab5605dcccf08bb18afa5009cfbef48d8a8b7d7bdbc79be25c5e"
dependencies = [ dependencies = [
"darling_core 0.20.3", "darling_core",
"darling_macro 0.20.3", "darling_macro",
]
[[package]]
name = "darling_core"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "109c1ca6e6b7f82cc233a97004ea8ed7ca123a9af07a8230878fcfda9b158bf0"
dependencies = [
"fnv",
"ident_case",
"proc-macro2",
"quote",
"strsim",
"syn 1.0.109",
] ]
[[package]] [[package]]
@@ -897,24 +870,13 @@ dependencies = [
"syn 2.0.29", "syn 2.0.29",
] ]
[[package]]
name = "darling_macro"
version = "0.14.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e"
dependencies = [
"darling_core 0.14.4",
"quote",
"syn 1.0.109",
]
[[package]] [[package]]
name = "darling_macro" name = "darling_macro"
version = "0.20.3" version = "0.20.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5"
dependencies = [ dependencies = [
"darling_core 0.20.3", "darling_core",
"quote", "quote",
"syn 2.0.29", "syn 2.0.29",
] ]
@@ -934,9 +896,9 @@ dependencies = [
[[package]] [[package]]
name = "diesel" name = "diesel"
version = "2.1.0" version = "2.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7a532c1f99a0f596f6960a60d1e119e91582b24b39e2d83a190e61262c3ef0c" checksum = "d98235fdc2f355d330a8244184ab6b4b33c28679c0b4158f63138e51d6cf7e88"
dependencies = [ dependencies = [
"bitflags 2.3.3", "bitflags 2.3.3",
"byteorder", "byteorder",
@@ -1494,7 +1456,7 @@ dependencies = [
"httpdate", "httpdate",
"itoa", "itoa",
"pin-project-lite", "pin-project-lite",
"socket2", "socket2 0.4.9",
"tokio", "tokio",
"tower-service", "tower-service",
"tracing", "tracing",
@@ -1698,7 +1660,7 @@ dependencies = [
"nom", "nom",
"once_cell", "once_cell",
"quoted_printable", "quoted_printable",
"socket2", "socket2 0.4.9",
"tokio", "tokio",
] ]
@@ -2292,16 +2254,16 @@ dependencies = [
[[package]] [[package]]
name = "redis" name = "redis"
version = "0.23.2" version = "0.23.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ffd6543a7bc6428396845f6854ccf3d1ae8823816592e2cbe74f20f50f209d02" checksum = "4f49cdc0bb3f412bf8e7d1bd90fe1d9eb10bc5c399ba90973c14662a27b3f8ba"
dependencies = [ dependencies = [
"combine", "combine",
"itoa", "itoa",
"percent-encoding", "percent-encoding",
"ryu", "ryu",
"sha1_smol", "sha1_smol",
"socket2", "socket2 0.4.9",
"url", "url",
] ]
@@ -2548,18 +2510,18 @@ checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed"
[[package]] [[package]]
name = "serde" name = "serde"
version = "1.0.188" version = "1.0.189"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf9e0fcba69a370eed61bcf2b728575f726b50b55cba78064753d708ddc7549e" checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537"
dependencies = [ dependencies = [
"serde_derive", "serde_derive",
] ]
[[package]] [[package]]
name = "serde_derive" name = "serde_derive"
version = "1.0.188" version = "1.0.189"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4eca7ac642d82aa35b60049a6eccb4be6be75e599bd2e9adb5f875a737654af2" checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -2620,7 +2582,7 @@ version = "3.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ea3cee93715c2e266b9338b7544da68a9f24e227722ba482bd1c024367c77c65" checksum = "ea3cee93715c2e266b9338b7544da68a9f24e227722ba482bd1c024367c77c65"
dependencies = [ dependencies = [
"darling 0.20.3", "darling",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.29", "syn 2.0.29",
@@ -2711,6 +2673,16 @@ dependencies = [
"winapi", "winapi",
] ]
[[package]]
name = "socket2"
version = "0.5.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2538b18701741680e0322a2302176d3253a35388e2e62f172f64f4f16605f877"
dependencies = [
"libc",
"windows-sys",
]
[[package]] [[package]]
name = "spin" name = "spin"
version = "0.9.8" version = "0.9.8"
@@ -2762,9 +2734,9 @@ dependencies = [
[[package]] [[package]]
name = "tempfile" name = "tempfile"
version = "3.7.1" version = "3.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc02fddf48964c42031a0b3fe0428320ecf3a73c401040fc0096f97794310651" checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef"
dependencies = [ dependencies = [
"cfg-if", "cfg-if",
"fastrand 2.0.0", "fastrand 2.0.0",
@@ -2795,18 +2767,18 @@ dependencies = [
[[package]] [[package]]
name = "thiserror" name = "thiserror"
version = "1.0.40" version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" checksum = "97a802ec30afc17eee47b2855fc72e0c4cd62be9b4efe6591edde0ec5bd68d8f"
dependencies = [ dependencies = [
"thiserror-impl", "thiserror-impl",
] ]
[[package]] [[package]]
name = "thiserror-impl" name = "thiserror-impl"
version = "1.0.40" version = "1.0.47"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" checksum = "6bb623b56e39ab7dcd4b1b98bb6c8f8d907ed255b18de254088016b27a8ee19b"
dependencies = [ dependencies = [
"proc-macro2", "proc-macro2",
"quote", "quote",
@@ -2880,7 +2852,7 @@ dependencies = [
"parking_lot", "parking_lot",
"pin-project-lite", "pin-project-lite",
"signal-hook-registry", "signal-hook-registry",
"socket2", "socket2 0.4.9",
"windows-sys", "windows-sys",
] ]

View File

@@ -8,24 +8,24 @@ edition = "2021"
[dependencies] [dependencies]
log = "0.4.17" log = "0.4.17"
env_logger = "0.10.0" env_logger = "0.10.0"
clap = { version = "4.3.0", features = ["derive", "env"] } clap = { version = "4.4.2", features = ["derive", "env"] }
lazy_static = "1.4.0" lazy_static = "1.4.0"
anyhow = "1.0.75" anyhow = "1.0.75"
actix-web = "4.3.1" actix-web = "4.4.0"
actix-cors = "0.6.4" actix-cors = "0.6.4"
actix-multipart = "0.6.0" actix-multipart = "0.6.1"
actix-remote-ip = "0.1.0" actix-remote-ip = "0.1.0"
futures-util = "0.3.28" futures-util = "0.3.28"
diesel = { version = "2.0.4", features = ["postgres"] } diesel = { version = "2.1.1", features = ["postgres"] }
serde = { version = "1.0.188", features = ["derive"] } serde = { version = "1.0.189", features = ["derive"] }
serde_json = "1.0.96" serde_json = "1.0.96"
mailchecker = "5.0.9" mailchecker = "5.0.9"
redis = "0.23.2" redis = "0.23.3"
lettre = "0.10.4" lettre = "0.10.4"
rand = "0.8.5" rand = "0.8.5"
bcrypt = "0.15.0" bcrypt = "0.15.0"
light-openid = "1.0.1" light-openid = "1.0.1"
thiserror = "1.0.40" thiserror = "1.0.47"
serde_with = "3.1.0" serde_with = "3.1.0"
rust_iso3166 = "0.1.10" rust_iso3166 = "0.1.10"
rust-s3 = "0.33.0" rust-s3 = "0.33.0"
@@ -35,5 +35,5 @@ uuid = { version = "1.4.1", features = ["v4"] }
httpdate = "1.0.2" httpdate = "1.0.2"
zip = "0.6.6" zip = "0.6.6"
mime_guess = "2.0.4" mime_guess = "2.0.4"
tempfile = "3.7.1" tempfile = "3.8.0"
base64 = "0.21.2" base64 = "0.21.2"

View File

@@ -27,7 +27,7 @@ services:
- ./storage/db:/var/lib/postgresql/data - ./storage/db:/var/lib/postgresql/data
mailcatcher: mailcatcher:
image: dockage/mailcatcher:0.8.2 image: dockage/mailcatcher:0.9.0
ports: ports:
- 1080:1080 - 1080:1080
- 1025:1025 - 1025:1025

View File

@@ -103,8 +103,29 @@ fn check_opt_str_val(
Ok(()) Ok(())
} }
fn trim_opt_val(val: &mut Option<String>) {
if let Some(s) = val {
*val = Some(s.trim().to_string());
}
if val.as_deref() == Some("") {
*val = None;
}
}
impl MemberRequest { impl MemberRequest {
pub async fn to_member(self, member: &mut Member) -> anyhow::Result<()> { pub async fn to_member(mut self, member: &mut Member) -> anyhow::Result<()> {
// Trim values before processing
trim_opt_val(&mut self.first_name);
trim_opt_val(&mut self.last_name);
trim_opt_val(&mut self.birth_last_name);
trim_opt_val(&mut self.email);
trim_opt_val(&mut self.country);
trim_opt_val(&mut self.address);
trim_opt_val(&mut self.city);
trim_opt_val(&mut self.note);
trim_opt_val(&mut self.phone);
let c = StaticConstraints::default(); let c = StaticConstraints::default();
check_opt_str_val( check_opt_str_val(
&self.first_name, &self.first_name,

View File

@@ -6,6 +6,7 @@ diesel::table! {
family_id -> Int4, family_id -> Int4,
wife -> Nullable<Int4>, wife -> Nullable<Int4>,
husband -> Nullable<Int4>, husband -> Nullable<Int4>,
#[max_length = 1]
state -> Nullable<Varchar>, state -> Nullable<Varchar>,
photo_id -> Nullable<Int4>, photo_id -> Nullable<Int4>,
time_create -> Int8, time_create -> Int8,
@@ -23,7 +24,9 @@ diesel::table! {
families (id) { families (id) {
id -> Int4, id -> Int4,
time_create -> Int8, time_create -> Int8,
#[max_length = 30]
name -> Varchar, name -> Varchar,
#[max_length = 7]
invitation_code -> Varchar, invitation_code -> Varchar,
disable_couple_photos -> Bool, disable_couple_photos -> Bool,
} }
@@ -33,16 +36,26 @@ diesel::table! {
members (id) { members (id) {
id -> Int4, id -> Int4,
family_id -> Int4, family_id -> Int4,
#[max_length = 30]
first_name -> Nullable<Varchar>, first_name -> Nullable<Varchar>,
#[max_length = 30]
last_name -> Nullable<Varchar>, last_name -> Nullable<Varchar>,
#[max_length = 30]
birth_last_name -> Nullable<Varchar>, birth_last_name -> Nullable<Varchar>,
photo_id -> Nullable<Int4>, photo_id -> Nullable<Int4>,
#[max_length = 255]
email -> Nullable<Varchar>, email -> Nullable<Varchar>,
#[max_length = 30]
phone -> Nullable<Varchar>, phone -> Nullable<Varchar>,
#[max_length = 155]
address -> Nullable<Varchar>, address -> Nullable<Varchar>,
#[max_length = 150]
city -> Nullable<Varchar>, city -> Nullable<Varchar>,
#[max_length = 12]
postal_code -> Nullable<Varchar>, postal_code -> Nullable<Varchar>,
#[max_length = 2]
country -> Nullable<Varchar>, country -> Nullable<Varchar>,
#[max_length = 1]
sex -> Nullable<Varchar>, sex -> Nullable<Varchar>,
time_create -> Int8, time_create -> Int8,
time_update -> Int8, time_update -> Int8,
@@ -71,11 +84,15 @@ diesel::table! {
diesel::table! { diesel::table! {
photos (id) { photos (id) {
id -> Int4, id -> Int4,
#[max_length = 36]
file_id -> Varchar, file_id -> Varchar,
time_create -> Int8, time_create -> Int8,
#[max_length = 150]
mime_type -> Varchar, mime_type -> Varchar,
#[max_length = 130]
sha512 -> Varchar, sha512 -> Varchar,
file_size -> Int4, file_size -> Int4,
#[max_length = 130]
thumb_sha512 -> Varchar, thumb_sha512 -> Varchar,
} }
} }
@@ -83,12 +100,16 @@ diesel::table! {
diesel::table! { diesel::table! {
users (id) { users (id) {
id -> Int4, id -> Int4,
#[max_length = 30]
name -> Varchar, name -> Varchar,
#[max_length = 255]
email -> Varchar, email -> Varchar,
password -> Nullable<Varchar>, password -> Nullable<Varchar>,
time_create -> Int8, time_create -> Int8,
#[max_length = 150]
reset_password_token -> Nullable<Varchar>, reset_password_token -> Nullable<Varchar>,
time_gen_reset_token -> Int8, time_gen_reset_token -> Int8,
#[max_length = 150]
delete_account_token -> Nullable<Varchar>, delete_account_token -> Nullable<Varchar>,
time_gen_delete_account_token -> Int8, time_gen_delete_account_token -> Int8,
time_activate -> Int8, time_activate -> Int8,