Open Santhisanduri opened 1 week ago
To address the task, we need to make changes to multiple files to ensure that WMLS site contacts are properly added to the O2I database. This involves creating a new table in the database schema, updating the project structure documentation, configuring the database connection, and seeding initial data.
db/schema.sql
We will create a new table named wmls_site_contacts
to store the WMLS site contacts.
-- Create a new table for WMLS site contacts
CREATE TABLE wmls_site_contacts (
id SERIAL PRIMARY KEY,
name VARCHAR(255) NOT NULL,
email VARCHAR(255) NOT NULL,
phone VARCHAR(20),
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
project_structure.md
We will create a detailed project structure document that outlines the directories and files relevant to the project.
# Project Structure
This document outlines the structure of the project, including directories and files, to help developers understand the organization of the codebase.
## Root Directory
- **README.md**: Project overview and instructions.
- **project_structure.md**: This document.
- **config/**: Configuration files for the project.
- **db/**: Database-related files.
- **src/**: Source code for the application.
- **tests/**: Test files and test-related resources.
## config/
- **database.yml**: Database configuration settings.
## db/
- **schema.sql**: SQL schema for database structure.
- **seed_data.sql**: SQL statements for seeding initial data into the database.
## src/
- **main.py**: Main application entry point.
- **utils/**: Utility functions and helpers.
- **models/**: Data models and ORM classes.
- **controllers/**: Application logic and controllers.
## tests/
- **test_main.py**: Tests for the main application.
- **test_utils/**: Tests for utility functions.
- **test_models/**: Tests for data models.
- **test_controllers/**: Tests for controllers.
## Adding WMLS Site Contacts
To add WMLS site contacts to the O2I database, follow these steps:
1. **Update the Database Schema**: Modify `db/schema.sql` to include a new table or fields for storing WMLS site contacts.
2. **Seed Initial Data**: Add SQL statements in `db/seed_data.sql` to insert WMLS site contacts into the database.
3. **Configure Database**: Ensure `config/database.yml` is set up correctly to accommodate the new data.
config/database.yml
We will create a proper configuration for the database connection.
default: &default
adapter: postgresql
encoding: unicode
pool: 5
username: <%= ENV['DB_USERNAME'] %>
password: <%= ENV['DB_PASSWORD'] %>
host: <%= ENV['DB_HOST'] %>
port: <%= ENV['DB_PORT'] %>
development:
<<: *default
database: myapp_development
test:
<<: *default
database: myapp_test
production:
<<: *default
database: myapp_production
username: <%= ENV['DB_PROD_USERNAME'] %>
password: <%= ENV['DB_PROD_PASSWORD'] %>
host: <%= ENV['DB_PROD_HOST'] %>
port: <%= ENV['DB_PROD_PORT'] %>
db/seed_data.sql
We will add SQL statements to insert initial WMLS site contacts into the database.
-- Insert WMLS site contacts into the wmls_site_contacts table
INSERT INTO wmls_site_contacts (id, name, email, phone, address) VALUES
(1, 'John Doe', 'john.doe@example.com', '123-456-7890', '123 Elm Street'),
(2, 'Jane Smith', 'jane.smith@example.com', '987-654-3210', '456 Oak Avenue'),
(3, 'Alice Johnson', 'alice.johnson@example.com', '555-123-4567', '789 Pine Road');
By following these steps, we ensure that the WMLS site contacts are properly added to the O2I database, and the project structure is well-documented and organized.
Click here to create a Pull Request with the proposed solution
Files used for this task:
Found some old convos and stuff, posting some finding soon re: notifications Context: There was work over a year and a half ago to get wmls retired sooner, so questions were brought up on what dependencies still existed with O2I and I was asked this and I mentioned, naturally, notifications. Gathering my thoughts and links, so here we go (edited) :raised_hands::skin-tone-2: 1
5 replies
Umesh Mandadapu Wednesday at 3:34 PM @richly : Thanks, Are you planning to send links or attachments to this message
Richly Chheuy Wednesday at 3:52 PM Since we're talking about Transfer Manager, we'll be looking at the https://gitlab.disney.com/O2I/o2i-transfer-manager-web repo. In particular: https://gitlab.disney.com/O2I/o2i-transfer-manager-web/-/blob/develop/src/main/java/com/disney/spt/receiving/process/step/AbstractSimpleNotificationProcessStep.java https://gitlab.disney.com/O2I/o2i-transfer-manager-web/-/blob/develop/src/main/java/com/disney/spt/receiving/process/step/TransferToTargetNotificationProcessStep.java TransferToTargetNotificationProcessStep extends AbstractSimpleNotificationProcessStep class above. Looking at buildNotificationTask() Notice instantiations of wmls-related classes, e.g. wmlsService . This triggers the lookup to get site info and create the notification email. Probably can refactor the logic here to start and instead do a lookup via local db/data that matches siteId being passed through the workflow (if you're cloning that data from wmls db) protected Task buildNotificationTask() { StorageSite site = wmlsService.getSite(getProcessData().getTargetLocationId()); EmailTemplate template = notificationService.buildEmailTemplate(getConfigurationProperty(EMAIL_TEMPLATE, true));
Set<NotificationContact> contacts = new HashSet<>();
contacts.add(new NotificationContact(vendorAndContactService.getSptUserForUsername(getProcessData().getUserName())));
contacts.add(new NotificationContact(site.getPrimaryContact()));
contacts.addAll(wmlsService.getSiteNotificationContacts(site));
contacts.addAll(notificationService.emailsToContacts(getProcessData().getAdditionalContacts()));
Map<String, Object> emailParams = new HashMap<>();
emailParams.put("targetDesc", wmlsService.getSite(getProcessData().getTargetLocationId()).getDescription());
SendNotificationForReceivingRequestTask task = buildTask(SendNotificationForReceivingRequestTask.class);
task.init(getProcessData(), emailParams, contacts, null, null, template);
return task;
}
Other related: https://gitlab.disney.com/O2I/o2i-wmls-client/-/blob/develop/src/main/java/com/disney/spt/service/wmls/WmlsRestService.java https://gitlab.disney.com/O2I/o2i-wmls-client/-/blob/develop/src/main/java/com/disney/spt/service/wmls/WmlsRestClient.java Snapshot of convo thread from a long while back when asked about this and the stack trace of the error when WMLS db is inaccessible when generating the notification. Can see which lines in source are being executed up until error. (edited) 2 files
Screenshot 2024-09-04 at 3.50.40 PM.png
Screenshot 2023-03-16 at 3.10.28 PM (1).png
3:55 Easier to deal with transfer manager web pipeline since that has been most recently changed, tested.
Richly Chheuy Wednesday at 4:05 PM tl;dr I guess ultimate create your own custom class(es) to instead call local o2i db data. Some examples where some o2i notifs build an email from user_account table I believe, such as for Transfer Manager problem emails. That is taking users who are part of spt_group_membership admin and apply to them to field: https://gitlab.disney.com/O2I/o2i-transfer-manager-web/-/blob/develop/src/main/resources/transfermanager.properties https://gitlab.disney.com/O2I/o2i-transfer-manager-web/-/blob/develop/src/main/java/c[…]/spt/receiving/service/notification/NotificationService.java notification.problem.targetGroup
notification.email.disableEmail = false notification.email.server = sptmailrelay.studio.disney.com notification.email.fromAddress = twds.transmgr@studio.disney.com notification.email.fromName = Disney Transfer Manager notification.email.groupsToCopy = SPT-SoftwareNotifications notification.email.addressesToCopy = notification.email.subjectPrefix = (Dev)
notification.problem.targetGroup = ${admin.group} notification.requestDetail.uri = http://foo.bar.baz/ (edited)
Richly Chheuy Wednesday at 4:34 PM On the zoom call, https://gitlab.disney.com/O2I/o2i-email-service/-/blob/develop/emailapi-web/src/main/java/com/disney/spt/mail/controller/ApiController.java was shown, but no wmls classes are referenced, so I think the o2i-email-service is more of a way to better manage or handle email templating (when emails are being sent out) for various types of notifications (as we have to remember O2I being a beast of an app back in its heyday and different types of emails were sent out depending on the app or workflow). (edited)" please read this chat we have a new project for you guys. As you may have heard, WMLS is moving to Studio to be deprecated. O2i currently has dependencies within WMLS- particularly the table pertaining to the notification step of TM1 transfers wmls_site_contacts & also other tables holding the foreign keys within this. We will need to pull this table into the O2i db & also update the code configurations within the O2i repos. The first step is to clone down the O2i repos & try to locate where this table is in the code
Found some old convos and stuff, posting some finding soon re: notifications Context: There was work over a year and a half ago to get wmls retired sooner, so questions were brought up on what dependencies still existed with O2I and I was asked this and I mentioned, naturally, notifications. Gathering my thoughts and links, so here we go (edited) 🙌:skin-tone-2: 1
5 replies
Umesh Mandadapu Wednesday at 3:34 PM @richly : Thanks, Are you planning to send links or attachments to this message
Richly Chheuy Wednesday at 3:52 PM Since we're talking about Transfer Manager, we'll be looking at the https://gitlab.disney.com/O2I/o2i-transfer-manager-web repo. In particular: https://gitlab.disney.com/O2I/o2i-transfer-manager-web/-/blob/develop/src/main/java/com/disney/spt/receiving/process/step/AbstractSimpleNotificationProcessStep.java https://gitlab.disney.com/O2I/o2i-transfer-manager-web/-/blob/develop/src/main/java/com/disney/spt/receiving/process/step/TransferToTargetNotificationProcessStep.java TransferToTargetNotificationProcessStep extends AbstractSimpleNotificationProcessStep class above. Looking at buildNotificationTask() Notice instantiations of wmls-related classes, e.g. wmlsService . This triggers the lookup to get site info and create the notification email. Probably can refactor the logic here to start and instead do a lookup via local db/data that matches siteId being passed through the workflow (if you're cloning that data from wmls db) protected Task buildNotificationTask() { StorageSite site = wmlsService.getSite(getProcessData().getTargetLocationId()); EmailTemplate template = notificationService.buildEmailTemplate(getConfigurationProperty(EMAIL_TEMPLATE, true));
Set<NotificationContact> contacts = new HashSet<>();
contacts.add(new NotificationContact(vendorAndContactService.getSptUserForUsername(getProcessData().getUserName())));
contacts.add(new NotificationContact(site.getPrimaryContact()));
contacts.addAll(wmlsService.getSiteNotificationContacts(site));
contacts.addAll(notificationService.emailsToContacts(getProcessData().getAdditionalContacts()));
Map<String, Object> emailParams = new HashMap<>();
emailParams.put("targetDesc", wmlsService.getSite(getProcessData().getTargetLocationId()).getDescription());
SendNotificationForReceivingRequestTask task = buildTask(SendNotificationForReceivingRequestTask.class);
task.init(getProcessData(), emailParams, contacts, null, null, template);
return task;
} Other related: https://gitlab.disney.com/O2I/o2i-wmls-client/-/blob/develop/src/main/java/com/disney/spt/service/wmls/WmlsRestService.java https://gitlab.disney.com/O2I/o2i-wmls-client/-/blob/develop/src/main/java/com/disney/spt/service/wmls/WmlsRestClient.java Snapshot of convo thread from a long while back when asked about this and the stack trace of the error when WMLS db is inaccessible when generating the notification. Can see which lines in source are being executed up until error. (edited) 2 files
Screenshot 2024-09-04 at 3.50.40 PM.png
Screenshot 2023-03-16 at 3.10.28 PM (1).png
3:55 Easier to deal with transfer manager web pipeline since that has been most recently changed, tested.
Richly Chheuy Wednesday at 4:05 PM tl;dr I guess ultimate create your own custom class(es) to instead call local o2i db data. Some examples where some o2i notifs build an email from user_account table I believe, such as for Transfer Manager problem emails. That is taking users who are part of spt_group_membership admin and apply to them to field: https://gitlab.disney.com/O2I/o2i-transfer-manager-web/-/blob/develop/src/main/resources/transfermanager.properties https://gitlab.disney.com/O2I/o2i-transfer-manager-web/-/blob/develop/src/main/java/c[…]/spt/receiving/service/notification/NotificationService.java notification.problem.targetGroup
notification.email.disableEmail = false notification.email.server = sptmailrelay.studio.disney.com notification.email.fromAddress = twds.transmgr@studio.disney.com notification.email.fromName = Disney Transfer Manager notification.email.groupsToCopy = SPT-SoftwareNotifications notification.email.addressesToCopy = notification.email.subjectPrefix = (Dev)
notification.problem.targetGroup = ${admin.group} notification.requestDetail.uri = http://foo.bar.baz/ (edited)
Richly Chheuy Wednesday at 4:34 PM On the zoom call, https://gitlab.disney.com/O2I/o2i-email-service/-/blob/develop/emailapi-web/src/main/java/com/disney/spt/mail/controller/ApiController.java was shown, but no wmls classes are referenced, so I think the o2i-email-service is more of a way to better manage or handle email templating (when emails are being sent out) for various types of notifications (as we have to remember O2I being a beast of an app back in its heyday and different types of emails were sent out depending on the app or workflow). (edited)" please read this chat we have a new project for you guys. As you may have heard, WMLS is moving to Studio to be deprecated. O2i currently has dependencies within WMLS- particularly the table pertaining to the notification step of TM1 transfers wmls_site_contacts & also other tables holding the foreign keys within this. We will need to pull this table into the O2i db & also update the code configurations within the O2i repos. The first step is to clone down the O2i repos & try to locate where this table is in the code""
please give me project structure and wmls site contacts wants add in o2i db