prow-authority 3.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +11 -0
- package/.dockerignore +11 -0
- package/.github/workflows/_deploy.yml +191 -0
- package/.github/workflows/deploy-dev.yml +30 -0
- package/.github/workflows/deploy-prod.yml +34 -0
- package/CLAUDE.md +114 -0
- package/Dockerfile +61 -0
- package/Dockerfile.dev +24 -0
- package/README.md +1 -0
- package/package.json +61 -0
- package/src/App.ts +40 -0
- package/src/helpers/api-error.ts +21 -0
- package/src/helpers/authority.ts +216 -0
- package/src/helpers/config.ts +4 -0
- package/src/helpers/holded.ts +105 -0
- package/src/helpers/mysql.ts +15 -0
- package/src/helpers/notifications.ts +55 -0
- package/src/helpers/random.ts +18 -0
- package/src/helpers/s3.ts +43 -0
- package/src/helpers/stripe.ts +8 -0
- package/src/index.ts +47 -0
- package/src/v1/common-types.ts +12 -0
- package/src/v1/controllers/admin/accounting-seat-controller.ts +148 -0
- package/src/v1/controllers/admin/billing-cycle-controller.ts +171 -0
- package/src/v1/controllers/admin/invoice-controller.ts +222 -0
- package/src/v1/controllers/admin/license-controller.ts +190 -0
- package/src/v1/controllers/admin/license-limit-controller.ts +160 -0
- package/src/v1/controllers/admin/notification-controller.ts +115 -0
- package/src/v1/controllers/admin/organization-controller.ts +210 -0
- package/src/v1/controllers/admin/organization-license-controller.ts +224 -0
- package/src/v1/controllers/admin/organization-license-limit-controller.ts +196 -0
- package/src/v1/controllers/admin/organization-usage-controller.ts +167 -0
- package/src/v1/controllers/admin/payment-method-controller.ts +173 -0
- package/src/v1/controllers/admin/policy-controller.ts +138 -0
- package/src/v1/controllers/admin/policy-version-controller.ts +143 -0
- package/src/v1/controllers/admin/schedule-controller.ts +181 -0
- package/src/v1/controllers/admin/service-controller.ts +206 -0
- package/src/v1/controllers/admin/service-notification-controller.ts +166 -0
- package/src/v1/controllers/admin/user-controller.ts +282 -0
- package/src/v1/controllers/admin/user-organization-controller.ts +172 -0
- package/src/v1/controllers/admin/user-policy-controller.ts +164 -0
- package/src/v1/controllers/auth/@deprecated oauth-controller.ts +191 -0
- package/src/v1/controllers/auth/identity-token-controller.ts +286 -0
- package/src/v1/controllers/auth/organization-token-controller.ts +277 -0
- package/src/v1/controllers/auth/temp-code-controller.ts +60 -0
- package/src/v1/controllers/billing/billing-controller.ts +805 -0
- package/src/v1/controllers/organizations/public-organization-controller.ts +1796 -0
- package/src/v1/controllers/policies/public-policy-controller.ts +68 -0
- package/src/v1/controllers/services/public-service-controller.ts +177 -0
- package/src/v1/controllers/services/service-controller.ts +474 -0
- package/src/v1/controllers/users/public-user-controller.ts +471 -0
- package/src/v1/daos/@deprecated auth-dao.ts +173 -0
- package/src/v1/daos/accounting-seat-dao.ts +111 -0
- package/src/v1/daos/billing-cycle-dao.ts +107 -0
- package/src/v1/daos/invoice-dao.ts +131 -0
- package/src/v1/daos/license-dao.ts +152 -0
- package/src/v1/daos/license-limit-dao.ts +120 -0
- package/src/v1/daos/organization-dao.ts +109 -0
- package/src/v1/daos/organization-license-dao.ts +117 -0
- package/src/v1/daos/organization-license-limit-dao.ts +157 -0
- package/src/v1/daos/organization-usage-dao.ts +115 -0
- package/src/v1/daos/payment-method-dao.ts +110 -0
- package/src/v1/daos/policy-dao.ts +105 -0
- package/src/v1/daos/policy-version-dao.ts +112 -0
- package/src/v1/daos/redis-dao.ts +38 -0
- package/src/v1/daos/schema.sql +462 -0
- package/src/v1/daos/service-dao.ts +118 -0
- package/src/v1/daos/service-notification-dao.ts +120 -0
- package/src/v1/daos/user-dao.ts +127 -0
- package/src/v1/daos/user-organization-dao.ts +123 -0
- package/src/v1/daos/user-policy-dao.ts +109 -0
- package/src/v1/middlewares/auth/identity-token-middleware.ts +51 -0
- package/src/v1/middlewares/auth/organization-token-middleware.ts +73 -0
- package/src/v1/middlewares/auth/service-token-middleware.ts +167 -0
- package/src/v1/middlewares/authority-middleware.ts +97 -0
- package/src/v1/middlewares/organizations/organization-middleware.ts +94 -0
- package/src/v1/middlewares/static/static-middleware.ts +41 -0
- package/src/v1/middlewares/users/user-middleware.ts +41 -0
- package/src/v1/routes/admin/accounting-seat-router.ts +89 -0
- package/src/v1/routes/admin/admin-router.ts +61 -0
- package/src/v1/routes/admin/billing-cycle-router.ts +89 -0
- package/src/v1/routes/admin/invoice-router.ts +89 -0
- package/src/v1/routes/admin/license-limit-router.ts +89 -0
- package/src/v1/routes/admin/license-router.ts +89 -0
- package/src/v1/routes/admin/notification-router.ts +61 -0
- package/src/v1/routes/admin/organization-license-limit-router.ts +89 -0
- package/src/v1/routes/admin/organization-license-router.ts +89 -0
- package/src/v1/routes/admin/organization-router.ts +89 -0
- package/src/v1/routes/admin/payment-method-router.ts +89 -0
- package/src/v1/routes/admin/policy-router.ts +89 -0
- package/src/v1/routes/admin/policy-version-router.ts +89 -0
- package/src/v1/routes/admin/schedule-router.ts +75 -0
- package/src/v1/routes/admin/service-notification-router.ts +98 -0
- package/src/v1/routes/admin/service-router.ts +89 -0
- package/src/v1/routes/admin/user-organization-router.ts +89 -0
- package/src/v1/routes/admin/user-policy-router.ts +89 -0
- package/src/v1/routes/admin/user-router.ts +89 -0
- package/src/v1/routes/auth/@deprecated auth-router.ts +199 -0
- package/src/v1/routes/auth/identity-token-router.ts +147 -0
- package/src/v1/routes/auth/organization-token-router.ts +70 -0
- package/src/v1/routes/billing/billing-router.ts +227 -0
- package/src/v1/routes/organizations/invoices-router.ts +48 -0
- package/src/v1/routes/organizations/payments-router.ts +104 -0
- package/src/v1/routes/organizations/public-organization-router.ts +319 -0
- package/src/v1/routes/organizations/users-router.ts +139 -0
- package/src/v1/routes/policies/public-policy-router.ts +50 -0
- package/src/v1/routes/services/public-service-router.ts +89 -0
- package/src/v1/routes/services/service-router.ts +197 -0
- package/src/v1/routes/users/public-user-router.ts +230 -0
- package/src/v1/routes/v1-router.ts +50 -0
- package/src/v1/schemas/admin/accounting-seat-schemas.ts +22 -0
- package/src/v1/schemas/admin/billing-cycle-schemas.ts +20 -0
- package/src/v1/schemas/admin/invoice-schemas.ts +41 -0
- package/src/v1/schemas/admin/license-limit-schemas.ts +25 -0
- package/src/v1/schemas/admin/license-schemas.ts +30 -0
- package/src/v1/schemas/admin/organization-license-limit-schemas.ts +29 -0
- package/src/v1/schemas/admin/organization-license-schemas.ts +43 -0
- package/src/v1/schemas/admin/organization-schemas.ts +67 -0
- package/src/v1/schemas/admin/organization-usage-schemas.ts +15 -0
- package/src/v1/schemas/admin/payment-method-schemas.ts +40 -0
- package/src/v1/schemas/admin/policy-schemas.ts +31 -0
- package/src/v1/schemas/admin/service-notification-schemas.ts +23 -0
- package/src/v1/schemas/admin/service-schemas.ts +56 -0
- package/src/v1/schemas/admin/user-organization-schemas.ts +24 -0
- package/src/v1/schemas/admin/user-policy-schemas.ts +17 -0
- package/src/v1/schemas/admin/user-schemas.ts +52 -0
- package/src/v1/schemas/auth/auth-schemas.ts +55 -0
- package/src/v1/schemas/billing/billing-schemas.ts +32 -0
- package/src/v1/schemas/organizations/public-organization-schemas.ts +77 -0
- package/src/v1/schemas/payments/payment-method-schemas.ts +0 -0
- package/src/v1/schemas/services/public-service-schemas.ts +5 -0
- package/src/v1/schemas/services/service-schemas.ts +27 -0
- package/src/v1/schemas/users/public-user-schemas.ts +73 -0
- package/src/v1/types/admin/accounting-seat-types.ts +16 -0
- package/src/v1/types/admin/billing-cycle-types.ts +14 -0
- package/src/v1/types/admin/invoice-types.ts +39 -0
- package/src/v1/types/admin/license-limit-types.ts +16 -0
- package/src/v1/types/admin/license-types.ts +29 -0
- package/src/v1/types/admin/organization-license-limit-types.ts +13 -0
- package/src/v1/types/admin/organization-license-types.ts +21 -0
- package/src/v1/types/admin/organization-types.ts +60 -0
- package/src/v1/types/admin/organization-usage-types.ts +17 -0
- package/src/v1/types/admin/payment-method-types.ts +30 -0
- package/src/v1/types/admin/policy-types.ts +9 -0
- package/src/v1/types/admin/policy-version-types.ts +12 -0
- package/src/v1/types/admin/service-notification-types.ts +20 -0
- package/src/v1/types/admin/service-types.ts +36 -0
- package/src/v1/types/admin/user-organization-types.ts +31 -0
- package/src/v1/types/admin/user-types.ts +44 -0
- package/src/v1/types/auth/@deprecated auth-types.ts +26 -0
- package/src/v1/types/auth/common-types.ts +7 -0
- package/src/v1/types/auth/confirmation-types.ts +5 -0
- package/src/v1/types/auth/identity-token-types.ts +8 -0
- package/src/v1/types/auth/organization-token-types.ts +23 -0
- package/src/v1/types/auth/otp-types.ts +12 -0
- package/src/v1/types/billing/billing-types.ts +37 -0
- package/src/v1/types/billing/ue-types.ts +29 -0
- package/src/v1/types/organizations/public-organization-types.ts +76 -0
- package/src/v1/types/policies/public-policy-types.ts +7 -0
- package/src/v1/types/services/public-service-types.ts +20 -0
- package/src/v1/types/services/service-types.ts +43 -0
- package/src/v1/types/users/public-user-types.ts +15 -0
- package/src/v1/types/users/user-policy-types.ts +11 -0
- package/static/error.html +55 -0
- package/static/grant.html +117 -0
- package/static/login.html +54 -0
- package/static/oauth-client-logo.webp +0 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Formats } from "@beseif-solutions/utility-functions/dist/utils/date-utils";
|
|
2
|
+
import { Schema } from "@beseif-solutions/utility-functions/dist/utils/validation-utils";
|
|
3
|
+
import { InvoiceStatus } from "../../types/admin/invoice-types";
|
|
4
|
+
|
|
5
|
+
export const generateOrganizationInvoiceSchema = Schema.object({
|
|
6
|
+
current_date: Schema.date({ strict: false, format: Formats.ISO }),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const getInvoicesSchema = Schema.object({
|
|
10
|
+
status: Schema.string({ valid: Object.values(InvoiceStatus) }),
|
|
11
|
+
current_date: Schema.date({ strict: false, format: Formats.ISO }),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const invoiceEmittedSchema = (free: boolean) =>
|
|
15
|
+
Schema.object({
|
|
16
|
+
invoice: free ? Schema.string() : Schema.requiredString(),
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const invoicePaidSchema = (free: boolean) =>
|
|
20
|
+
Schema.object({
|
|
21
|
+
payment: free ? Schema.string() : Schema.requiredString(),
|
|
22
|
+
method: free ? Schema.string() : Schema.requiredString(),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
export const updateInvoiceSchema = Schema.object({
|
|
26
|
+
metadata: Schema.object(),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const getAccountingSeatsSchema = Schema.object({
|
|
30
|
+
done: Schema.requiredBool(),
|
|
31
|
+
current_date: Schema.date({ strict: false, format: Formats.ISO }),
|
|
32
|
+
});
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Schema } from "@beseif-solutions/utility-functions/dist/utils/validation-utils";
|
|
2
|
+
|
|
3
|
+
export const createOrganizationSchema = Schema.object({
|
|
4
|
+
properties: Schema.requiredObject({
|
|
5
|
+
name: Schema.requiredString(),
|
|
6
|
+
activity: Schema.requiredString(),
|
|
7
|
+
image: Schema.string({ allow: [null] }),
|
|
8
|
+
cover: Schema.string({ allow: [null] }),
|
|
9
|
+
}),
|
|
10
|
+
preferences: Schema.requiredObject({
|
|
11
|
+
timezone: Schema.requiredString(),
|
|
12
|
+
}),
|
|
13
|
+
metadata: Schema.object(),
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
export const updateOrganizationSchema = Schema.object({
|
|
17
|
+
properties: Schema.object({
|
|
18
|
+
name: Schema.string(),
|
|
19
|
+
activity: Schema.string(),
|
|
20
|
+
image: Schema.string({ allow: [null] }),
|
|
21
|
+
cover: Schema.string({ allow: [null] }),
|
|
22
|
+
}),
|
|
23
|
+
billing: Schema.object({
|
|
24
|
+
name: Schema.string(),
|
|
25
|
+
document: Schema.string(),
|
|
26
|
+
email: Schema.email(),
|
|
27
|
+
phone: Schema.string(),
|
|
28
|
+
address: {
|
|
29
|
+
address: Schema.string(),
|
|
30
|
+
city: Schema.string(),
|
|
31
|
+
zip: Schema.string(),
|
|
32
|
+
province: Schema.string(),
|
|
33
|
+
country: Schema.string(),
|
|
34
|
+
},
|
|
35
|
+
individual: Schema.bool(),
|
|
36
|
+
}),
|
|
37
|
+
preferences: Schema.object({
|
|
38
|
+
timezone: Schema.string(),
|
|
39
|
+
}),
|
|
40
|
+
metadata: Schema.object(),
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export const licenseParamsSchema = Schema.object({
|
|
44
|
+
enabled: Schema.string({ valid: [`true`, `false`] }),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const activateLicenseSchema = Schema.object({
|
|
48
|
+
license: Schema.requiredString(),
|
|
49
|
+
billing: Schema.requiredString({ valid: [`monthly`, `annual`] }),
|
|
50
|
+
renew: Schema.requiredBool(),
|
|
51
|
+
scheduled: Schema.bool(),
|
|
52
|
+
metadata: Schema.object(),
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
export const activatePowerUpSchema = Schema.object({
|
|
56
|
+
license: Schema.requiredString(),
|
|
57
|
+
billing: Schema.requiredString({ valid: [`monthly`, `annual`] }),
|
|
58
|
+
renew: Schema.requiredBool(),
|
|
59
|
+
metadata: Schema.object(),
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
export const addPaymentMethodSchema = Schema.object({
|
|
63
|
+
payment_method_id: Schema.requiredString(),
|
|
64
|
+
enabled: Schema.requiredBool(),
|
|
65
|
+
properties: Schema.object({
|
|
66
|
+
alias: Schema.string(),
|
|
67
|
+
}),
|
|
68
|
+
metadata: Schema.object(),
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export const updatePaymentMethodSchema = Schema.object({
|
|
72
|
+
enabled: Schema.bool(),
|
|
73
|
+
properties: Schema.object({
|
|
74
|
+
alias: Schema.string(),
|
|
75
|
+
}),
|
|
76
|
+
metadata: Schema.object(),
|
|
77
|
+
});
|
|
File without changes
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Formats } from "@beseif-solutions/utility-functions/dist/utils/date-utils";
|
|
2
|
+
import { Schema } from "@beseif-solutions/utility-functions/dist/utils/validation-utils";
|
|
3
|
+
|
|
4
|
+
export const quotaParamsSchema = Schema.object({
|
|
5
|
+
date: Schema.date({ strict: false, format: Formats.ISO }),
|
|
6
|
+
name: Schema.array({ items: Schema.string(), min: 1 }),
|
|
7
|
+
});
|
|
8
|
+
|
|
9
|
+
export const quotaUsageSchema = Schema.object({
|
|
10
|
+
name: Schema.requiredString(),
|
|
11
|
+
count: Schema.requiredNumber(),
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
export const sendNotificationSchema = Schema.object({
|
|
15
|
+
event: Schema.requiredString(),
|
|
16
|
+
locale: Schema.string(),
|
|
17
|
+
context: Schema.object()
|
|
18
|
+
.pattern(Schema.string(), Schema.alternatives(Schema.string(), Schema.number())),
|
|
19
|
+
data: Schema.object(),
|
|
20
|
+
attachments: Schema.array({
|
|
21
|
+
items: Schema.object({
|
|
22
|
+
name: Schema.requiredString(),
|
|
23
|
+
type: Schema.requiredString(),
|
|
24
|
+
content: Schema.requiredString(),
|
|
25
|
+
}),
|
|
26
|
+
}),
|
|
27
|
+
});
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Schema } from "@beseif-solutions/utility-functions/dist/utils/validation-utils";
|
|
2
|
+
import { UserOrganizationRole } from "../../types/admin/user-organization-types";
|
|
3
|
+
import { CommunicationType } from "../../types/admin/user-types";
|
|
4
|
+
|
|
5
|
+
export const registerUserSchema = Schema.object({
|
|
6
|
+
email: Schema.requiredEmail({ max: 200 }),
|
|
7
|
+
password: Schema.requiredString({ min: 8 }),
|
|
8
|
+
properties: Schema.requiredObject({
|
|
9
|
+
name: Schema.requiredString(),
|
|
10
|
+
surnames: Schema.string(),
|
|
11
|
+
image: Schema.string(),
|
|
12
|
+
}),
|
|
13
|
+
preferences: Schema.requiredObject({
|
|
14
|
+
language: Schema.requiredString({ length: 2 }),
|
|
15
|
+
communications: Schema.object({
|
|
16
|
+
[CommunicationType.Commercial]: Schema.bool(),
|
|
17
|
+
[CommunicationType.Newsletter]: Schema.bool(),
|
|
18
|
+
}),
|
|
19
|
+
}),
|
|
20
|
+
utm: Schema.object({
|
|
21
|
+
medium: Schema.string(),
|
|
22
|
+
source: Schema.string(),
|
|
23
|
+
campaign: Schema.string(),
|
|
24
|
+
}),
|
|
25
|
+
referrer: Schema.string().optional(),
|
|
26
|
+
metadata: Schema.object(),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const updateUserSchema = Schema.object({
|
|
30
|
+
// email: Schema.email({ max: 200 }),
|
|
31
|
+
password: Schema.string({ min: 8 }),
|
|
32
|
+
properties: Schema.object({
|
|
33
|
+
name: Schema.string(),
|
|
34
|
+
surnames: Schema.string(),
|
|
35
|
+
image: Schema.string(),
|
|
36
|
+
}),
|
|
37
|
+
preferences: Schema.object({
|
|
38
|
+
language: Schema.string({ length: 2 }),
|
|
39
|
+
communications: Schema.object({
|
|
40
|
+
[CommunicationType.Commercial]: Schema.bool(),
|
|
41
|
+
[CommunicationType.Newsletter]: Schema.bool(),
|
|
42
|
+
}),
|
|
43
|
+
}),
|
|
44
|
+
metadata: Schema.object(),
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
export const inviteUserSchema = Schema.object({
|
|
48
|
+
email: Schema.requiredString(),
|
|
49
|
+
role: Schema.requiredString({ valid: [UserOrganizationRole.Admin, UserOrganizationRole.Staff] }),
|
|
50
|
+
enabled: Schema.requiredBool(),
|
|
51
|
+
metadata: Schema.object(),
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
export const updateUserAccessSchema = Schema.object({
|
|
55
|
+
role: Schema.string({ valid: [UserOrganizationRole.Admin, UserOrganizationRole.Staff] }),
|
|
56
|
+
enabled: Schema.bool(),
|
|
57
|
+
metadata: Schema.object(),
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
export const updateUserOrganizationSchema = Schema.object({
|
|
61
|
+
preferences: Schema.object({
|
|
62
|
+
notifications: Schema.object(),
|
|
63
|
+
}),
|
|
64
|
+
metadata: Schema.object(),
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
export const changeOwnershipSchema = Schema.object({
|
|
68
|
+
user: Schema.requiredString(),
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
export const acceptPoliciesSchema = Schema.object({
|
|
72
|
+
uuids: Schema.array({ items: Schema.string() }),
|
|
73
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Invoice } from "./invoice-types";
|
|
2
|
+
import { Organization } from "./organization-types";
|
|
3
|
+
|
|
4
|
+
export type DBRecord = {
|
|
5
|
+
id: number,
|
|
6
|
+
uuid: string,
|
|
7
|
+
organization: Organization[`id`],
|
|
8
|
+
invoice: Invoice[`id`],
|
|
9
|
+
date: string,
|
|
10
|
+
amount: number,
|
|
11
|
+
done: boolean,
|
|
12
|
+
metadata: Record<string, any>,
|
|
13
|
+
internal: Record<string, any>,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type AccountingSeat = DBRecord;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Organization } from "./organization-types";
|
|
2
|
+
|
|
3
|
+
export type DBRecord = {
|
|
4
|
+
id: number,
|
|
5
|
+
uuid: string,
|
|
6
|
+
organization: Organization[`id`],
|
|
7
|
+
trial: boolean,
|
|
8
|
+
start_date: string,
|
|
9
|
+
end_date: string,
|
|
10
|
+
metadata: Record<string, any>,
|
|
11
|
+
internal: Record<string, any>,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type BillingCycle = DBRecord;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Organization } from "./organization-types";
|
|
2
|
+
import { PaymentMethod } from "./payment-method-types";
|
|
3
|
+
|
|
4
|
+
export enum InvoiceStatus {
|
|
5
|
+
Pending = `pending`,
|
|
6
|
+
Emitted = `emitted`,
|
|
7
|
+
Paid = `paid`,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type InvoiceConcept = {
|
|
11
|
+
name: string,
|
|
12
|
+
description: string,
|
|
13
|
+
price: number,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type DBRecord = {
|
|
17
|
+
id: number,
|
|
18
|
+
uuid: string,
|
|
19
|
+
organization: Organization[`id`],
|
|
20
|
+
date: string,
|
|
21
|
+
amount: number,
|
|
22
|
+
tax_code: string,
|
|
23
|
+
tax_percentage: number,
|
|
24
|
+
concepts: InvoiceConcept[],
|
|
25
|
+
billing: Organization[`billing`],
|
|
26
|
+
status: InvoiceStatus,
|
|
27
|
+
invoice: string,
|
|
28
|
+
number?: string,
|
|
29
|
+
payment: string,
|
|
30
|
+
method: PaymentMethod[`id`],
|
|
31
|
+
metadata: Record<string, any>,
|
|
32
|
+
internal: Record<string, any>,
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export type Invoice = DBRecord
|
|
36
|
+
& {
|
|
37
|
+
base: number,
|
|
38
|
+
tax: number,
|
|
39
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { License } from "./license-types";
|
|
2
|
+
|
|
3
|
+
export type DBRecord = {
|
|
4
|
+
id: number,
|
|
5
|
+
license: License[`id`],
|
|
6
|
+
name: string,
|
|
7
|
+
limit: number,
|
|
8
|
+
period: `monthly` | `lifetime`,
|
|
9
|
+
monthly_price_abs: number,
|
|
10
|
+
annual_price_abs: number,
|
|
11
|
+
overconsume_monthly_price_per_unit: number,
|
|
12
|
+
overconsume_annual_price_per_unit: number,
|
|
13
|
+
metadata: Record<string, any>,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type LicenseLimit = DBRecord;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Service } from "./service-types";
|
|
2
|
+
|
|
3
|
+
export enum LicenseType {
|
|
4
|
+
Base = `license`,
|
|
5
|
+
Variant = `power-up`
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export type DBRecord = {
|
|
9
|
+
id: number,
|
|
10
|
+
uuid: string,
|
|
11
|
+
service: Service[`id`],
|
|
12
|
+
type: LicenseType,
|
|
13
|
+
associated: number,
|
|
14
|
+
properties: {
|
|
15
|
+
name: string,
|
|
16
|
+
description: string,
|
|
17
|
+
},
|
|
18
|
+
data: Record<string, any>,
|
|
19
|
+
created_date: string,
|
|
20
|
+
modified_date: string,
|
|
21
|
+
public: boolean,
|
|
22
|
+
enabled: boolean,
|
|
23
|
+
metadata: Record<string, any>,
|
|
24
|
+
} & DBPrices;
|
|
25
|
+
|
|
26
|
+
export type License = Omit<DBRecord, keyof DBPrices> & Prices;
|
|
27
|
+
|
|
28
|
+
export type DBPrices = { monthly_price: string, annual_price: string };
|
|
29
|
+
export type Prices = { monthly_price: number, annual_price: number };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { LicenseLimit } from "./license-limit-types";
|
|
2
|
+
import { OrganizationLicense } from "./organization-license-types";
|
|
3
|
+
import { Organization } from "./organization-types";
|
|
4
|
+
|
|
5
|
+
export type DBRecord = {
|
|
6
|
+
id: number,
|
|
7
|
+
organization: Organization[`id`],
|
|
8
|
+
license: OrganizationLicense[`id`],
|
|
9
|
+
overconsume: boolean,
|
|
10
|
+
metadata: Record<string, any>,
|
|
11
|
+
} & Omit<LicenseLimit, `id` | `license` | `metadata`>;
|
|
12
|
+
|
|
13
|
+
export type OrganizationLicenseLimit = DBRecord;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { DBPrices, License, Prices } from "./license-types";
|
|
2
|
+
import { Organization } from "./organization-types";
|
|
3
|
+
|
|
4
|
+
export type DBRecord = {
|
|
5
|
+
id: number,
|
|
6
|
+
uuid: string,
|
|
7
|
+
original: number,
|
|
8
|
+
organization: Organization[`id`],
|
|
9
|
+
billing: `monthly` | `annual` | `lifetime`,
|
|
10
|
+
start_date: string,
|
|
11
|
+
end_date: string,
|
|
12
|
+
enabled: boolean,
|
|
13
|
+
metadata: Record<string, any>,
|
|
14
|
+
internal: { notified?: boolean } & Record<string, any>,
|
|
15
|
+
}
|
|
16
|
+
& DBPrices
|
|
17
|
+
& Omit<License, `id` | `uuid` | `created_date` | `modified_date` | `public` | `enabled` | `metadata`>;
|
|
18
|
+
|
|
19
|
+
export type OrganizationLicense = Omit<DBRecord, keyof DBPrices> & Prices;
|
|
20
|
+
|
|
21
|
+
export { Prices, DBPrices } from './license-types';
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export enum OrganizationStatus {
|
|
2
|
+
Unpaid = `unpaid`,
|
|
3
|
+
Active = `active`,
|
|
4
|
+
Blocked = `blocked`,
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type LimitNotification = {
|
|
8
|
+
approaching: boolean,
|
|
9
|
+
reached: boolean,
|
|
10
|
+
lastPercentage: number,
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type ServiceInformation = {
|
|
14
|
+
blocked: boolean,
|
|
15
|
+
exceeded_date?: string,
|
|
16
|
+
notifications: {
|
|
17
|
+
access: Record<string, boolean>,
|
|
18
|
+
limits: Record<string, LimitNotification>,
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export type DBRecord = {
|
|
23
|
+
id: number,
|
|
24
|
+
uuid: string,
|
|
25
|
+
properties: {
|
|
26
|
+
name: string,
|
|
27
|
+
activity: string,
|
|
28
|
+
image?: string,
|
|
29
|
+
cover?: string,
|
|
30
|
+
},
|
|
31
|
+
billing?: {
|
|
32
|
+
name: string,
|
|
33
|
+
document: string,
|
|
34
|
+
email: string,
|
|
35
|
+
phone?: string,
|
|
36
|
+
address?: {
|
|
37
|
+
address: string,
|
|
38
|
+
city: string,
|
|
39
|
+
zip: string,
|
|
40
|
+
province: string,
|
|
41
|
+
country: string,
|
|
42
|
+
},
|
|
43
|
+
individual?: boolean,
|
|
44
|
+
},
|
|
45
|
+
preferences: {
|
|
46
|
+
timezone: string,
|
|
47
|
+
},
|
|
48
|
+
created_date: string,
|
|
49
|
+
modified_date: string,
|
|
50
|
+
status: OrganizationStatus,
|
|
51
|
+
metadata: Record<string, any>,
|
|
52
|
+
internal: {
|
|
53
|
+
customer?: string,
|
|
54
|
+
contact?: string,
|
|
55
|
+
services: Record<string, ServiceInformation>,
|
|
56
|
+
deleted_date?: string,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export type Organization = DBRecord;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { OrganizationLicenseLimit } from "./organization-license-limit-types";
|
|
2
|
+
import { Organization } from "./organization-types";
|
|
3
|
+
import { Service } from "./service-types";
|
|
4
|
+
|
|
5
|
+
export type DBRecord = {
|
|
6
|
+
id: number,
|
|
7
|
+
organization: Organization[`id`],
|
|
8
|
+
service: Service[`id`],
|
|
9
|
+
name: OrganizationLicenseLimit[`name`],
|
|
10
|
+
count: number,
|
|
11
|
+
date: string,
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export type OrganizationUsage = DBRecord;
|
|
15
|
+
|
|
16
|
+
export type DBSum = { total: string };
|
|
17
|
+
export type Sum = { total: number };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { Organization } from "./organization-types";
|
|
2
|
+
|
|
3
|
+
export enum PaymentMethodType {
|
|
4
|
+
Card = `card`,
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export type DBRecord = {
|
|
8
|
+
id: number,
|
|
9
|
+
uuid: string,
|
|
10
|
+
organization: Organization[`id`],
|
|
11
|
+
type: PaymentMethodType,
|
|
12
|
+
properties: {
|
|
13
|
+
alias?: string,
|
|
14
|
+
name: string,
|
|
15
|
+
brand?: string,
|
|
16
|
+
country?: string,
|
|
17
|
+
exp_year?: number,
|
|
18
|
+
exp_month?: number,
|
|
19
|
+
},
|
|
20
|
+
enabled: boolean,
|
|
21
|
+
created_date: string,
|
|
22
|
+
modified_date: string,
|
|
23
|
+
metadata: Record<string, any>,
|
|
24
|
+
internal: {
|
|
25
|
+
payment_method_id: string,
|
|
26
|
+
fingerprint?: string,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type PaymentMethod = DBRecord;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { UserOrganizationRole } from "./user-organization-types";
|
|
2
|
+
|
|
3
|
+
export type Scopes = {
|
|
4
|
+
roles: UserOrganizationRole[],
|
|
5
|
+
};
|
|
6
|
+
|
|
7
|
+
export type DBRecord = {
|
|
8
|
+
id: number,
|
|
9
|
+
service: number,
|
|
10
|
+
event: string,
|
|
11
|
+
template: string,
|
|
12
|
+
scope: Scopes,
|
|
13
|
+
created_date: string,
|
|
14
|
+
modified_date: string,
|
|
15
|
+
default: boolean,
|
|
16
|
+
enabled: boolean,
|
|
17
|
+
metadata: Record<string, any>,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export type ServiceNotification = DBRecord;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
type Authority = {
|
|
2
|
+
host: string,
|
|
3
|
+
user?: {
|
|
4
|
+
information?: string,
|
|
5
|
+
// created?: string,
|
|
6
|
+
deleted?: string,
|
|
7
|
+
},
|
|
8
|
+
organization?: {
|
|
9
|
+
information?: string,
|
|
10
|
+
created?: string,
|
|
11
|
+
modified?: string,
|
|
12
|
+
deleted?: string,
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type DBRecord = {
|
|
17
|
+
id: number,
|
|
18
|
+
uuid: string,
|
|
19
|
+
properties: {
|
|
20
|
+
name: string,
|
|
21
|
+
description: string,
|
|
22
|
+
home?: string,
|
|
23
|
+
image: string,
|
|
24
|
+
},
|
|
25
|
+
preferences: {
|
|
26
|
+
// TODO: design preferences, colors, alternative interfaces...
|
|
27
|
+
},
|
|
28
|
+
token: string,
|
|
29
|
+
created_date: string,
|
|
30
|
+
modified_date: string,
|
|
31
|
+
enabled: boolean,
|
|
32
|
+
metadata: Record<string, any>,
|
|
33
|
+
internal: {} & Authority,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type Service = DBRecord;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Organization } from "./organization-types";
|
|
2
|
+
import { User } from "./user-types";
|
|
3
|
+
|
|
4
|
+
export enum UserOrganizationRole {
|
|
5
|
+
Owner = `owner`,
|
|
6
|
+
Admin = `admin`,
|
|
7
|
+
Staff = `staff`,
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export type ByResourceConfiguration = Record<string, (number | string)[]>;
|
|
11
|
+
|
|
12
|
+
export type DBRecord = {
|
|
13
|
+
id: number,
|
|
14
|
+
user: User[`id`],
|
|
15
|
+
organization: Organization[`id`],
|
|
16
|
+
role: UserOrganizationRole,
|
|
17
|
+
invite: string,
|
|
18
|
+
invited_by: User[`id`],
|
|
19
|
+
preferences?: {
|
|
20
|
+
notifications?: {
|
|
21
|
+
[key: string]: boolean | ByResourceConfiguration,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
created_date: string,
|
|
25
|
+
modified_date: string,
|
|
26
|
+
enabled: boolean,
|
|
27
|
+
metadata: Record<string, any>,
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type UserOrganization =
|
|
31
|
+
DBRecord & {};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export enum UserStatus {
|
|
2
|
+
Pending = `pending`,
|
|
3
|
+
Active = `active`,
|
|
4
|
+
Expired = `expired`,
|
|
5
|
+
Blocked = `blocked`
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export enum CommunicationType {
|
|
9
|
+
Commercial = `commercial`,
|
|
10
|
+
Newsletter = `newsletter`,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export type UTM = Partial<{
|
|
14
|
+
medium: string,
|
|
15
|
+
source: string,
|
|
16
|
+
campaign: string,
|
|
17
|
+
}>;
|
|
18
|
+
|
|
19
|
+
export type Communications = Partial<Record<CommunicationType, boolean>>;
|
|
20
|
+
|
|
21
|
+
export type DBRecord = {
|
|
22
|
+
id: number,
|
|
23
|
+
uuid: string,
|
|
24
|
+
email: string,
|
|
25
|
+
password: string,
|
|
26
|
+
properties: {
|
|
27
|
+
name: string,
|
|
28
|
+
surnames: string,
|
|
29
|
+
image?: string,
|
|
30
|
+
},
|
|
31
|
+
preferences: {
|
|
32
|
+
language: string,
|
|
33
|
+
communications?: Communications,
|
|
34
|
+
},
|
|
35
|
+
utm: UTM,
|
|
36
|
+
referrer?: string,
|
|
37
|
+
omnipotent: boolean,
|
|
38
|
+
created_date: string,
|
|
39
|
+
modified_date: string,
|
|
40
|
+
status: UserStatus,
|
|
41
|
+
metadata: Record<string, any>,
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
export type User = DBRecord;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// oauth authorization
|
|
2
|
+
// export type OAuth = {
|
|
3
|
+
// id_token: string,
|
|
4
|
+
// } & BearerAuthorization;
|
|
5
|
+
|
|
6
|
+
// export type StartOAuth = {
|
|
7
|
+
// client_id: string,
|
|
8
|
+
// redirect_uri: string,
|
|
9
|
+
// response_type: string,
|
|
10
|
+
// scope: string,
|
|
11
|
+
// access_type: string,
|
|
12
|
+
// };
|
|
13
|
+
|
|
14
|
+
// export type Exchange = {
|
|
15
|
+
// client_id: string,
|
|
16
|
+
// client_secret: string,
|
|
17
|
+
// grant_type: `authorization_code`,
|
|
18
|
+
// scope: string,
|
|
19
|
+
// redirect_uri: string,
|
|
20
|
+
// code: string,
|
|
21
|
+
// } | {
|
|
22
|
+
// client_id: string,
|
|
23
|
+
// client_secret: string,
|
|
24
|
+
// grant_type: `refresh_token`,
|
|
25
|
+
// refresh_token: string,
|
|
26
|
+
// };
|