Skip to content

Commit

Permalink
chore(develop): sync types to dmgincs/nestjs-api
Browse files Browse the repository at this point in the history
  • Loading branch information
damageinc-bot[bot] committed Mar 23, 2024
1 parent 2c3ba1c commit 4f727bb
Show file tree
Hide file tree
Showing 6 changed files with 138 additions and 103 deletions.
3 changes: 1 addition & 2 deletions src/auth/DeleteObjectPermissionsRequest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable max-classes-per-file */
import { PermissionActions } from '~/types/PermissionAction';

class DeletedPermission {
/** The permission object ID to delete */
Expand All @@ -8,7 +7,7 @@ class DeletedPermission {

/** The associated action to remove */

action: PermissionActions;
action: string;
}

export class DeleteObjectPermissionsRequestDto {
Expand Down
3 changes: 1 addition & 2 deletions src/auth/UpdateObjectPermissionRequest.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* eslint-disable max-classes-per-file */
import { PermissionActions } from '~/types/PermissionAction';

class UpdatedPermission {

Expand All @@ -9,7 +8,7 @@ class UpdatedPermission {

/** The action of the permission */

action: PermissionActions;
action: string;

/** Whether the action is allowed */

Expand Down
20 changes: 10 additions & 10 deletions src/constants/Events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ export const EventTypeRepTypes: { [key in EventTypes]: EmtRepTypes } = {
};

export const EventTypePermissionObjects: { [key in EventTypes]: PermissionObjectNames } = {
[EventTypes.CASUAL]: PermissionObjectNames.EMT_LOG_CASUAL,
[EventTypes.COMPETITIVE]: PermissionObjectNames.EMT_LOG_COMPETITIVE,
[EventTypes.COMMUNITY]: PermissionObjectNames.EMT_LOG_COMMUNITY,
[EventTypes.TWITCH]: PermissionObjectNames.EMT_LOG_TWITCH,
[EventTypes.MEETING]: PermissionObjectNames.EMT_LOG_MEETING,
[EventTypes.COACH]: PermissionObjectNames.EMT_LOG_COACH,
[EventTypes.TRAINING]: PermissionObjectNames.EMT_LOG_TRAINING,
[EventTypes.REAL_LIFE]: PermissionObjectNames.EMT_LOG_REAL_LIFE,
[EventTypes.SOCIAL]: PermissionObjectNames.EMT_LOG_SOCIAL
[EventTypes.CASUAL]: PermissionObjectNames.EMT__LOG__CASUAL,
[EventTypes.COMPETITIVE]: PermissionObjectNames.EMT__LOG__COMPETITIVE,
[EventTypes.COMMUNITY]: PermissionObjectNames.EMT__LOG__COMMUNITY,
[EventTypes.TWITCH]: PermissionObjectNames.EMT__LOG__TWITCH,
[EventTypes.MEETING]: PermissionObjectNames.EMT__LOG__MEETING,
[EventTypes.COACH]: PermissionObjectNames.EMT__LOG__COACH,
[EventTypes.TRAINING]: PermissionObjectNames.EMT__LOG__TRAINING,
[EventTypes.REAL_LIFE]: PermissionObjectNames.EMT__LOG__REAL_LIFE,
[EventTypes.SOCIAL]: PermissionObjectNames.EMT__LOG__SOCIAL
};

export enum EventRegions {
Expand All @@ -52,7 +52,7 @@ export enum EventRsvpTypes {
}

export const EventRsvpInvitePermissionObjects: { [key: string]: PermissionObjectNames } = {
'new initiates': PermissionObjectNames.EMT_INVITE_NEW_INITIATES
'new initiates': PermissionObjectNames.EMT__INVITE__NEW_INITIATES
};

export const NumberOfFreeCoachingEvents = 2;
26 changes: 26 additions & 0 deletions src/reports/LftDataReponse.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* eslint-disable max-classes-per-file */

class LftData {
/** The post author */
author: string;

/** The post title */
title: string;

/** The post content */
content: string;

/** The post tags */
tags: string[];

/** The post creation date */
createdDate: string;
}

export class LftDataResponseDto {
/** LFT data */
lft: LftData[];

/** LFP data */
lfp: LftData[];
}
10 changes: 5 additions & 5 deletions src/types/PermissionAction.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export enum PermissionActions {
READ = 'read',
WRITE = 'write',
CREATE = 'create',
DELETE = 'delete',
MANAGE = 'manage' // All of the above
READ = 0,
WRITE = 1,
CREATE = 2,
DELETE = 3,
MANAGE = 4 // All of the above
}
179 changes: 95 additions & 84 deletions src/types/admin/PermissionObjectNames.ts
Original file line number Diff line number Diff line change
@@ -1,102 +1,113 @@
// Permissions will be combined into a 4-bit HEX number
// 000 0
// the first three will correspond with the PermissionObject
// the last bit will correspond with the PermissionAction

// So an example HEX would be 0192
// 019 = 25 (DEC) = SELF
// 2 = 2 (DEC) = CREATE

export enum PermissionObjectNames {
// LOGINs
APPLICATION_LOGIN_ADMIN = 'application.login.admin',
APPLICATION__LOGIN__ADMIN = 0,

// PERMISSIONS
PERMISSIONS_API_KEYS = 'permissions.apikeys',
PERMISSIONS_OBJECT = 'permissions.object',
PERMISSIONS_ROLES = 'permissions.roles',
PERMISSIONS__API__KEYS = 5,
PERMISSIONS__OBJECT = 6,
PERMISSIONS__ROLES = 7,

// MEMBER is for fetching/changing data about OTHER PEOPLE
MEMBER_AWARDS = 'member.awards',
MEMBER_AWAY = 'member.away',
MEMBER_DISCORD_ADD_TO_SERVER = 'member.discord.add_to_server',
MEMBER_DISCORD_SYNC = 'member.discord.sync',
MEMBER_RPG_ITEMS = 'member.rpg.items',
MEMBER_MERGE = 'member.merge',
MEMBER_NAME = 'member.name',
MEMBER_NOTES = 'member.notes',
MEMBER_PROFILE = 'member.profile',
MEMBERS_AWAY = 'members.away',
MEMBERS_NOTIFY = 'members.notify',
MEMBERS_EMAIL = 'members.email',
MEMBER__AWARDS = 10,
MEMBER__AWAY = 11,
MEMBER__DISCORD__ADD_TO_SERVER = 12,
MEMBER__DISCORD__SYNC = 13,
MEMBER__RPG__ITEMS = 14,
MEMBER__MERGE = 15,
MEMBER__NAME = 16,
MEMBER__NOTES = 17,
MEMBER__PROFILE = 18,
MEMBERS__AWAY = 19,
MEMBERS__NOTIFY = 20,
MEMBERS__EMAIL = 21,

// SELF is for fetching/changing data about THEMSELVES
SELF = 'self', // for getting a basic summary/mini-profile about yourself.
SELF_ACCOUNT_SIGNIN = 'self.account.sign_in',
SELF_ACCOUNT_SIGNIN_THIRD_PARTY = 'self.account.sign_in.third_party',
SELF_AWAY = 'self.away',
SELF_DISCORD_ROLES = 'self.discord.roles',
SELF_GIFT_REP = 'self.gift_rep',
SELF_MOBILE_LINKED_DEVICES = 'self.mobile.linked_devices',
SELF_MOBILE_SETTINGS = 'self.mobile.settings',
SELF_NOTIFICATIONS = 'self.notifications',
SELF_NOTIFICATIONS_SETTINGS = 'self.notifications.settings',
SELF_PERMISSIONS = 'self.permissions',
SELF_STATS = 'self.stats',
SELF_STRIKES = 'self.strikes',
SELF = 25, // for getting a basic summary/mini-profile about yourself.
SELF__ACCOUNT__SIGNIN = 26,
SELF__ACCOUNT__SIGNIN_THIRD_PARTY = 27,
SELF__AWAY = 28,
SELF__DISCORD__ROLES = 29,
SELF__GIFT_REP = 30,
SELF__MOBILE__LINKED_DEVICES = 31,
SELF__MOBILE__SETTINGS = 32,
SELF__NOTIFICATIONS = 33,
SELF__NOTIFICATIONS__SETTINGS = 34,
SELF__PERMISSIONS = 35,
SELF__STATS = 36,
SELF__STRIKES = 37,

// EMT
EMT_EVENT = 'emt.event',
EMT_EVENT_HISTORY = 'emt.event.history',
EMT_EVENT_RSVP = 'emt.event.rsvp',
EMT_EVENTS = 'emt.events',
EMT_HOSTING = 'emt.hosting',
EMT_INVITE_NEW_INITIATES = 'emt.invite.new_initiates',
EMT_LOG = 'emt.log',
EMT_LOG_CASUAL = 'emt.log.casual',
EMT_LOG_COACH = 'emt.log.coach',
EMT_LOG_COMMUNITY = 'emt.log.community',
EMT_LOG_COMPETITIVE = 'emt.log.competitive',
EMT_LOG_MEETING = 'emt.log.meeting',
EMT_LOG_MORNING_TEA = 'emt.log.morning_tea',
EMT_LOG_REAL_LIFE = 'emt.log.real_life',
EMT_LOG_SOCIAL = 'emt.log.social',
EMT_LOG_TRAINING = 'emt.log.training',
EMT_LOG_TWITCH = 'emt.log.twitch',
EMT_LOGS = 'emt.logs',
EMT__EVENT = 38,
EMT__EVENT__HISTORY = 39,
EMT__EVENT__RSVP = 40,
EMT__EVENTS = 41,
EMT__HOSTING = 42,
EMT__INVITE__NEW_INITIATES = 43,
EMT__LOG = 44,
EMT__LOG__CASUAL = 45,
EMT__LOG__COACH = 46,
EMT__LOG__COMMUNITY = 47,
EMT__LOG__COMPETITIVE = 48,
EMT__LOG__MEETING = 49,
EMT__LOG__MORNING_TEA = 50,
EMT__LOG__REAL_LIFE = 51,
EMT__LOG__SOCIAL = 52,
EMT__LOG__TRAINING = 53,
EMT__LOG__TWITCH = 54,
EMT__LOGS = 55,

// RPG = CRAFTING/ITEM/LEVEL/PERK/STEAL SYSTEM
MEMBER_RPG_BOOSTS = 'member.rpg.boosts',
MEMBER_RPG_PROTECTION = 'member.rpg.protection',
MEMBER_RPG_STATS = 'member.rpg.stats',
MEMBERS_RPG_LEVELS = 'members.rpg.levels',
RPG_ITEMS = 'rpg.items',
RPG_AUCTION = 'rpg.items.auction',
RPG_ITEMS_HISTORY = 'rpg.items.history',
RPG_LEVELS = 'rpg.levels',
RPG_REPSHOP = 'rpg.repshop',
RPG_REPSHOP_PROCESS = 'rpg.repshop.process',
REPSHOP = 'repshop',
MEMBER__RPG__BOOSTS = 56,
MEMBER__RPG__PROTECTION = 57,
MEMBER__RPG__STATS = 58,
MEMBERS__RPG__LEVELS = 59,
RPG__ITEMS = 60,
RPG__AUCTION = 61,
RPG__ITEMS__HISTORY = 62,
RPG__LEVELS = 63,
RPG__REPSHOP = 64,
RPG__REPSHOP__PROCESS = 65,
REPSHOP = 66,
// managing yourself
SELF_RPG_BOOSTS = 'self.rpg.boosts',
SELF_RPG_CRAFTING = 'self.rpg.crafting',
SELF_RPG_ITEMS = 'self.rpg.items',
SELF_RPG_LEVELS = 'self.rpg.levels',
SELF_RPG_PERK = 'self.rpg.perks',
SELF__RPG__BOOSTS = 67,
SELF__RPG__CRAFTING = 68,
SELF__RPG__ITEMS = 69,
SELF__RPG__LEVELS = 70,
SELF__RPG__PERK = 71,

// ADMIN
ADMIN_LOGS = 'admin.logs',
AWARDS = 'awards',
AWARDS_ISSUED = 'awards.issued',
FILES = 'files',
STRIKES = 'strikes',
STRIKES_ISSUE_ANY_RANK = 'strikes.issue_any_rank',
ADMIN__LOGS = 80,
AWARDS = 81,
AWARDS__ISSUED = 82,
FILES = 83,
MEMBER__ACCOUNT = 84,
STRIKES = 85,
STRIKES__ISSUE_ANY_RANK = 86,

// ORDERS
STRUCTURE_DIVISIONS = 'structure.divisions',
STRUCTURE_DIVISIONS_MERGE = 'structure.divisions.merge',
STRUCTURE_DIVISIONS_SPLIT = 'structure.divisions.split',
STRUCTURE_HOUSES = 'structure.houses',
INITIATE_APPLICATIONS = 'initiate.applications',
INITIATE_COHORT_MESSAGE = 'initiate.cohort.message',
INITIATE_GRADUATION = 'initiate.graduation',
INITIATE_VOTING = 'initiate.voting',
DAILY_ACTIVITY_LOGS = 'logs.daily_activity',
RECRUIT_LOGS = 'recruit_logs', // todo: rename to logs.recruits
REP = 'rep', // remember DELETE will only work for Dev, even if you give the permission out to non-Dev
REPORTS_AGE = 'reports.age',
REPORTS_COHORT = 'reports.cohort',
REPORTS_CSV = 'reports.csv',
REPORTS_LEVEL_RANK_UP = 'reports.level_rank_up',
STRUCTURE__DIVISIONS = 90,
STRUCTURE__DIVISIONS__MERGE = 91,
STRUCTURE__DIVISIONS__SPLIT = 92,
STRUCTURE__HOUSES = 93,
INITIATE__APPLICATIONS = 94,
INITIATE__COHORT__MESSAGE = 95,
INITIATE__GRADUATION = 96,
INITIATE__VOTING = 97,
DAILY__ACTIVITY__LOGS = 98,
RECRUIT__LOGS = 99, // todo: rename to logs.recruits
REP = 100, // remember DELETE will only work for Dev, even if you give the permission out to non-Dev
REPORTS__AGE = 101,
REPORTS__COHORT = 102,
REPORTS__CSV = 103,
REPORTS__LEVEL__RANK_UP = 104,
REPORTS__LFT_DATA = 105,
}

0 comments on commit 4f727bb

Please sign in to comment.