Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Commit

Permalink
Split Name field into Surname and Forename
Browse files Browse the repository at this point in the history
In this commit, the `Name` field in various classes and functions across multiple files (`Entity.cs`, `Info.tsx`, `Setting.tsx`, `Persona.tsx`, `Get.ts`, `Entity.ts`) has been replaced with `Surname` and `Forename` fields. This change in the data structure splits the name into two separate fields.

In `Entity.cs`, an `Include` statement has been added to include the `User` in the query result when fetching comments. The display of the name in the `Label` and `ToastBody` components in `Info.tsx` and `Setting.tsx` has been updated to display the `Surname` followed by the `Forename`.

In `Get.ts`, the `User` field in the `AdminOrderGet` class and the `Name` field in the `AdminUserGet` class have been replaced with `Forename`. The `name` variable in the `OrderGet` class is now assigned the value of `user.Forename` instead of `user.Name`.

Finally, in `Entity.ts`, the `AdminUserEntity` class has been updated to version `0.2.0` and the `Name` field has been replaced with `Surname` and `Forename`.
  • Loading branch information
Aloento committed Mar 4, 2024
1 parent ac66bb3 commit e300429
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions SoarCraft.AwaiShop/Hub/Order/Entity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ public async Task<dynamic> OrderEntity(uint key, uint? version) {

return await this.Db.Comments
.Where(x => x.CommentId == key && x.Order.UserId == this.UserId)
.Include(x => x.User)
.Select(x => new {
x.Content,
x.User!.Forename,
Expand Down
2 changes: 1 addition & 1 deletion src/Components/Order/Info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export function OrderInfo({ OrderId, Admin, ParentLog }: IOrderComp) {
<div className={style.flex}>
<div className={style.box}>
<Field label="Name" size="large">
<Label>{data?.Name}</Label>
<Label>{data?.Surname}, {data?.Forename}</Label>
</Field>
</div>

Expand Down
2 changes: 1 addition & 1 deletion src/Components/Setting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export function Setting({ Open, Toggle, New }: ISetting) {
<Toast>
<ToastTitle>Info {New ? "Created" : "Updated"}</ToastTitle>
<ToastBody>
{req.Name}
{req.Surname}, {req.Forename}
<br />
{req.Phone}
<br />
Expand Down
1 change: 0 additions & 1 deletion src/Components/ShopCart/Persona.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const useStyles = makeStyles({
* @version 0.2.0
*/
export interface IPersona {
Name: string;
Surname: string;
Forename: string;
Phone: string;
Expand Down
2 changes: 1 addition & 1 deletion src/ShopNet/Admin/Order/Get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export abstract class AdminOrderGet extends AdminNet {
Status: order.Status,
TrackNumber: order.TrackingNumber,
OrderDate: order.CreateAt,
User: user.Name,
User: user.Forename,
});
}

Expand Down
7 changes: 4 additions & 3 deletions src/ShopNet/Admin/User/Entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ export abstract class AdminUserEntity extends AdminNet {
/**
* @author Aloento
* @since 1.0.0
* @version 0.1.0
* @version 0.2.0
*/
public static User(key: string): Promise<({
Name: string;
Surname: string;
Forename: string;
EMail: string;
Phone: string;
Address: string;
Admin?: boolean;
} & IConcurrency) | void> {
} & IConcurrency)> {
this.EnsureLogin();
return this.GetVersionCache(key, "UserEntity");
}
Expand Down
2 changes: 1 addition & 1 deletion src/ShopNet/Admin/User/Get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export abstract class AdminUserGet extends AdminNet {

res.push({
Id: userId,
Name: user.Name,
Name: `${user.Surname}, ${user.Forename}`,
EMail: user.EMail,
Admin: user.Admin,
});
Expand Down
2 changes: 1 addition & 1 deletion src/ShopNet/Order/Get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ export abstract class OrderGet extends OrderEntity {
const user = await AdminUserEntity.User(cmt.UserId);

if (user)
name = user.Name;
name = user.Forename;
else
log.warn(`[Mismatch] User ${cmt.UserId} not found. Order : ${orderId}`);
}
Expand Down

0 comments on commit e300429

Please sign in to comment.