{"id":1368,"date":"2024-01-15T13:22:33","date_gmt":"2024-01-15T05:22:33","guid":{"rendered":"https:\/\/www.tonghin.com.my\/blog\/?p=1368"},"modified":"2024-01-15T13:22:51","modified_gmt":"2024-01-15T05:22:51","slug":"finishing-the-internship-in-tong-hin","status":"publish","type":"post","link":"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/15\/finishing-the-internship-in-tong-hin\/","title":{"rendered":"Finishing the internship in Tong Hin"},"content":{"rendered":"\n<p>Hello all, this is the last week of my internship at Tong Hin. I started this week&#8217;s internship by modifying the table sorting for payment and orders tables. Previously I had sorted the payment and sales order tables by the id. However, I have changed it to sort by the latest date, since Mr. Peter said that most of the users that use our system will prefer seeing the latest order or payment that have been made. So, I changed the \u201cORDER BY id\u201d statement in these two tables to \u201cORDER BY datetime DESC\u201d.<\/p>\n\n\n\n<p>Next, I refactor the item API. I have changed the get item list query in item API to query the item list by category id instead of category name. This is because the category name may be duplicate. So, it is better to get the item list by category id. Besides that, I have also changed the get item list query by showing the uom name. Mr. Peter has told me that each item will have one uom. Furthermore, I have also changed the get item by barcode query to show the uom. Moreover, I have also changed the logic for generating random items command to generate one uom for each of the item.&nbsp;<\/p>\n\n\n\n<p>The next task that I do is to add two functions in item API. These two functions are the function that will be used in the feature of getting sales orders by id. These two private functions are not an API, so I don\u2019t need to add it in the controller in the API project. For the first function which is the get item name and uom by single barcode query, it will return a string that will show the item and uom name by single barcode only. Firstly, I will add a filter that will return the item by the barcode. Then, I will link it to the uom collection in MongoDB in order to retrieve the uom name. Next, I will connect the item name and uom name that is being retrieved in a string and return the string.&nbsp;<\/p>\n\n\n\n<p>After that, I have done the second function which is to retrieve the item name and uom name list by barcode list query. For this function, I have used the in function for the filter so that it can filter the item based on the barcode list. Then, I will link the item to the uom collection in order to retrieve the uoms for the items. Next, I will connect the item name and uom name that is being retrieved in a string for each of the items and add it to the list of strings. Lastly, I will return the list of strings. Lastly, I have linked this function to the get order by id function in the handler part. I need to set the name and uom name for the dto in this query. Firstly, I will use the function of get item name by barcode list to retrieve the list of strings. Next, for each of the strings in the result list, I will split the string into two parts. The first part is the item name, while the second part is the uom name and set it to the dto.<\/p>\n\n\n\n<p>After finishing these tasks, my internship has ended. During this internship, I have learned a lot about the knowledge of backend programming in order to construct an in-house system for a company. Besides that, I have also learned how to interact more with SQL databases, and MongoDB databases in order to retrieve or update data. I would like to thank you to Mr. Peter and Tong Hin company for giving me such a good opportunity to become an intern in the company. This internship has given me a good impression and it has motivated me to become a better software developer in the future.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hello all, this is the last week of my internship at Tong Hin. I started this week&#8217;s internship by modifying the table sorting for payment and orders tables. Previously I had sorted the payment and sales order tables by the id. However, I have changed it to sort by the latest date, since Mr. Peter &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/15\/finishing-the-internship-in-tong-hin\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Finishing the internship in Tong Hin&#8221;<\/span><\/a><\/p>\n","protected":false},"author":12,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v15.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Finishing the internship in Tong Hin | Tong Hin&#039;s Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/15\/finishing-the-internship-in-tong-hin\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Finishing the internship in Tong Hin | Tong Hin&#039;s Blog\" \/>\n<meta property=\"og:description\" content=\"Hello all, this is the last week of my internship at Tong Hin. I started this week&#8217;s internship by modifying the table sorting for payment and orders tables. Previously I had sorted the payment and sales order tables by the id. However, I have changed it to sort by the latest date, since Mr. Peter &hellip; Continue reading &quot;Finishing the internship in Tong Hin&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/15\/finishing-the-internship-in-tong-hin\/\" \/>\n<meta property=\"og:site_name\" content=\"Tong Hin&#039;s Blog\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-15T05:22:33+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-15T05:22:51+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\">\n\t<meta name=\"twitter:data1\" content=\"3 minutes\">\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#organization\",\"name\":\"TONG HIN MACHINERY\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"sameAs\":[\"https:\/\/www.youtube.com\/channel\/UC60EoxJMNbu8mV0LuEGfrBg\"],\"logo\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#logo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/wp-content\/uploads\/2020\/10\/web_logo_180_180.jpg\",\"width\":180,\"height\":180,\"caption\":\"TONG HIN MACHINERY\"},\"image\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#logo\"}},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#website\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"name\":\"Tong Hin&#039;s Blog\",\"description\":\"Sharing About Technology\",\"publisher\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":\"https:\/\/www.tonghin.com.my\/blog\/?s={search_term_string}\",\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/15\/finishing-the-internship-in-tong-hin\/#webpage\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/15\/finishing-the-internship-in-tong-hin\/\",\"name\":\"Finishing the internship in Tong Hin | Tong Hin&#039;s Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#website\"},\"datePublished\":\"2024-01-15T05:22:33+00:00\",\"dateModified\":\"2024-01-15T05:22:51+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/15\/finishing-the-internship-in-tong-hin\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/15\/finishing-the-internship-in-tong-hin\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/15\/finishing-the-internship-in-tong-hin\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"position\":2,\"item\":{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/15\/finishing-the-internship-in-tong-hin\/\",\"url\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/15\/finishing-the-internship-in-tong-hin\/\",\"name\":\"Finishing the internship in Tong Hin\"}}]},{\"@type\":\"Article\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/15\/finishing-the-internship-in-tong-hin\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/15\/finishing-the-internship-in-tong-hin\/#webpage\"},\"author\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#\/schema\/person\/2ecfc5099c21184cef870f07c87e7c01\"},\"headline\":\"Finishing the internship in Tong Hin\",\"datePublished\":\"2024-01-15T05:22:33+00:00\",\"dateModified\":\"2024-01-15T05:22:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/15\/finishing-the-internship-in-tong-hin\/#webpage\"},\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#organization\"},\"articleSection\":\"Experiential\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.tonghin.com.my\/blog\/2024\/01\/15\/finishing-the-internship-in-tong-hin\/#respond\"]}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#\/schema\/person\/2ecfc5099c21184cef870f07c87e7c01\",\"name\":\"Lee Boon Hao\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/www.tonghin.com.my\/blog\/#personlogo\",\"inLanguage\":\"en-US\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/df849a70b358c24e8b186103d8dba306?s=96&d=mm&r=g\",\"caption\":\"Lee Boon Hao\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","_links":{"self":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts\/1368"}],"collection":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/comments?post=1368"}],"version-history":[{"count":3,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts\/1368\/revisions"}],"predecessor-version":[{"id":1376,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/posts\/1368\/revisions\/1376"}],"wp:attachment":[{"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/media?parent=1368"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/categories?post=1368"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tonghin.com.my\/blog\/wp-json\/wp\/v2\/tags?post=1368"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}