Compare commits
No commits in common. "b92cca773e02c03289c8d423134751621f61c635" and "83e145a93b098013e7294af24260a63c98e780a3" have entirely different histories.
b92cca773e
...
83e145a93b
13 changed files with 76 additions and 70 deletions
|
@ -3,7 +3,6 @@ export interface CreateCommunicationCommand {
|
||||||
isSMSAlarming: boolean;
|
isSMSAlarming: boolean;
|
||||||
mobile: string;
|
mobile: string;
|
||||||
email: string;
|
email: string;
|
||||||
postalCode: string;
|
|
||||||
city: string;
|
city: string;
|
||||||
street: string;
|
street: string;
|
||||||
streetNumber: number;
|
streetNumber: number;
|
||||||
|
@ -18,7 +17,6 @@ export interface UpdateCommunicationCommand {
|
||||||
isSMSAlarming: boolean;
|
isSMSAlarming: boolean;
|
||||||
mobile: string;
|
mobile: string;
|
||||||
email: string;
|
email: string;
|
||||||
postalCode: string;
|
|
||||||
city: string;
|
city: string;
|
||||||
street: string;
|
street: string;
|
||||||
streetNumber: number;
|
streetNumber: number;
|
||||||
|
|
|
@ -25,13 +25,20 @@ export default abstract class CommunicationCommandHandler {
|
||||||
isSMSAlarming: createCommunication.isSMSAlarming,
|
isSMSAlarming: createCommunication.isSMSAlarming,
|
||||||
mobile: createCommunication.mobile,
|
mobile: createCommunication.mobile,
|
||||||
email: createCommunication.email,
|
email: createCommunication.email,
|
||||||
postalCode: createCommunication.postalCode,
|
|
||||||
city: createCommunication.city,
|
city: createCommunication.city,
|
||||||
street: createCommunication.street,
|
street: createCommunication.street,
|
||||||
streetNumber: createCommunication.streetNumber,
|
streetNumber: createCommunication.streetNumber,
|
||||||
streetNumberAddition: createCommunication.streetNumberAddition,
|
streetNumberAddition: createCommunication.streetNumberAddition,
|
||||||
memberId: createCommunication.memberId,
|
member: await dataSource
|
||||||
typeId: createCommunication.typeId,
|
.getRepository(user)
|
||||||
|
.createQueryBuilder("user")
|
||||||
|
.where("id = :id", { id: createCommunication.memberId })
|
||||||
|
.getOneOrFail(),
|
||||||
|
type: await dataSource
|
||||||
|
.getRepository(communicationType)
|
||||||
|
.createQueryBuilder("communication")
|
||||||
|
.where("id = :id", { id: createCommunication.typeId })
|
||||||
|
.getOneOrFail(),
|
||||||
})
|
})
|
||||||
.execute()
|
.execute()
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
|
@ -56,7 +63,6 @@ export default abstract class CommunicationCommandHandler {
|
||||||
isSMSAlarming: updateCommunication.isSMSAlarming,
|
isSMSAlarming: updateCommunication.isSMSAlarming,
|
||||||
mobile: updateCommunication.mobile,
|
mobile: updateCommunication.mobile,
|
||||||
email: updateCommunication.email,
|
email: updateCommunication.email,
|
||||||
postalCode: updateCommunication.postalCode,
|
|
||||||
city: updateCommunication.city,
|
city: updateCommunication.city,
|
||||||
street: updateCommunication.street,
|
street: updateCommunication.street,
|
||||||
streetNumber: updateCommunication.streetNumber,
|
streetNumber: updateCommunication.streetNumber,
|
||||||
|
@ -76,13 +82,13 @@ export default abstract class CommunicationCommandHandler {
|
||||||
* @param DeleteCommunicationCommand
|
* @param DeleteCommunicationCommand
|
||||||
* @returns {Promise<void>}
|
* @returns {Promise<void>}
|
||||||
*/
|
*/
|
||||||
static async delete(deleteCommunication: DeleteCommunicationCommand): Promise<void> {
|
static async delete(deletCommunication: DeleteCommunicationCommand): Promise<void> {
|
||||||
return await dataSource
|
return await dataSource
|
||||||
.createQueryBuilder()
|
.createQueryBuilder()
|
||||||
.delete()
|
.delete()
|
||||||
.from(communication)
|
.from(communication)
|
||||||
.where("id = :id", { id: deleteCommunication.id })
|
.where("id = :id", { id: deletCommunication.id })
|
||||||
.andWhere("memberId = :memberId", { memberId: deleteCommunication.memberId })
|
.andWhere("memberId = :memberId", { memberId: deletCommunication.memberId })
|
||||||
.execute()
|
.execute()
|
||||||
.then(() => {})
|
.then(() => {})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
|
|
|
@ -20,8 +20,16 @@ export default abstract class MemberAwardCommandHandler {
|
||||||
given: createMemberAward.given,
|
given: createMemberAward.given,
|
||||||
note: createMemberAward.note,
|
note: createMemberAward.note,
|
||||||
date: createMemberAward.date,
|
date: createMemberAward.date,
|
||||||
memberId: createMemberAward.memberId,
|
member: await dataSource
|
||||||
awardId: createMemberAward.awardId,
|
.getRepository(member)
|
||||||
|
.createQueryBuilder("member")
|
||||||
|
.where("id = :id", { id: createMemberAward.memberId })
|
||||||
|
.getOneOrFail(),
|
||||||
|
award: await dataSource
|
||||||
|
.getRepository(award)
|
||||||
|
.createQueryBuilder("award")
|
||||||
|
.where("id = :id", { id: createMemberAward.awardId })
|
||||||
|
.getOneOrFail(),
|
||||||
})
|
})
|
||||||
.execute()
|
.execute()
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
|
@ -45,7 +53,11 @@ export default abstract class MemberAwardCommandHandler {
|
||||||
given: updateMemberAward.given,
|
given: updateMemberAward.given,
|
||||||
note: updateMemberAward.note,
|
note: updateMemberAward.note,
|
||||||
date: updateMemberAward.date,
|
date: updateMemberAward.date,
|
||||||
award: updateMemberAward.awardId,
|
award: await dataSource
|
||||||
|
.getRepository(award)
|
||||||
|
.createQueryBuilder("award")
|
||||||
|
.where("id = :id", { id: updateMemberAward.awardId })
|
||||||
|
.getOneOrFail(),
|
||||||
})
|
})
|
||||||
.where("id = :id", { id: updateMemberAward.id })
|
.where("id = :id", { id: updateMemberAward.id })
|
||||||
.andWhere("memberId = :memberId", { memberId: updateMemberAward.memberId })
|
.andWhere("memberId = :memberId", { memberId: updateMemberAward.memberId })
|
||||||
|
|
|
@ -24,8 +24,16 @@ export default abstract class MemberExecutivePositionCommandHandler {
|
||||||
note: createMemberExecutivePosition.note,
|
note: createMemberExecutivePosition.note,
|
||||||
start: createMemberExecutivePosition.start,
|
start: createMemberExecutivePosition.start,
|
||||||
end: createMemberExecutivePosition.end,
|
end: createMemberExecutivePosition.end,
|
||||||
memberId: createMemberExecutivePosition.memberId,
|
member: await dataSource
|
||||||
executivePositionId: createMemberExecutivePosition.executivePositionId,
|
.getRepository(member)
|
||||||
|
.createQueryBuilder("member")
|
||||||
|
.where("id = :id", { id: createMemberExecutivePosition.memberId })
|
||||||
|
.getOneOrFail(),
|
||||||
|
executivePosition: await dataSource
|
||||||
|
.getRepository(executivePosition)
|
||||||
|
.createQueryBuilder("executivePosition")
|
||||||
|
.where("id = :id", { id: createMemberExecutivePosition.executivePositionId })
|
||||||
|
.getOneOrFail(),
|
||||||
})
|
})
|
||||||
.execute()
|
.execute()
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
|
@ -49,7 +57,11 @@ export default abstract class MemberExecutivePositionCommandHandler {
|
||||||
note: updateMemberExecutivePosition.note,
|
note: updateMemberExecutivePosition.note,
|
||||||
start: updateMemberExecutivePosition.start,
|
start: updateMemberExecutivePosition.start,
|
||||||
end: updateMemberExecutivePosition.end,
|
end: updateMemberExecutivePosition.end,
|
||||||
executivePositionId: updateMemberExecutivePosition.executivePositionId,
|
executivePosition: await dataSource
|
||||||
|
.getRepository(executivePosition)
|
||||||
|
.createQueryBuilder("executivePosition")
|
||||||
|
.where("id = :id", { id: updateMemberExecutivePosition.executivePositionId })
|
||||||
|
.getOneOrFail(),
|
||||||
})
|
})
|
||||||
.where("id = :id", { id: updateMemberExecutivePosition.id })
|
.where("id = :id", { id: updateMemberExecutivePosition.id })
|
||||||
.andWhere("memberId = :memberId", { memberId: updateMemberExecutivePosition.memberId })
|
.andWhere("memberId = :memberId", { memberId: updateMemberExecutivePosition.memberId })
|
||||||
|
|
|
@ -23,8 +23,16 @@ export default abstract class MemberQualificationCommandHandler {
|
||||||
.values({
|
.values({
|
||||||
note: createMemberQualification.note,
|
note: createMemberQualification.note,
|
||||||
start: createMemberQualification.start,
|
start: createMemberQualification.start,
|
||||||
memberId: createMemberQualification.memberId,
|
member: await dataSource
|
||||||
qualificationId: createMemberQualification.qualificationId,
|
.getRepository(member)
|
||||||
|
.createQueryBuilder("member")
|
||||||
|
.where("id = :id", { id: createMemberQualification.memberId })
|
||||||
|
.getOneOrFail(),
|
||||||
|
qualification: await dataSource
|
||||||
|
.getRepository(qualification)
|
||||||
|
.createQueryBuilder("qualification")
|
||||||
|
.where("id = :id", { id: createMemberQualification.qualificationId })
|
||||||
|
.getOneOrFail(),
|
||||||
})
|
})
|
||||||
.execute()
|
.execute()
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
|
@ -49,7 +57,11 @@ export default abstract class MemberQualificationCommandHandler {
|
||||||
start: updateMemberQualification.start,
|
start: updateMemberQualification.start,
|
||||||
end: updateMemberQualification.end,
|
end: updateMemberQualification.end,
|
||||||
terminationReason: updateMemberQualification.terminationReason,
|
terminationReason: updateMemberQualification.terminationReason,
|
||||||
qualificationId: updateMemberQualification.qualificationId,
|
qualification: await dataSource
|
||||||
|
.getRepository(qualification)
|
||||||
|
.createQueryBuilder("qualification")
|
||||||
|
.where("id = :id", { id: updateMemberQualification.qualificationId })
|
||||||
|
.getOneOrFail(),
|
||||||
})
|
})
|
||||||
.where("id = :id", { id: updateMemberQualification.id })
|
.where("id = :id", { id: updateMemberQualification.id })
|
||||||
.andWhere("memberId = :memberId", { memberId: updateMemberQualification.memberId })
|
.andWhere("memberId = :memberId", { memberId: updateMemberQualification.memberId })
|
||||||
|
|
|
@ -21,8 +21,16 @@ export default abstract class MembershipCommandHandler {
|
||||||
.into(membership)
|
.into(membership)
|
||||||
.values({
|
.values({
|
||||||
start: createMembership.start,
|
start: createMembership.start,
|
||||||
memberId: createMembership.memberId,
|
member: await dataSource
|
||||||
statusId: createMembership.statusId,
|
.getRepository(member)
|
||||||
|
.createQueryBuilder("member")
|
||||||
|
.where("id = :id", { id: createMembership.memberId })
|
||||||
|
.getOneOrFail(),
|
||||||
|
status: await dataSource
|
||||||
|
.getRepository(membershipStatus)
|
||||||
|
.createQueryBuilder("membershipStatus")
|
||||||
|
.where("id = :id", { id: createMembership.statusId })
|
||||||
|
.getOneOrFail(),
|
||||||
})
|
})
|
||||||
.execute()
|
.execute()
|
||||||
.then((result) => {
|
.then((result) => {
|
||||||
|
@ -62,7 +70,11 @@ export default abstract class MembershipCommandHandler {
|
||||||
start: updateMembership.start,
|
start: updateMembership.start,
|
||||||
end: updateMembership.end,
|
end: updateMembership.end,
|
||||||
terminationReason: updateMembership.terminationReason,
|
terminationReason: updateMembership.terminationReason,
|
||||||
statusId: updateMembership.statusId,
|
status: await dataSource
|
||||||
|
.getRepository(membershipStatus)
|
||||||
|
.createQueryBuilder("membershipStatus")
|
||||||
|
.where("id = :id", { id: updateMembership.statusId })
|
||||||
|
.getOneOrFail(),
|
||||||
})
|
})
|
||||||
.where("id = :id", { id: updateMembership.id })
|
.where("id = :id", { id: updateMembership.id })
|
||||||
.andWhere("memberId = :memberId", { memberId: updateMembership.memberId })
|
.andWhere("memberId = :memberId", { memberId: updateMembership.memberId })
|
||||||
|
|
|
@ -351,7 +351,6 @@ export async function addCommunicationToMember(req: Request, res: Response): Pro
|
||||||
const isSMSAlarming = req.body.isSMSAlarming;
|
const isSMSAlarming = req.body.isSMSAlarming;
|
||||||
const mobile = req.body.mobile;
|
const mobile = req.body.mobile;
|
||||||
const email = req.body.email;
|
const email = req.body.email;
|
||||||
const postalCode = req.body.postalCode;
|
|
||||||
const city = req.body.city;
|
const city = req.body.city;
|
||||||
const street = req.body.street;
|
const street = req.body.street;
|
||||||
const streetNumber = req.body.streetNumber;
|
const streetNumber = req.body.streetNumber;
|
||||||
|
@ -364,7 +363,6 @@ export async function addCommunicationToMember(req: Request, res: Response): Pro
|
||||||
isSMSAlarming,
|
isSMSAlarming,
|
||||||
mobile,
|
mobile,
|
||||||
email,
|
email,
|
||||||
postalCode,
|
|
||||||
city,
|
city,
|
||||||
street,
|
street,
|
||||||
streetNumber,
|
streetNumber,
|
||||||
|
@ -537,11 +535,11 @@ export async function updateCommunicationOfMember(req: Request, res: Response):
|
||||||
const isSMSAlarming = req.body.isSMSAlarming;
|
const isSMSAlarming = req.body.isSMSAlarming;
|
||||||
const mobile = req.body.mobile;
|
const mobile = req.body.mobile;
|
||||||
const email = req.body.email;
|
const email = req.body.email;
|
||||||
const postalCode = req.body.postalCode;
|
|
||||||
const city = req.body.city;
|
const city = req.body.city;
|
||||||
const street = req.body.street;
|
const street = req.body.street;
|
||||||
const streetNumber = req.body.streetNumber;
|
const streetNumber = req.body.streetNumber;
|
||||||
const streetNumberAddition = req.body.streetNumberAddition;
|
const streetNumberAddition = req.body.streetNumberAddition;
|
||||||
|
const typeId = req.body.typeId;
|
||||||
const isNewsletterMain = req.body.isNewsletterMain;
|
const isNewsletterMain = req.body.isNewsletterMain;
|
||||||
|
|
||||||
let updateCommunication: UpdateCommunicationCommand = {
|
let updateCommunication: UpdateCommunicationCommand = {
|
||||||
|
@ -550,7 +548,6 @@ export async function updateCommunicationOfMember(req: Request, res: Response):
|
||||||
isSMSAlarming,
|
isSMSAlarming,
|
||||||
mobile,
|
mobile,
|
||||||
email,
|
email,
|
||||||
postalCode,
|
|
||||||
city,
|
city,
|
||||||
street,
|
street,
|
||||||
streetNumber,
|
streetNumber,
|
||||||
|
|
|
@ -63,7 +63,6 @@ import { newsletterConfig } from "./entity/newsletterConfig";
|
||||||
import { NewsletterConfig1735207446910 } from "./migrations/1735207446910-newsletterConfig";
|
import { NewsletterConfig1735207446910 } from "./migrations/1735207446910-newsletterConfig";
|
||||||
import { TemplateMargins1735733514043 } from "./migrations/1735733514043-templateMargins";
|
import { TemplateMargins1735733514043 } from "./migrations/1735733514043-templateMargins";
|
||||||
import { InternalId1735822722235 } from "./migrations/1735822722235-internalId";
|
import { InternalId1735822722235 } from "./migrations/1735822722235-internalId";
|
||||||
import { PostalCode1735927918979 } from "./migrations/1735927918979-postalCode";
|
|
||||||
|
|
||||||
const dataSource = new DataSource({
|
const dataSource = new DataSource({
|
||||||
type: DB_TYPE as any,
|
type: DB_TYPE as any,
|
||||||
|
@ -137,7 +136,6 @@ const dataSource = new DataSource({
|
||||||
NewsletterConfig1735207446910,
|
NewsletterConfig1735207446910,
|
||||||
TemplateMargins1735733514043,
|
TemplateMargins1735733514043,
|
||||||
InternalId1735822722235,
|
InternalId1735822722235,
|
||||||
PostalCode1735927918979,
|
|
||||||
],
|
],
|
||||||
migrationsRun: true,
|
migrationsRun: true,
|
||||||
migrationsTransactionMode: "each",
|
migrationsTransactionMode: "each",
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { Column, Entity, ManyToOne, PrimaryColumn } from "typeorm";
|
import { Column, Entity, JoinColumn, ManyToOne, PrimaryColumn } from "typeorm";
|
||||||
import { member } from "./member";
|
import { member } from "./member";
|
||||||
import { communicationType } from "./communicationType";
|
import { communicationType } from "./communicationType";
|
||||||
|
|
||||||
|
@ -19,9 +19,6 @@ export class communication {
|
||||||
@Column({ type: "varchar", length: 255, nullable: true })
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
email: string;
|
email: string;
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255, nullable: true })
|
|
||||||
postalCode: string;
|
|
||||||
|
|
||||||
@Column({ type: "varchar", length: 255, nullable: true })
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
city: string;
|
city: string;
|
||||||
|
|
||||||
|
@ -34,12 +31,6 @@ export class communication {
|
||||||
@Column({ type: "varchar", length: 255, nullable: true })
|
@Column({ type: "varchar", length: 255, nullable: true })
|
||||||
streetNumberAddition: string;
|
streetNumberAddition: string;
|
||||||
|
|
||||||
@Column()
|
|
||||||
memberId: number;
|
|
||||||
|
|
||||||
@Column()
|
|
||||||
typeId: number;
|
|
||||||
|
|
||||||
@ManyToOne(() => communicationType, (communicationType) => communicationType.communications, {
|
@ManyToOne(() => communicationType, (communicationType) => communicationType.communications, {
|
||||||
nullable: false,
|
nullable: false,
|
||||||
onDelete: "RESTRICT",
|
onDelete: "RESTRICT",
|
||||||
|
|
|
@ -14,7 +14,6 @@ export default abstract class CommunicationFactory {
|
||||||
preferred: record.preferred,
|
preferred: record.preferred,
|
||||||
mobile: record.mobile,
|
mobile: record.mobile,
|
||||||
email: record.email,
|
email: record.email,
|
||||||
postalCode: record.postalCode,
|
|
||||||
city: record.city,
|
city: record.city,
|
||||||
street: record.street,
|
street: record.street,
|
||||||
streetNumber: record.streetNumber,
|
streetNumber: record.streetNumber,
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
import { MigrationInterface, QueryRunner, TableColumn } from "typeorm";
|
|
||||||
|
|
||||||
export class PostalCode1735927918979 implements MigrationInterface {
|
|
||||||
name = "PostalCode1735927918979";
|
|
||||||
|
|
||||||
public async up(queryRunner: QueryRunner): Promise<void> {
|
|
||||||
await queryRunner.addColumn(
|
|
||||||
"communication",
|
|
||||||
new TableColumn({
|
|
||||||
name: "postalCode",
|
|
||||||
type: "varchar",
|
|
||||||
length: "255",
|
|
||||||
default: null,
|
|
||||||
isNullable: true,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
public async down(queryRunner: QueryRunner): Promise<void> {
|
|
||||||
await queryRunner.dropColumn("communication", "postalCode");
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,16 +1,8 @@
|
||||||
export type CommunicationFieldType =
|
export type CommunicationFieldType = "mobile" | "email" | "city" | "street" | "streetNumber" | "streetNumberAddition";
|
||||||
| "mobile"
|
|
||||||
| "email"
|
|
||||||
| "postalCode"
|
|
||||||
| "city"
|
|
||||||
| "street"
|
|
||||||
| "streetNumber"
|
|
||||||
| "streetNumberAddition";
|
|
||||||
|
|
||||||
export const communicationFieldTypes: Array<CommunicationFieldType> = [
|
export const communicationFieldTypes: Array<CommunicationFieldType> = [
|
||||||
"mobile",
|
"mobile",
|
||||||
"email",
|
"email",
|
||||||
"postalCode",
|
|
||||||
"city",
|
"city",
|
||||||
"street",
|
"street",
|
||||||
"streetNumber",
|
"streetNumber",
|
||||||
|
|
|
@ -5,7 +5,6 @@ export interface CommunicationViewModel {
|
||||||
preferred: boolean;
|
preferred: boolean;
|
||||||
mobile: string;
|
mobile: string;
|
||||||
email: string;
|
email: string;
|
||||||
postalCode: string;
|
|
||||||
city: string;
|
city: string;
|
||||||
street: string;
|
street: string;
|
||||||
streetNumber: number;
|
streetNumber: number;
|
||||||
|
|
Loading…
Reference in a new issue