|
@@ -67,6 +67,7 @@ class CActService {
|
|
const actRegsOwner = await selPool.any(sql.type(
|
|
const actRegsOwner = await selPool.any(sql.type(
|
|
z.object({
|
|
z.object({
|
|
activityRegId: DbSchema.act.activityRegs.activityRegId,
|
|
activityRegId: DbSchema.act.activityRegs.activityRegId,
|
|
|
|
+ activityRegNumber: DbSchema.act.activityRegs.number,
|
|
activityId: DbSchema.act.activityRegs.activityId,
|
|
activityId: DbSchema.act.activityRegs.activityId,
|
|
activityCode: DbSchema.act.activities.code,
|
|
activityCode: DbSchema.act.activities.code,
|
|
activityPublicName: DbSchema.act.activities.publicName,
|
|
activityPublicName: DbSchema.act.activities.publicName,
|
|
@@ -93,6 +94,7 @@ class CActService {
|
|
)`
|
|
)`
|
|
select
|
|
select
|
|
ar.activity_reg_id "activityRegId",
|
|
ar.activity_reg_id "activityRegId",
|
|
|
|
+ ar.number "activityRegNumber",
|
|
ar.activity_id "activityId",
|
|
ar.activity_id "activityId",
|
|
ar.activity_code "activityCode",
|
|
ar.activity_code "activityCode",
|
|
ar.activity_public_name "activityPublicName",
|
|
ar.activity_public_name "activityPublicName",
|
|
@@ -115,6 +117,7 @@ class CActService {
|
|
const actRegsMember = await selPool.any(sql.type(
|
|
const actRegsMember = await selPool.any(sql.type(
|
|
z.object({
|
|
z.object({
|
|
activityRegId: DbSchema.act.activityRegs.activityRegId,
|
|
activityRegId: DbSchema.act.activityRegs.activityRegId,
|
|
|
|
+ activityRegNumber: DbSchema.act.activityRegs.number,
|
|
activityId: DbSchema.act.activityRegs.activityId,
|
|
activityId: DbSchema.act.activityRegs.activityId,
|
|
activityCode: DbSchema.act.activities.code,
|
|
activityCode: DbSchema.act.activities.code,
|
|
activityPublicName: DbSchema.act.activities.publicName,
|
|
activityPublicName: DbSchema.act.activities.publicName,
|
|
@@ -141,6 +144,7 @@ class CActService {
|
|
)`
|
|
)`
|
|
select
|
|
select
|
|
ar.activity_reg_id "activityRegId",
|
|
ar.activity_reg_id "activityRegId",
|
|
|
|
+ ar.number "activityRegNumber",
|
|
ar.activity_id "activityId",
|
|
ar.activity_id "activityId",
|
|
ar.activity_code "activityCode",
|
|
ar.activity_code "activityCode",
|
|
ar.activity_public_name "activityPublicName",
|
|
ar.activity_public_name "activityPublicName",
|
|
@@ -167,6 +171,7 @@ class CActService {
|
|
const actRegsChildrenMember = await selPool.any(sql.type(
|
|
const actRegsChildrenMember = await selPool.any(sql.type(
|
|
z.object({
|
|
z.object({
|
|
activityRegId: DbSchema.act.activityRegs.activityRegId,
|
|
activityRegId: DbSchema.act.activityRegs.activityRegId,
|
|
|
|
+ activityRegNumber: DbSchema.act.activityRegs.number,
|
|
activityId: DbSchema.act.activityRegs.activityId,
|
|
activityId: DbSchema.act.activityRegs.activityId,
|
|
activityCode: DbSchema.act.activities.code,
|
|
activityCode: DbSchema.act.activities.code,
|
|
activityPublicName: DbSchema.act.activities.publicName,
|
|
activityPublicName: DbSchema.act.activities.publicName,
|
|
@@ -193,6 +198,7 @@ class CActService {
|
|
)`
|
|
)`
|
|
select distinct -- DISTINCT нужен для удаления дубликатов, если несколько детей соответствуют условию
|
|
select distinct -- DISTINCT нужен для удаления дубликатов, если несколько детей соответствуют условию
|
|
ar.activity_reg_id "activityRegId",
|
|
ar.activity_reg_id "activityRegId",
|
|
|
|
+ ar.number "activityRegNumber",
|
|
ar.activity_id "activityId",
|
|
ar.activity_id "activityId",
|
|
ar.activity_code "activityCode",
|
|
ar.activity_code "activityCode",
|
|
ar.activity_public_name "activityPublicName",
|
|
ar.activity_public_name "activityPublicName",
|
|
@@ -227,6 +233,7 @@ where
|
|
const actReg = await selPool.maybeOne(sql.type(
|
|
const actReg = await selPool.maybeOne(sql.type(
|
|
z.object({
|
|
z.object({
|
|
activityRegId: DbSchema.act.activityRegs.activityRegId,
|
|
activityRegId: DbSchema.act.activityRegs.activityRegId,
|
|
|
|
+ activityRegNumber: DbSchema.act.activityRegs.number,
|
|
activityId: DbSchema.act.activityRegs.activityId,
|
|
activityId: DbSchema.act.activityRegs.activityId,
|
|
activityCode: DbSchema.act.activities.code,
|
|
activityCode: DbSchema.act.activities.code,
|
|
activityPublicName: DbSchema.act.activities.publicName,
|
|
activityPublicName: DbSchema.act.activities.publicName,
|
|
@@ -260,6 +267,7 @@ where
|
|
)`
|
|
)`
|
|
select
|
|
select
|
|
ar.activity_reg_id "activityRegId",
|
|
ar.activity_reg_id "activityRegId",
|
|
|
|
+ ar.number "activityRegNumber",
|
|
ar.activity_id "activityId",
|
|
ar.activity_id "activityId",
|
|
ar.activity_code "activityCode",
|
|
ar.activity_code "activityCode",
|
|
ar.activity_public_name "activityPublicName",
|
|
ar.activity_public_name "activityPublicName",
|
|
@@ -284,6 +292,7 @@ where
|
|
const actReg = await selPool.maybeOne(sql.type(
|
|
const actReg = await selPool.maybeOne(sql.type(
|
|
z.object({
|
|
z.object({
|
|
activityRegId: DbSchema.act.activityRegs.activityRegId,
|
|
activityRegId: DbSchema.act.activityRegs.activityRegId,
|
|
|
|
+ activityRegNumber: DbSchema.act.activityRegs.number,
|
|
activityId: DbSchema.act.activityRegs.activityId,
|
|
activityId: DbSchema.act.activityRegs.activityId,
|
|
activityCode: DbSchema.act.activities.code,
|
|
activityCode: DbSchema.act.activities.code,
|
|
activityPublicName: DbSchema.act.activities.publicName,
|
|
activityPublicName: DbSchema.act.activities.publicName,
|
|
@@ -310,6 +319,7 @@ where
|
|
)`
|
|
)`
|
|
select
|
|
select
|
|
ar.activity_reg_id "activityRegId",
|
|
ar.activity_reg_id "activityRegId",
|
|
|
|
+ ar.number "activityRegNumber",
|
|
ar.activity_id "activityId",
|
|
ar.activity_id "activityId",
|
|
ar.activity_code "activityCode",
|
|
ar.activity_code "activityCode",
|
|
ar.activity_public_name "activityPublicName",
|
|
ar.activity_public_name "activityPublicName",
|
|
@@ -729,6 +739,7 @@ where
|
|
return selPool.maybeOne(sql.type(
|
|
return selPool.maybeOne(sql.type(
|
|
z.object({
|
|
z.object({
|
|
activityRegId: DbSchema.act.activityRegs.activityRegId,
|
|
activityRegId: DbSchema.act.activityRegs.activityRegId,
|
|
|
|
+ activityRegNumber: DbSchema.act.activityRegs.number,
|
|
activityId: DbSchema.act.activityRegs.activityId,
|
|
activityId: DbSchema.act.activityRegs.activityId,
|
|
activityCode: DbSchema.act.activities.code,
|
|
activityCode: DbSchema.act.activities.code,
|
|
activityPublicName: DbSchema.act.activities.publicName,
|
|
activityPublicName: DbSchema.act.activities.publicName,
|
|
@@ -762,6 +773,7 @@ where
|
|
)`
|
|
)`
|
|
select
|
|
select
|
|
ar.activity_reg_id "activityRegId",
|
|
ar.activity_reg_id "activityRegId",
|
|
|
|
+ ar.number "activityRegNumber",
|
|
ar.activity_id "activityId",
|
|
ar.activity_id "activityId",
|
|
ar.activity_code "activityCode",
|
|
ar.activity_code "activityCode",
|
|
ar.activity_public_name "activityPublicName",
|
|
ar.activity_public_name "activityPublicName",
|
|
@@ -942,6 +954,42 @@ where
|
|
`);
|
|
`);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ async getActWithActValidators(activityCode: string) {
|
|
|
|
+ return await selPool.maybeOne(sql.type(
|
|
|
|
+ z.object({
|
|
|
|
+ activityId: DbSchema.act.activities.activityId,
|
|
|
|
+ code: DbSchema.act.activities.code,
|
|
|
|
+ publicName: DbSchema.act.activities.publicName,
|
|
|
|
+ eventInstId: DbSchema.act.activities.eventInstId,
|
|
|
|
+ categoryId: DbSchema.act.activities.categoryId,
|
|
|
|
+ categoryCode: DbSchema.act.activityCategories.code,
|
|
|
|
+ validators: z.array(apiTypes.activities.ActValidator),
|
|
|
|
+ peTypes: z.array(
|
|
|
|
+ z.object({
|
|
|
|
+ peTypeId: DbSchema.act.peTypes.peTypeId,
|
|
|
|
+ code: DbSchema.act.peTypes.code,
|
|
|
|
+ name: DbSchema.act.peTypes.name,
|
|
|
|
+ }),
|
|
|
|
+ ),
|
|
|
|
+ isUserReg: DbSchema.act.activities.isUserReg,
|
|
|
|
+ }),
|
|
|
|
+ )`
|
|
|
|
+ select
|
|
|
|
+ a.activity_id "activityId",
|
|
|
|
+ a.code,
|
|
|
|
+ a.public_name "publicName",
|
|
|
|
+ a.event_inst_id "eventInstId",
|
|
|
|
+ a.category_id "categoryId",
|
|
|
|
+ a.category_code "categoryCode",
|
|
|
|
+ a.validators,
|
|
|
|
+ a.pe_types "peTypes",
|
|
|
|
+ a.is_user_reg "isUserReg"
|
|
|
|
+ from
|
|
|
|
+ act.act_with_validators a
|
|
|
|
+ where a.code = ${activityCode}
|
|
|
|
+ `);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
export const cActService = new CActService();
|
|
export const cActService = new CActService();
|