Skip to content

Commit

Permalink
feat: ✨ (api/user) user に isDiscloseAsOwner を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
dino3616 committed Feb 3, 2024
1 parent 2f08037 commit e5a7ba8
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import { IsEmail, IsUUID, IsUrl, MaxLength } from 'class-validator';
import type { User } from '#api/module/user/domain/user.model';

@InputType()
export class UserCreateInput implements Omit<User, 'id' | 'hashedFingerprintId' | 'lostAndFoundState' | 'createdAt' | 'isOnTheWay'> {
export class UserCreateInput
implements Omit<User, 'id' | 'hashedFingerprintId' | 'lostAndFoundState' | 'isDiscloseAsOwner' | 'createdAt' | 'isOnTheWay'>
{
@Field(() => String, { nullable: false })
@IsUUID()
authId!: string;
Expand Down
3 changes: 3 additions & 0 deletions apps/api/src/module/user/controller/dto/object/user.object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ export class UserObject implements Omit<User, 'hashedFingerprintId' | 'isOnTheWa
@IsUrl()
avatarUrl!: string;

@Field(() => Boolean, { nullable: false })
isDiscloseAsOwner!: boolean;

@Field(() => Date, { nullable: false })
createdAt!: Date;
}
15 changes: 14 additions & 1 deletion apps/api/src/module/user/domain/user.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,29 @@ export class User {

readonly avatarUrl: string;

readonly isDiscloseAsOwner: boolean;

readonly createdAt: Date;

constructor({ id, authId, hashedFingerprintId, name, email, lostAndFoundState, avatarUrl, createdAt }: Omit<User, 'isOnTheWay'>) {
constructor({
id,
authId,
hashedFingerprintId,
name,
email,
lostAndFoundState,
avatarUrl,
isDiscloseAsOwner,
createdAt,
}: Omit<User, 'isOnTheWay'>) {
this.id = id;
this.authId = authId;
this.hashedFingerprintId = hashedFingerprintId;
this.name = name;
this.email = email;
this.lostAndFoundState = lostAndFoundState;
this.avatarUrl = avatarUrl;
this.isDiscloseAsOwner = isDiscloseAsOwner;
this.createdAt = createdAt;
}

Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/module/user/repository/user.repository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export interface UserRepositoryInterface {
findByReportedLostItemId(reportedLostItemId: LostItem['id']): Promise<User | null>;
findByOwnedLostItemId(ownedLostItemId: LostItem['id']): Promise<User | null>;
findMany(userIds: User['id'][]): Promise<User[]>;
create(user: Omit<User, 'id' | 'hashedFingerprintId' | 'lostAndFoundState' | 'createdAt' | 'isOnTheWay'>): Promise<User>;
create(user: Omit<User, 'id' | 'hashedFingerprintId' | 'lostAndFoundState' | 'isDiscloseAsOwner' | 'createdAt' | 'isOnTheWay'>): Promise<User>;
update(userId: User['id'], user: Partial<Omit<User, 'id' | 'authId' | 'createdAt' | 'isOnTheWay'>>): Promise<User>;
updateByAuthId(authId: User['authId'], user: Partial<Omit<User, 'id' | 'authId' | 'createdAt' | 'isOnTheWay'>>): Promise<User>;
updateByHashedFingerprintId(
Expand Down
2 changes: 1 addition & 1 deletion apps/api/src/module/user/use-case/user.use-case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ import type { User } from '#api/module/user/domain/user.model';
export interface UserUseCaseInterface {
findUser(authId: User['authId']): Promise<User | null>;
findUserByHashedFingerprintId(hashedFingerprintId: NonNullable<User['hashedFingerprintId']>): Promise<User | null>;
createUser(user: Omit<User, 'id' | 'hashedFingerprintId' | 'lostAndFoundState' | 'createdAt' | 'isOnTheWay'>): Promise<User>;
createUser(user: Omit<User, 'id' | 'hashedFingerprintId' | 'lostAndFoundState' | 'isDiscloseAsOwner' | 'createdAt' | 'isOnTheWay'>): Promise<User>;
relateFingerprintWithUser(authId: User['authId'], hashedFingerprintId: NonNullable<User['hashedFingerprintId']>): Promise<User>;
}
16 changes: 16 additions & 0 deletions apps/locker-dashboard/graphql.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,22 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "isDiscloseAsOwner",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "lostAndFoundState",
"description": null,
Expand Down
16 changes: 16 additions & 0 deletions apps/website/graphql.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1072,6 +1072,22 @@
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "isDiscloseAsOwner",
"description": null,
"args": [],
"type": {
"kind": "NON_NULL",
"name": null,
"ofType": {
"kind": "SCALAR",
"name": "Boolean",
"ofType": null
}
},
"isDeprecated": false,
"deprecationReason": null
},
{
"name": "lostAndFoundState",
"description": null,
Expand Down

0 comments on commit e5a7ba8

Please sign in to comment.